当前位置: 首页>>代码示例>>PHP>>正文


PHP Audit::getAssociatedFieldName方法代码示例

本文整理汇总了PHP中Audit::getAssociatedFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP Audit::getAssociatedFieldName方法的具体用法?PHP Audit::getAssociatedFieldName怎么用?PHP Audit::getAssociatedFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Audit的用法示例。


在下文中一共展示了Audit::getAssociatedFieldName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_audit_list

 function get_audit_list()
 {
     global $focus, $genericAssocFieldsArray, $moduleAssocFieldsArray, $current_user, $timedate, $app_strings;
     $audit_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null || !$focus->ACLAccess('', $focus->isOwner($current_user->id))) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     if ($focus->is_AuditEnabled()) {
         $order = ' order by ' . $focus->get_audit_table_name() . '.date_created desc';
         //order by contacts_audit.date_created desc
         $query = "SELECT " . $focus->get_audit_table_name() . ".*, users.user_name FROM " . $focus->get_audit_table_name() . ", users WHERE " . $focus->get_audit_table_name() . ".created_by = users.id AND " . $focus->get_audit_table_name() . ".parent_id = '{$focus->id}'" . $order;
         $result = $focus->db->query($query);
         //if($focus->db->getRowCount($result) > 0){
         // We have some data.
         require 'metadata/audit_templateMetaData.php';
         $fieldDefs = $dictionary['audit']['fields'];
         while (($row = $focus->db->fetchByAssoc($result)) != null) {
             $temp_list = array();
             foreach ($fieldDefs as $field) {
                 if (isset($row[$field['name']])) {
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && (array_key_exists($row['field_name'], $genericAssocFieldsArray) || !empty($moduleAssocFieldsArray[$focus->object_name]) && array_key_exists($row['field_name'], $moduleAssocFieldsArray[$focus->object_name]))) {
                         $temp_list[$field['name']] = Audit::getAssociatedFieldName($row['field_name'], $row[$field['name']]);
                     } else {
                         $temp_list[$field['name']] = $row[$field['name']];
                     }
                     if ($field['name'] == 'date_created') {
                         $temp_list[$field['name']] = $timedate->to_display_date_time($temp_list[$field['name']]);
                     }
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && ($row['data_type'] = "enum")) {
                         global $app_list_strings;
                         if (isset($focus->field_defs[$row['field_name']]['options'])) {
                             $domain = $focus->field_defs[$row['field_name']]['options'];
                             if (isset($app_list_strings[$domain][$temp_list[$field['name']]])) {
                                 $temp_list[$field['name']] = $app_list_strings[$domain][$temp_list[$field['name']]];
                             }
                         }
                     } elseif ($field['name'] == 'field_name') {
                         global $mod_strings;
                         if (isset($focus->field_defs[$row['field_name']]['vname'])) {
                             $label = $focus->field_defs[$row['field_name']]['vname'];
                             $temp_list[$field['name']] = translate($label, $focus->module_dir);
                         }
                     }
                 }
             }
             $temp_list['created_by'] = $row['user_name'];
             $audit_list[] = $temp_list;
         }
         //}
     }
     return $audit_list;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:55,代码来源:Audit.php

