Esempio n. 1
0
 /**
  * Create or update an action log entry.
  *
  * @param array $params
  *
  * @return array
  */
 public static function create($params)
 {
     $actionLog = new CRM_Core_DAO_ActionLog();
     $params['action_date_time'] = CRM_Utils_Array::value('action_date_time', $params, date('YmdHis'));
     $actionLog->copyValues($params);
     $edit = $actionLog->id ? TRUE : FALSE;
     if ($edit) {
         CRM_Utils_Hook::pre('edit', 'ActionLog', $actionLog->id, $actionLog);
     } else {
         CRM_Utils_Hook::pre('create', 'ActionLog', NULL, $actionLog);
     }
     $actionLog->save();
     if ($edit) {
         CRM_Utils_Hook::post('edit', 'ActionLog', $actionLog->id, $actionLog);
     } else {
         CRM_Utils_Hook::post('create', 'ActionLog', NULL, $actionLog);
     }
     return $actionLog;
 }
Esempio n. 2
0
 /**
  * Returns the list of fields that can be exported
  *
  * @param bool $prefix
  *
  * @return array
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     self::$_export['action_log'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }