• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_BAO_Log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: browse

 /**
  * This function is called when action is browse
  *
  * return null
  * @access public
  */
 function browse()
 {
     $loggingReport = CRM_Core_BAO_Log::useLoggingReport();
     $this->assign('useLogging', $loggingReport);
     if ($loggingReport) {
         $this->assign('instanceUrl', CRM_Utils_System::url("civicrm/report/instance/{$loggingReport}", "reset=1&force=1&snippet=4&section=2&altered_contact_id_op=eq&altered_contact_id_value={$this->_contactId}&cid={$this->_contactId}", FALSE, NULL, FALSE));
         return;
     }
     $log = new CRM_Core_DAO_Log();
     $log->entity_table = 'civicrm_contact';
     $log->entity_id = $this->_contactId;
     $log->orderBy('modified_date desc');
     $log->find();
     $logEntries = array();
     while ($log->fetch()) {
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id);
         $logEntries[] = array('id' => $log->modified_id, 'name' => $displayName, 'image' => $contactImage, 'date' => $log->modified_date);
     }
     $this->assign('logCount', count($logEntries));
     $this->assign_by_ref('log', $logEntries);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:27,代码来源:Log.php


示例2: updateContactEmail

 /**
  * Update the email value for the contact and user profile.
  *
  * @param int $contactId
  *   Contact ID of the user.
  * @param string $emailAddress
  *   Email to be modified for the user.
  */
 public static function updateContactEmail($contactId, $emailAddress)
 {
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $emailAddress = $strtolower($emailAddress);
     $ufmatch = new CRM_Core_DAO_UFMatch();
     $ufmatch->contact_id = $contactId;
     $ufmatch->domain_id = CRM_Core_Config::domainID();
     if ($ufmatch->find(TRUE)) {
         // Save the email in UF Match table
         $ufmatch->uf_name = $emailAddress;
         CRM_Core_BAO_UFMatch::create((array) $ufmatch);
         //check if the primary email for the contact exists
         //$contactDetails[1] - email
         //$contactDetails[3] - email id
         $contactDetails = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactId);
         if (trim($contactDetails[1])) {
             $emailID = $contactDetails[3];
             //update if record is found
             $query = "UPDATE  civicrm_email\n                     SET email = %1\n                     WHERE id =  %2";
             $p = array(1 => array($emailAddress, 'String'), 2 => array($emailID, 'Integer'));
             $dao = CRM_Core_DAO::executeQuery($query, $p);
         } else {
             //else insert a new email record
             $email = new CRM_Core_DAO_Email();
             $email->contact_id = $contactId;
             $email->is_primary = 1;
             $email->email = $emailAddress;
             $email->save();
             $emailID = $email->id;
         }
         CRM_Core_BAO_Log::register($contactId, 'civicrm_email', $emailID);
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:41,代码来源:UFMatch.php


示例3: 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


示例4: 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


示例5: response

 /**
  * Common function for all inline contact edit forms
  * Prepares ajaxResponse
  *
  * @return void
  * @protected
  */
 protected function response()
 {
     // Load changelog footer from template
     $smarty = CRM_Core_Smarty::singleton();
     $smarty->assign('contactId', $this->_contactId);
     $smarty->assign('external_identifier', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'external_identifier'));
     $smarty->assign('lastModified', CRM_Core_BAO_Log::lastModified($this->_contactId, 'civicrm_contact'));
     $viewOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options', TRUE);
     $smarty->assign('changeLog', $viewOptions['log']);
     $this->ajaxResponse = array_merge(array('changeLog' => array('count' => CRM_Contact_BAO_Contact::getCountComponent('log', $this->_contactId), 'markup' => $smarty->fetch('CRM/common/contactFooter.tpl'))), $this->ajaxResponse, CRM_Contact_Form_Inline_Lock::getResponse($this->_contactId));
     // Note: Post hooks will be called by CRM_Core_Form::mainProcess
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:19,代码来源:Inline.php


示例6: postProcess

 /**
  * process the form
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // need to process / save address
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     // process shared contact address.
     CRM_Contact_BAO_Contact_Utils::processSharedAddress($params['address']);
     if ($this->_parseStreetAddress) {
         CRM_Contact_Form_Contact::parseAddress($params);
     }
     if ($this->_addressId > 0) {
         $params['address'][$this->_locBlockNo]['id'] = $this->_addressId;
     }
     // save address changes
     $address = CRM_Core_BAO_Address::create($params, TRUE);
     // make entry in log table
     CRM_Core_BAO_Log::register($this->_contactId, 'civicrm_contact', $this->_contactId);
     $response = array('status' => 'save', 'addressId' => $address[0]->id);
     $this->postProcessHook();
     echo json_encode($response);
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:29,代码来源:Address.php


示例7: add

 /**
  * takes an associative array and creates a contact object
  *
  * the function extract all the params it needs to initialize the create a
  * contact object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params (reference ) an assoc array of name/value pairs
  *
  * @return object CRM_Contact_BAO_Contact object
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $contact =& new CRM_Contact_DAO_Contact();
     if (empty($params)) {
         return;
     }
     //fixed contact source
     if (isset($params['contact_source'])) {
         $params['source'] = $params['contact_source'];
     }
     //fix for preferred communication method
     $prefComm = CRM_Utils_Array::value('preferred_communication_method', $params);
     if ($prefComm && is_array($prefComm)) {
         unset($params['preferred_communication_method']);
         $newPref = array();
         foreach ($prefComm as $k => $v) {
             if ($v) {
                 $newPref[$k] = $v;
             }
         }
         $prefComm = $newPref;
         if (is_array($prefComm) && !empty($prefComm)) {
             $prefComm = CRM_Core_BAO_CustomOption::VALUE_SEPERATOR . implode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, array_keys($prefComm)) . CRM_Core_BAO_CustomOption::VALUE_SEPERATOR;
             $contact->preferred_communication_method = $prefComm;
         } else {
             $contact->preferred_communication_method = '';
         }
     }
     $allNull = $contact->copyValues($params);
     $contact->id = CRM_Utils_Array::value('contact_id', $params);
     if ($contact->contact_type == 'Individual') {
         $allNull = false;
         //format individual fields
         require_once "CRM/Contact/BAO/Individual.php";
         CRM_Contact_BAO_Individual::format($params, $contact);
     } else {
         if ($contact->contact_type == 'Household') {
             if (isset($params['household_name'])) {
                 $allNull = false;
                 $contact->display_name = $contact->sort_name = CRM_Utils_Array::value('household_name', $params, '');
             }
         } else {
             if ($contact->contact_type == 'Organization') {
                 if (isset($params['organization_name'])) {
                     $allNull = false;
                     $contact->display_name = $contact->sort_name = CRM_Utils_Array::value('organization_name', $params, '');
                 }
             }
         }
     }
     // privacy block
     $privacy = CRM_Utils_Array::value('privacy', $params);
     if ($privacy && is_array($privacy) && !empty($privacy)) {
         $allNull = false;
         foreach (self::$_commPrefs as $name) {
             $contact->{$name} = CRM_Utils_Array::value($name, $privacy, false);
         }
     }
     // since hash was required, make sure we have a 0 value for it, CRM-1063
     // fixed in 1.5 by making hash optional
     // only do this in create mode, not update
     if ((!array_key_exists('hash', $contact) || !$contact->hash) && !$contact->id) {
         $allNull = false;
         $contact->hash = md5(uniqid(rand(), true));
     }
     if (!$allNull) {
         $contact->save();
         require_once 'CRM/Core/BAO/Log.php';
         CRM_Core_BAO_Log::register($contact->id, 'civicrm_contact', $contact->id);
     }
     if ($contact->contact_type == 'Individual' && array_key_exists('current_employer', $params)) {
         // create current employer
         if ($params['current_employer']) {
             require_once 'CRM/Contact/BAO/Contact/Utils.php';
             CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship($contact->id, $params['current_employer']);
         } else {
             //unset if employer id exits
             if ($employerId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contact->id, 'employer_id')) {
                 require_once 'CRM/Contact/BAO/Contact/Utils.php';
                 CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($contact->id, $employerId);
             }
         }
     }
     //update cached employee name
     if ($contact->contact_type == 'Organization') {
         require_once 'CRM/Contact/BAO/Contact/Utils.php';
         CRM_Contact_BAO_Contact_Utils::updateCurrentEmployer($contact->id);
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Contact.php


示例8: 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


示例9: add

 /**
  * Takes an associative array and creates a note object.
  *
  * the function extract all the params it needs to initialize the create a
  * note object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array $params
  *   (reference) an assoc array of name/value pairs.
  * @param array $ids
  *   (deprecated) associated array with note id - preferably set $params['id'].
  *
  * @return object
  *   $note CRM_Core_BAO_Note object
  */
 public static function add(&$params, $ids = array())
 {
     $dataExists = self::dataExists($params);
     if (!$dataExists) {
         return CRM_Core_DAO::$_nullObject;
     }
     $note = new CRM_Core_BAO_Note();
     if (!isset($params['modified_date'])) {
         $params['modified_date'] = date("Ymd");
     }
     if (!isset($params['privacy'])) {
         $params['privacy'] = 0;
     }
     $note->copyValues($params);
     if (empty($params['contact_id'])) {
         if ($params['entity_table'] == 'civicrm_contact') {
             $note->contact_id = $params['entity_id'];
         }
     }
     $id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
     if ($id) {
         $note->id = $id;
     }
     $note->save();
     // check and attach and files as needed
     CRM_Core_BAO_File::processAttachment($params, 'civicrm_note', $note->id);
     if ($note->entity_table == 'civicrm_contact') {
         CRM_Core_BAO_Log::register($note->entity_id, 'civicrm_note', $note->id);
         $displayName = CRM_Contact_BAO_Contact::displayName($note->entity_id);
         $noteActions = FALSE;
         $session = CRM_Core_Session::singleton();
         if ($session->get('userID')) {
             if ($session->get('userID') == $note->entity_id) {
                 $noteActions = TRUE;
             } elseif (CRM_Contact_BAO_Contact_Permission::allow($note->entity_id, CRM_Core_Permission::EDIT)) {
                 $noteActions = TRUE;
             }
         }
         $recentOther = array();
         if ($noteActions) {
             $recentOther = array('editUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=update&cid={$note->entity_id}&id={$note->id}&context=home"), 'deleteUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=delete&cid={$note->entity_id}&id={$note->id}&context=home"));
         }
         // add the recently created Note
         CRM_Utils_Recent::add($displayName . ' - ' . $note->subject, CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=view&cid={$note->entity_id}&id={$note->id}&context=home"), $note->id, 'Note', $note->entity_id, $displayName, $recentOther);
     }
     return $note;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:62,代码来源:Note.php


示例10: response

 /**
  * Final response from successful form submit
  *
  * @param response: array - data to send to the client
  *
  * @return void
  * @protected
  */
 protected function response($response = array())
 {
     // Load changelog footer from template
     $smarty = CRM_Core_Smarty::singleton();
     $smarty->assign('contactId', $this->_contactId);
     $smarty->assign('external_identifier', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'external_identifier'));
     $smarty->assign('lastModified', CRM_Core_BAO_Log::lastModified($this->_contactId, 'civicrm_contact'));
     $viewOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options', TRUE);
     $smarty->assign('changeLog', $viewOptions['log']);
     $response = array_merge(array('status' => 'save', 'changeLog' => array('count' => CRM_Contact_BAO_Contact::getCountComponent('log', $this->_contactId), 'markup' => $smarty->fetch('CRM/common/contactFooter.tpl'))), $response, CRM_Contact_Form_Inline_Lock::getResponse($this->_contactId));
     $this->postProcessHook();
     // CRM-11831 @see http://www.malsup.com/jquery/form/#file-upload
     $xhr = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
     if (!$xhr) {
         echo '<textarea>';
     }
     echo json_encode($response);
     if (!$xhr) {
         echo '</textarea>';
     }
     CRM_Utils_System::civiExit();
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:30,代码来源:Inline.php


示例11: postProcess

 /**
  * process the form
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     // need to process / save emails
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
     // save email changes
     CRM_Core_BAO_Block::create('email', $params);
     // make entry in log table
     CRM_Core_BAO_Log::register($this->_contactId, 'civicrm_contact', $this->_contactId);
     $response = array('status' => 'save');
     $this->postProcessHook();
     echo json_encode($response);
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:21,代码来源:Email.php


示例12: 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


示例13: CRM_Core_BAO_Note

 /**
  * takes an associative array and creates a note object
  *
  * the function extract all the params it needs to initialize the create a
  * note object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object CRM_Core_BAO_Note object
  * @access public
  * @static
  */
 static function &add(&$params, $ids)
 {
     $dataExists = self::dataExists($params);
     if (!$dataExists) {
         return CRM_Core_DAO::$_nullObject;
     }
     $note =& new CRM_Core_BAO_Note();
     $params['modified_date'] = date("Ymd");
     $note->copyValues($params);
     if (!$params['contact_id']) {
         if ($params['entity_table'] == 'civicrm_contact') {
             $note->contact_id = $params['entity_id'];
         } else {
             CRM_Core_Error::statusBounce(ts('We could not find your logged in user ID'));
         }
     }
     if (CRM_Utils_Array::value('id', $ids)) {
         $note->id = CRM_Utils_Array::value('id', $ids);
     }
     $note->save();
     if ($note->entity_table == 'civicrm_contact') {
         require_once 'CRM/Core/BAO/Log.php';
         CRM_Core_BAO_Log::register($note->entity_id, 'civicrm_note', $note->id);
         require_once 'CRM/Contact/BAO/Contact.php';
         $displayName = CRM_Contact_BAO_Contact::displayName($note->entity_id);
         // add the recently created Note
         require_once 'CRM/Utils/Recent.php';
         CRM_Utils_Recent::add($displayName . ' - ' . $note->subject, CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=view&cid={$note->entity_id}&id={$note->id}&context=home"), $note->id, 'Note', $note->entity_id, $displayName);
     }
     return $note;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:44,代码来源:Note.php


示例14: CRM_Core_BAO_Note

 /**
  * takes an associative array and creates a note object
  *
  * the function extract all the params it needs to initialize the create a
  * note object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object CRM_Core_BAO_Note object
  * @access public
  * @static
  */
 static function &add(&$params, $ids)
 {
     $dataExists = self::dataExists($params);
     if (!$dataExists) {
         return CRM_Core_DAO::$_nullObject;
     }
     $note = new CRM_Core_BAO_Note();
     if (!isset($params['modified_date'])) {
         $params['modified_date'] = date("Ymd");
     }
     if (!isset($params['privacy'])) {
         $params['privacy'] = 0;
     }
     $note->copyValues($params);
     if (!$params['contact_id']) {
         if ($params['entity_table'] == 'civicrm_contact') {
             $note->contact_id = $params['entity_id'];
         } else {
             CRM_Core_Error::statusBounce(ts('We could not find your logged in user ID'));
         }
     }
     if (CRM_Utils_Array::value('id', $ids)) {
         $note->id = CRM_Utils_Array::value('id', $ids);
     }
     $note->save();
     if ($note->entity_table == 'civicrm_contact') {
         require_once 'CRM/Core/BAO/Log.php';
         CRM_Core_BAO_Log::register($note->entity_id, 'civicrm_note', $note->id);
         require_once 'CRM/Contact/BAO/Contact.php';
         $displayName = CRM_Contact_BAO_Contact::displayName($note->entity_id);
         $noteActions = false;
         $session = CRM_Core_Session::singleton();
         if ($session->get('userID')) {
             require_once 'CRM/Contact/BAO/Contact/Permission.php';
             if ($session->get('userID') == $note->entity_id) {
                 $noteActions = true;
             } else {
                 if (CRM_Contact_BAO_Contact_Permission::allow($note->entity_id, CRM_Core_Permission::EDIT)) {
                     $noteActions = true;
                 }
             }
         }
         $recentOther = array();
         if ($noteActions) {
             $recentOther = array('editUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=update&cid={$note->entity_id}&id={$note->id}&context=home"), 'deleteUrl' => CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=delete&cid={$note->entity_id}&id={$note->id}&context=home"));
         }
         // add the recently created Note
         require_once 'CRM/Utils/Recent.php';
         CRM_Utils_Recent::add($displayName . ' - ' . $note->subject, CRM_Utils_System::url('civicrm/contact/view/note', "reset=1&action=view&cid={$note->entity_id}&id={$note->id}&context=home"), $note->id, 'Note', $note->entity_id, $displayName, $recentOther);
     }
     return $note;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:65,代码来源:Note.php


示例15: postProcess

 /**
  * Process the user submitted custom data values.
  */
 public function postProcess()
 {
     // Get the form values and groupTree
     //CRM-18183
     $params = $this->controller->exportValues($this->_name);
     CRM_Core_BAO_CustomValueTable::postProcess($params, 'civicrm_contact', $this->_tableID, $this->_entityType);
     $table = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_groupID, 'table_name');
     $cgcount = CRM_Core_BAO_CustomGroup::customGroupDataExistsForEntity($this->_tableID, $table, TRUE);
     $cgcount += 1;
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->getButtonName('upload', 'new')) {
         CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/view/cd/edit', "reset=1&type={$this->_contactType}&groupID={$this->_groupID}&entityID={$this->_tableID}&cgcount={$cgcount}&multiRecordDisplay=single&mode=add"));
     }
     // Add entry in the log table
     CRM_Core_BAO_Log::register($this->_tableID, 'civicrm_contact', $this->_tableID);
     if (CRM_Core_Resources::isAjaxMode()) {
         $this->ajaxResponse += CRM_Contact_Form_Inline::renderFooter($this->_tableID);
     }
     // reset the group contact cache for this group
     CRM_Contact_BAO_GroupContactCache::remove();
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:24,代码来源:CustomData.php


示例16: 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


示例17: 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


示例18: 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


示例19: getCountComponent

 /**
  * Given the component name and returns the count of participation of contact.
  *
  * @param string $component
  *   Input component name.
  * @param int $contactId
  *   Input contact id.
  * @param string $tableName
  *   Optional tableName if component is custom group.
  *
  * @return int
  *   total number in database
  */
 public static function getCountComponent($component, $contactId, $tableName = NULL)
 {
     $object = NULL;
     switch ($component) {
         case 'tag':
             return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE);
         case 'rel':
             $result = CRM_Contact_BAO_Relationship::getRelationship($contactId, CRM_Contact_BAO_Relationship::CURRENT, 0, 1);
             return $result;
         case 'group':
             return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, "Added", NULL, TRUE);
         case 'log':
             if (CRM_Core_BAO_Log::useLoggingReport()) {
                 return FALSE;
             }
             return CRM_Core_BAO_Log::getContactLogCount($contactId);
         case 'note':
             return CRM_Core_BAO_Note::getContactNoteCount($contactId);
         case 'contribution':
             return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
         case 'membership':
             return CRM_Member_BAO_Membership::getContactMembershipCount($contactId, TRUE);
         case 'participant':
             return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
         case 'pledge':
             return CRM_Pledge_BAO_Pledge::getContactPledgeCount($contactId);
         case 'case':
             return CRM_Case_BAO_Case::caseCount($contactId);
         case 'grant':
             return CRM_Grant_BAO_Grant::getContactGrantCount($contactId);
         case 'activity':
             $input = array('contact_id' => $contactId, 'admin' => FALSE, 'caseId' => NULL, 'context' => 'activity');
             return CRM_Activity_BAO_Activity::getActivitiesCount($input);
         case 'mailing':
             $params = array('contact_id' => $contactId);
             return CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
         default:
             $custom = explode('_', $component);
             if ($custom['0'] = 'custom') {
                 if (!$tableName) {
                     $tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $custom['1'], 'table_name');
                 }
                 $queryString = "SELECT count(id) FROM {$tableName} WHERE entity_id = {$contactId}";
                 return CRM_Core_DAO::singleValueQuery($queryString);
             }
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:60,代码来源:Contact.php


示例20: create


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_BAO_MailSettings类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_BAO_LocationType类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap