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


PHP CRM_Core_BAO_Log::add方法代码示例

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


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

示例1: logActivityAction

 /**
  * Create an activity.
  *
  * @todo elaborate on what this does.
  *
  * @param CRM_Core_DAO_Activity $activity
  * @param string $logMessage
  *
  * @return bool
  */
 public static function logActivityAction($activity, $logMessage = NULL)
 {
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
         $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
         $id = self::getActivityContact($activity->id, $sourceID);
     }
     $logParams = array('entity_table' => 'civicrm_activity', 'entity_id' => $activity->id, 'modified_id' => $id, 'modified_date' => date('YmdHis'), 'data' => $logMessage);
     CRM_Core_BAO_Log::add($logParams);
     return TRUE;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:23,代码来源:Activity.php

示例2: create

 /**
  * Takes an associative array and creates a participant object.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return CRM_Event_BAO_Participant
  */
 public static function create(&$params)
 {
     $transaction = new CRM_Core_Transaction();
     $status = NULL;
     if (!empty($params['id'])) {
         $status = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $params['id'], 'status_id');
     }
     $participant = self::add($params);
     if (is_a($participant, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $participant;
     }
     if (!CRM_Utils_Array::value('id', $params) || isset($params['status_id']) && $params['status_id'] != $status) {
         CRM_Activity_BAO_Activity::addActivity($participant);
     }
     //CRM-5403
     //for update mode
     if (self::isPrimaryParticipant($participant->id) && $status) {
         self::updateParticipantStatus($participant->id, $status, $participant->status_id);
     }
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = CRM_Utils_Array::value('contact_id', $params);
     }
     // add custom field values
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_participant', $participant->id);
     }
     //process note, CRM-7634
     $noteId = NULL;
     if (!empty($params['id'])) {
         $note = CRM_Core_BAO_Note::getNote($params['id'], 'civicrm_participant');
         $noteId = key($note);
     }
     $noteValue = NULL;
     $hasNoteField = FALSE;
     foreach (array('note', 'participant_note') as $noteFld) {
         if (array_key_exists($noteFld, $params)) {
             $noteValue = $params[$noteFld];
             $hasNoteField = TRUE;
             break;
         }
     }
     if ($noteId || $noteValue) {
         if ($noteValue) {
             $noteParams = array('entity_table' => 'civicrm_participant', 'note' => $noteValue, 'entity_id' => $participant->id, 'contact_id' => $id, 'modified_date' => date('Ymd'));
             $noteIDs = array();
             if ($noteId) {
                 $noteIDs['id'] = $noteId;
             }
             CRM_Core_BAO_Note::add($noteParams, $noteIDs);
         } elseif ($noteId && $hasNoteField) {
             CRM_Core_BAO_Note::del($noteId, FALSE);
         }
     }
     // Log the information on successful add/edit of Participant data.
     $logParams = array('entity_table' => 'civicrm_participant', 'entity_id' => $participant->id, 'data' => CRM_Event_PseudoConstant::participantStatus($participant->status_id), 'modified_id' => $id, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     $params['participant_id'] = $participant->id;
     $transaction->commit();
     // do not add to recent items for import, CRM-4399
     if (empty($params['skipRecentView'])) {
         $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         $recentOther = array();
         if (CRM_Core_Permission::check('edit event participants')) {
             $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=update&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         if (CRM_Core_Permission::check('delete in CiviEvent')) {
             $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=delete&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         $participantRoles = CRM_Event_PseudoConstant::participantRole();
         if ($participant->role_id) {
             $role = explode(CRM_Core_DAO::VALUE_SEPARATOR, $participant->role_id);
             foreach ($role as &$roleValue) {
                 if (isset($roleValue)) {
                     $roleValue = $participantRoles[$roleValue];
                 }
             }
             $roles = implode(', ', $role);
         }
         $roleString = empty($roles) ? '' : $roles;
         $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $participant->event_id, 'title');
         $title = CRM_Contact_BAO_Contact::displayName($participant->contact_id) . ' (' . $roleString . ' - ' . $eventTitle . ')';
         // add the recently created Participant
         CRM_Utils_Recent::add($title, $url, $participant->id, 'Participant', $participant->contact_id, NULL, $recentOther);
     }
     return $participant;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:97,代码来源:Participant.php

示例3: create

 /**
  * function to create the event
  *
  * @param array $params reference array contains the values submitted by the form
  *
  * @return object
  * @access public
  * @static
  *
  */
 public static function create(&$params)
 {
     $transaction = new CRM_Core_Transaction();
     if (empty($params['is_template'])) {
         $params['is_template'] = 0;
     }
     // check if new event, if so set the created_id (if not set)
     // and always set created_date to now
     if (empty($params['id'])) {
         if (empty($params['created_id'])) {
             $session = CRM_Core_Session::singleton();
             $params['created_id'] = $session->get('userID');
         }
         $params['created_date'] = date('YmdHis');
     }
     $event = self::add($params);
     CRM_Price_BAO_PriceSet::setPriceSets($params, $event, 'event');
     if (is_a($event, 'CRM_Core_Error')) {
         CRM_Core_DAO::transaction('ROLLBACK');
         return $event;
     }
     $session = CRM_Core_Session::singleton();
     $contactId = $session->get('userID');
     if (!$contactId) {
         $contactId = CRM_Utils_Array::value('contact_id', $params);
     }
     // Log the information on successful add/edit of Event
     $logParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id, 'modified_id' => $contactId, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id);
     }
     $transaction->commit();
     return $event;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:45,代码来源:Event.php

示例4: create

 /**
  * function to create the event
  *
  * @param array $params reference array contains the values submitted by the form
  * 
  * @access public
  * @static 
  * 
  */
 public static function create(&$params)
 {
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $event = self::add($params);
     if (is_a($event, 'CRM_Core_Error')) {
         CRM_Core_DAO::transaction('ROLLBACK');
         return $event;
     }
     $session =& CRM_Core_Session::singleton();
     $contactId = $session->get('userID');
     if (!$contactId) {
         $contactId = CRM_Utils_Array::value('contact_id', $params);
     }
     // Log the information on successful add/edit of Event
     require_once 'CRM/Core/BAO/Log.php';
     $logParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id, 'modified_id' => $contactId, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) {
         require_once 'CRM/Core/BAO/CustomValueTable.php';
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_event', $event->id);
     }
     $transaction->commit();
     return $event;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:34,代码来源:Event.php

示例5: CRM_Core_Transaction

 /**
  * takes an associative array and creates a participant object
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Event_BAO_Participant object 
  * @access public
  * @static
  */
 static function &create(&$params)
 {
     require_once 'CRM/Utils/Date.php';
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $status = null;
     if (CRM_Utils_Array::value('id', $params)) {
         $status = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $params['id'], 'status_id');
     }
     $participant =& self::add($params);
     if (is_a($participant, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $participant;
     }
     if (!CRM_Utils_Array::value('id', $params) || $params['status_id'] != $status) {
         require_once 'CRM/Activity/BAO/Activity.php';
         CRM_Activity_BAO_Activity::addActivity($participant);
     }
     //CRM-5403
     //for update mode
     if (self::isPrimaryParticipant($participant->id) && $status) {
         self::updateParticipantStatus($participant->id, $status, $participant->status_id);
     }
     $session =& CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = $params['contact_id'];
     }
     // add custom field values
     if (CRM_Utils_Array::value('custom', $params) && is_array($params['custom'])) {
         require_once 'CRM/Core/BAO/CustomValueTable.php';
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_participant', $participant->id);
     }
     if (CRM_Utils_Array::value('note', $params) || CRM_Utils_Array::value('participant_note', $params)) {
         if (CRM_Utils_Array::value('note', $params)) {
             $note = CRM_Utils_Array::value('note', $params);
         } else {
             $note = CRM_Utils_Array::value('participant_note', $params);
         }
         $noteDetails = CRM_Core_BAO_Note::getNote($participant->id, 'civicrm_participant');
         $noteIDs = array();
         if (!empty($noteDetails)) {
             $noteIDs['id'] = array_pop(array_flip($noteDetails));
         }
         if ($note) {
             require_once 'CRM/Core/BAO/Note.php';
             $noteParams = array('entity_table' => 'civicrm_participant', 'note' => $note, 'entity_id' => $participant->id, 'contact_id' => $id, 'modified_date' => date('Ymd'));
             CRM_Core_BAO_Note::add($noteParams, $noteIDs);
         }
     }
     // Log the information on successful add/edit of Participant data.
     require_once 'CRM/Core/BAO/Log.php';
     $logParams = array('entity_table' => 'civicrm_participant', 'entity_id' => $participant->id, 'data' => CRM_Event_PseudoConstant::participantStatus($participant->status_id), 'modified_id' => $id, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     $params['participant_id'] = $participant->id;
     $transaction->commit();
     // do not add to recent items for import, CRM-4399
     if (!CRM_Utils_Array::value('skipRecentView', $params)) {
         require_once 'CRM/Utils/Recent.php';
         require_once 'CRM/Event/PseudoConstant.php';
         require_once 'CRM/Contact/BAO/Contact.php';
         $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         $recentOther = array();
         if (CRM_Core_Permission::check('edit event participants')) {
             $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=update&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         if (CRM_Core_Permission::check('delete in CiviEvent')) {
             $recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/participant', "action=delete&reset=1&id={$participant->id}&cid={$participant->contact_id}&context=home");
         }
         $participantRoles = CRM_Event_PseudoConstant::participantRole();
         if ($participant->role_id) {
             $role = explode(CRM_Core_DAO::VALUE_SEPARATOR, $participant->role_id);
             foreach ($role as $roleKey => $roleValue) {
                 if (isset($roles)) {
                     $roles .= ", " . $participantRoles[$roleValue];
                 } else {
                     $roles = $participantRoles[$roleValue];
                 }
             }
         }
         $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $participant->event_id, 'title');
         $title = CRM_Contact_BAO_Contact::displayName($participant->contact_id) . ' (' . $roles . ' - ' . $eventTitle . ')';
         // add the recently created Participant
         CRM_Utils_Recent::add($title, $url, $participant->id, 'Participant', $participant->contact_id, null, $recentOther);
     }
     return $participant;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:97,代码来源:Participant.php

示例6: logVersion

 function logVersion($version = null)
 {
     if (!$version) {
         $version = CRM_Core_BAO_Domain::version();
     }
     if ($version) {
         require_once 'CRM/Core/BAO/Log.php';
         $session =& CRM_Core_Session::singleton();
         $logParams = array('entity_table' => 'civicrm_domain', 'entity_id' => 1, 'data' => "version,{$version}", 'modified_date' => date('YmdHis'));
         CRM_Core_BAO_Log::add($logParams);
         return true;
     }
     return false;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:14,代码来源:Form.php

示例7: create

 /**
  * Create the event.
  *
  * @param array $params
  *   Reference array contains the values submitted by the form.
  * @param array $ids
  *   Reference array contains the id.
  *
  * @return object
  */
 public static function create(&$params, &$ids)
 {
     $transaction = new CRM_Core_Transaction();
     $grant = self::add($params, $ids);
     if (is_a($grant, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $grant;
     }
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = CRM_Utils_Array::value('contact_id', $params);
     }
     if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note', $ids))) {
         $noteParams = array('entity_table' => 'civicrm_grant', 'note' => $params['note'] = $params['note'] ? $params['note'] : "null", 'entity_id' => $grant->id, 'contact_id' => $id, 'modified_date' => date('Ymd'));
         CRM_Core_BAO_Note::add($noteParams, (array) CRM_Utils_Array::value('note', $ids));
     }
     // Log the information on successful add/edit of Grant
     $logParams = array('entity_table' => 'civicrm_grant', 'entity_id' => $grant->id, 'modified_id' => $id, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     // add custom field values
     if (!empty($params['custom']) && is_array($params['custom'])) {
         CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_grant', $grant->id);
     }
     // check and attach and files as needed
     CRM_Core_BAO_File::processAttachment($params, 'civicrm_grant', $grant->id);
     $transaction->commit();
     return $grant;
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:39,代码来源:Grant.php

示例8: logActivityAction

 public function logActivityAction($activity, $logMessage = null)
 {
     $session =& CRM_Core_Session::singleton();
     $id = $session->get('userID');
     require_once 'CRM/Core/BAO/Log.php';
     $logParams = array('entity_table' => 'civicrm_activity', 'entity_id' => $activity->id, 'modified_id' => $id, 'modified_date' => date('YmdHis'), 'data' => $logMessage);
     CRM_Core_BAO_Log::add($logParams);
     return true;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:9,代码来源:Activity.php

示例9: CRM_Core_Transaction

 /**
  * takes an associative array and creates a case object
  *
  * @param array $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Case_BAO_Case object 
  * @access public
  * @static
  */
 static function &create(&$params)
 {
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $case = self::add($params);
     if (is_a($case, 'CRM_Core_Error')) {
         $transaction->rollback();
         return $case;
     }
     $session =& CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = $params['contact_id'];
     }
     // Log the information on successful add/edit of Case
     require_once 'CRM/Core/BAO/Log.php';
     $logParams = array('entity_table' => 'civicrm_case', 'entity_id' => $case->id, 'modified_id' => $id, 'modified_date' => date('Ymd'));
     CRM_Core_BAO_Log::add($logParams);
     $transaction->commit();
     return $case;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:31,代码来源:Case.php

示例10: logVersion

 /**
  * @param $newVersion
  *
  * @return bool
  */
 public function logVersion($newVersion)
 {
     if ($newVersion) {
         $oldVersion = CRM_Core_BAO_Domain::version();
         $session = CRM_Core_Session::singleton();
         $logParams = array('entity_table' => 'civicrm_domain', 'entity_id' => 1, 'data' => "upgrade:{$oldVersion}->{$newVersion}", 'modified_date' => date('YmdHis'));
         CRM_Core_BAO_Log::add($logParams);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:16,代码来源:Form.php

示例11: logActivityAction

 public static function logActivityAction($activity, $logMessage = NULL)
 {
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = $activity->source_contact_id;
     }
     $logParams = array('entity_table' => 'civicrm_activity', 'entity_id' => $activity->id, 'modified_id' => $id, 'modified_date' => date('YmdHis'), 'data' => $logMessage);
     CRM_Core_BAO_Log::add($logParams);
     return TRUE;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:11,代码来源:Activity.php


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