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


PHP SugarBean::is_AuditEnabled方法代码示例

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


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

示例1: getAuditLog

 /**
  * This method gets the Audit log and formats it specifically for the API.
  * @param  type SugarBean $bean
  * @return array
  */
 public function getAuditLog(SugarBean $bean)
 {
     global $timedate;
     if (!$bean->is_AuditEnabled()) {
         return array();
     }
     $auditTable = $bean->get_audit_table_name();
     $query = "SELECT {$auditTable}.*, users.user_name AS created_by_username\n                FROM {$auditTable}, users\n                WHERE {$auditTable}.created_by = users.id AND {$auditTable}.parent_id = '{$bean->id}'\n                ORDER BY {$auditTable}.date_created DESC";
     $db = DBManagerFactory::getInstance();
     $results = $db->query($query);
     if (empty($results)) {
         return array();
     }
     $fieldDefs = $this->fieldDefs;
     $return = array();
     while ($row = $db->fetchByAssoc($results)) {
         if (!ACLField::hasAccess($row['field_name'], $bean->module_dir, $GLOBALS['current_user']->id, $bean->isOwner($GLOBALS['current_user']->id))) {
             continue;
         }
         //convert date
         $dateCreated = $timedate->fromDbType($db->fromConvert($row['date_created'], 'datetime'), "datetime");
         $row['date_created'] = $timedate->asIso($dateCreated);
         //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') {
             $return[] = $this->handleTeamSetField($row);
             continue;
         }
         // look for opportunities to relate ids to name values.
         if (!empty($this->genericAssocFieldsArray[$row['field_name']]) || !empty($this->moduleAssocFieldsArray[$bean->object_name][$row['field_name']])) {
             foreach ($fieldDefs as $field) {
                 if (in_array($field['name'], array('before_value_string', 'after_value_string'))) {
                     $row[$field['name']] = $this->getAssociatedFieldName($row['field_name'], $row[$field['name']]);
                 }
             }
         }
         $row = $this->formatRowForApi($row);
         $fieldName = $row['field_name'];
         $fieldType = $db->getFieldType($bean->field_defs[$row['field_name']]);
         switch ($fieldType) {
             case 'date':
             case 'time':
             case 'datetime':
                 $row['before'] = $this->formatDateTime($row['before'], $fieldType);
                 $row['after'] = $this->formatDateTime($row['after'], $fieldType);
                 break;
             case 'enum':
             case 'multienum':
                 $row['before'] = explode(',', str_replace('^', '', $row['before']));
                 $row['after'] = explode(',', str_replace('^', '', $row['after']));
                 break;
             case 'relate':
             case 'link':
                 // get the other side
                 if (isset($bean->field_defs[$fieldName]['module'])) {
                     $module = $bean->field_defs[$fieldName]['module'];
                     $otherSideBeanBefore = BeanFactory::getBean($module, $row['before']);
                     $otherSideBeanAfter = BeanFactory::getBean($module, $row['after']);
                     if ($otherSideBeanBefore instanceof SugarBean) {
                         $row['before'] = $otherSideBeanBefore->get_summary_text();
                     }
                     if ($otherSideBeanAfter instanceof SugarBean) {
                         $row['after'] = $otherSideBeanAfter->get_summary_text();
                     }
                 }
                 break;
         }
         $return[] = $row;
     }
     return $return;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:75,代码来源:Audit.php


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