示例2: get_audit_list

 /**
  * @Deprecated
  */
 public function get_audit_list()
 {
     global $focus, $genericAssocFieldsArray, $moduleAssocFieldsArray, $current_user, $timedate, $app_strings;
     $audit_list = array();
     if (!empty($_REQUEST['record'])) {
         $result = $focus->retrieve($_REQUEST['record']);
         if ($result == null || !$focus->ACLAccess('', $focus->isOwner($current_user->id))) {
             sugar_die($app_strings['ERROR_NO_RECORD']);
         }
     }
     if ($focus->is_AuditEnabled()) {
         $order = ' order by ' . $focus->get_audit_table_name() . '.date_created desc';
         //order by contacts_audit.date_created desc
         $query = "SELECT " . $focus->get_audit_table_name() . ".*, users.user_name FROM " . $focus->get_audit_table_name() . ", users WHERE " . $focus->get_audit_table_name() . ".created_by = users.id AND " . $focus->get_audit_table_name() . ".parent_id = '{$focus->id}'" . $order;
         $result = $focus->db->query($query);
         // We have some data.
         require 'metadata/audit_templateMetaData.php';
         $fieldDefs = $dictionary['audit']['fields'];
         while (($row = $focus->db->fetchByAssoc($result)) != null) {
             if (!ACLField::hasAccess($row['field_name'], $focus->module_dir, $GLOBALS['current_user']->id, $focus->isOwner($GLOBALS['current_user']->id))) {
                 continue;
             }
             //If the team_set_id field has a log entry, we retrieve the list of teams to display
             if ($row['field_name'] == 'team_set_id') {
                 $row['field_name'] = 'team_name';
                 require_once 'modules/Teams/TeamSetManager.php';
                 $row['before_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['before_value_string']);
                 $row['after_value_string'] = TeamSetManager::getCommaDelimitedTeams($row['after_value_string']);
             }
             $temp_list = array();
             foreach ($fieldDefs as $field) {
                 if (array_key_exists($field['name'], $row)) {
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && (array_key_exists($row['field_name'], $genericAssocFieldsArray) || !empty($moduleAssocFieldsArray[$focus->object_name]) && array_key_exists($row['field_name'], $moduleAssocFieldsArray[$focus->object_name]))) {
                         $temp_list[$field['name']] = Audit::getAssociatedFieldName($row['field_name'], $row[$field['name']]);
                     } else {
                         $temp_list[$field['name']] = $row[$field['name']];
                     }
                     if ($field['name'] == 'date_created') {
                         $date_created = '';
                         if (!empty($temp_list[$field['name']])) {
                             $date_created = $timedate->to_display_date_time($temp_list[$field['name']]);
                             $date_created = !empty($date_created) ? $date_created : $temp_list[$field['name']];
                         }
                         $temp_list[$field['name']] = $date_created;
                     }
                     if (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && ($row['data_type'] == "enum" || $row['data_type'] == "multienum")) {
                         global $app_list_strings;
                         $enum_keys = unencodeMultienum($temp_list[$field['name']]);
                         $enum_values = array();
                         foreach ($enum_keys as $enum_key) {
                             if (isset($focus->field_defs[$row['field_name']]['options'])) {
                                 $domain = $focus->field_defs[$row['field_name']]['options'];
                                 if (isset($app_list_strings[$domain][$enum_key])) {
                                     $enum_values[] = $app_list_strings[$domain][$enum_key];
                                 }
                             }
                         }
                         if (!empty($enum_values)) {
                             $temp_list[$field['name']] = implode(', ', $enum_values);
                         }
                         if ($temp_list['data_type'] === 'date') {
                             $temp_list[$field['name']] = $timedate->to_display_date($temp_list[$field['name']], false);
                         }
                     } elseif (($field['name'] == 'before_value_string' || $field['name'] == 'after_value_string') && $row['data_type'] == "datetimecombo") {
                         if (!empty($temp_list[$field['name']]) && $temp_list[$field['name']] != 'NULL') {
                             $temp_list[$field['name']] = $timedate->to_display_date_time($temp_list[$field['name']]);
                         } else {
                             $temp_list[$field['name']] = '';
                         }
                     } elseif ($field['name'] == 'field_name') {
                         global $mod_strings;
                         if (isset($focus->field_defs[$row['field_name']]['vname'])) {
                             $label = $focus->field_defs[$row['field_name']]['vname'];
                             $temp_list[$field['name']] = translate($label, $focus->module_dir);
                         }
                     }
                 }
             }
             $temp_list['created_by'] = $row['user_name'];
             $audit_list[] = $temp_list;
         }
     }
     return $audit_list;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:87,代码来源:Audit.php

示例3: testgetAssociatedFieldName

 public function testgetAssociatedFieldName()
 {
     global $focus;
     $focus = new Account();
     //use audit enabbled module object
     $audit = new Audit();
     //test with name field
     $result = $audit->getAssociatedFieldName('name', '1');
     $this->assertEquals('1', $result);
     //test with parent_id field
     $result = $audit->getAssociatedFieldName('parent_id', '1');
     $this->assertEquals(null, $result);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:13,代码来源:AuditTest.php


注:本文中的Audit::getAssociatedFieldName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。