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


PHP CRM_Contact_BAO_Contact::getDisplayAndImage方法代码示例

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


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

示例1: run

 /**
  * Run the page.
  *
  * This method is called after the page is created.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // get the callback, module and activity id
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $dao = new CRM_Core_DAO_ActivityHistory();
     $dao->activity_id = $id;
     $dao->activity_type = ts('SMS Sent');
     if ($dao->find(TRUE)) {
         $cid = $dao->entity_id;
     }
     $dao = new CRM_SMS_DAO_History();
     $dao->id = $id;
     if ($dao->find(TRUE)) {
         $this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name'));
         $this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'));
         $this->assign('sentDate', $dao->sent_date);
         $this->assign('message', $dao->message);
         // get the display name and images for the contact
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
         CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
         // also add the cid params to the Menu array
         CRM_Core_Menu::addParam('cid', $cid);
     }
     return parent::run();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:35,代码来源:SMS.php

示例2: run

 /**
  * Run the page.
  *
  * This method is called after the page is created.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // get the callback, module and activity id
     $action = CRM_Utils_Request::retrieve('action', $this, false, 'browse');
     $id = CRM_Utils_Request::retrieve('id', $this);
     $dao =& new CRM_Core_DAO_ActivityHistory();
     $dao->activity_id = $id;
     $dao->activity_type = ts('SMS Sent');
     if ($dao->find(true)) {
         $cid = $dao->entity_id;
     }
     require_once 'CRM/SMS/DAO/History.php';
     $dao =& new CRM_SMS_DAO_History();
     $dao->id = $id;
     if ($dao->find(true)) {
         $this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name'));
         $this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'));
         $this->assign('sentDate', $dao->sent_date);
         $this->assign('message', $dao->message);
         // get the display name and images for the contact
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
         CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
         require_once 'CRM/Utils/Menu.php';
         // also add the cid params to the Menu array
         CRM_Utils_Menu::addParam('cid', $cid);
         // create menus ..
         $startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view');
         $startWeight++;
         require_once 'CRM/Core/BAO/CustomGroup.php';
         CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight);
     }
     parent::run();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:42,代码来源:SMS.php

示例3: preProcess

 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     // reset action from the session
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'update');
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
     $rcid = CRM_Utils_Request::retrieve('rcid', 'Positive', $this);
     $rcid = $rcid ? "&id={$rcid}" : '';
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/user', "reset=1{$rcid}"));
     if ($this->_contactId) {
         $contact = new CRM_Contact_DAO_Contact();
         $contact->id = $this->_contactId;
         if (!$contact->find(TRUE)) {
             CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
         }
         $this->_contactType = $contact->contact_type;
         // check for permissions
         if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
             CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
         }
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
         CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
     } else {
         CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:29,代码来源:RelatedContact.php

示例4: preProcess

 /**
  * Heart of the viewing process.
  *
  * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
  */
 public function preProcess()
 {
     if (!$this->_contactId) {
         CRM_Core_Error::fatal(ts('You must be logged in to view this page.'));
     }
     list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
     $this->set('displayName', $displayName);
     $this->set('contactImage', $contactImage);
     CRM_Utils_System::setTitle(ts('Dashboard - %1', array(1 => $displayName)));
     $this->assign('recentlyViewed', FALSE);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:16,代码来源:UserDashBoard.php

示例5: preProcess

 function preProcess()
 {
     if (!$this->_contactId) {
         CRM_Core_Error::fatal(ts('You must be logged in to view this page.'));
     }
     list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
     $this->set('displayName', $displayName);
     $this->set('contactImage', $contactImage);
     CRM_Utils_System::setTitle(ts('Dashboard - %1', array(1 => $displayName)));
     $this->assign('recentlyViewed', FALSE);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/pcp/dashboard', 'reset=1'));
 }
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:13,代码来源:Dashboard.php

示例6: CRM_Core_DAO_Log

 /**
  * @param $id
  * @param string $table
  *
  * @return array|null
  */
 static function &lastModified($id, $table = 'civicrm_contact')
 {
     $log = new CRM_Core_DAO_Log();
     $log->entity_table = $table;
     $log->entity_id = $id;
     $log->orderBy('modified_date desc');
     $log->limit(1);
     $result = CRM_Core_DAO::$_nullObject;
     if ($log->find(TRUE)) {
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($log->modified_id);
         $result = array('id' => $log->modified_id, 'name' => $displayName, 'image' => $contactImage, 'date' => $log->modified_date);
     }
     return $result;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:20,代码来源:Log.php

示例7: browse

 /**
  * This function is called when action is browse
  * 
  * return null
  * @access public
  */
 function browse()
 {
     require_once 'CRM/Core/DAO/Log.php';
     $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:ksecor,项目名称:civicrm,代码行数:22,代码来源:Log.php

示例8: run

 /**
  * Run the page.
  *
  * This method is called after the page is created.
  *
  * @return void
  * @access public
  *
  */
 function run()
 {
     // get the callback, module and activity id
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $dao = new CRM_Core_DAO_ActivityHistory();
     $dao->activity_id = $id;
     $dao->activity_type = ts('Email Sent');
     if ($dao->find(TRUE)) {
         $cid = $dao->entity_id;
     }
     $dao = new CRM_Core_DAO_EmailHistory();
     $dao->id = $id;
     if ($dao->find(TRUE)) {
         // get the display name and email for the contact
         list($toContactName, $toContactEmail, $toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($cid);
         if (!trim($toContactName)) {
             $toContactName = $toContactEmail;
         }
         if (trim($toContactEmail)) {
             $toContactName = "\"{$toContactName}\" <{$toContactEmail}>";
         }
         $this->assign('toName', $toContactName);
         // get the display name and email for the contact
         list($fromContactName, $fromContactEmail, $toDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($dao->contact_id);
         if (!trim($fromContactEmail)) {
             CRM_Core_Error::statusBounce(ts('Your user record does not have a valid email address'));
         }
         if (!trim($fromContactName)) {
             $fromContactName = $fromContactEmail;
         }
         $this->assign('fromName', "\"{$fromContactName}\" <{$fromContactEmail}>");
         $this->assign('sentDate', $dao->sent_date);
         $this->assign('subject', $dao->subject);
         $this->assign('message', $dao->message);
         // get the display name and images for the contact
         list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
         CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
         // also add the cid params to the Menu array
         CRM_Core_Menu::addParam('cid', $cid);
     }
     return parent::run();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:52,代码来源:Email.php

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

示例10: preProcess

 function preProcess()
 {
     $params = array();
     $defaults = array();
     $ids = array();
     $session =& CRM_Core_Session::singleton();
     $uid = $session->get('userID');
     if (!$uid) {
         require_once 'CRM/Utils/System.php';
         CRM_Utils_System::setUFMessage(ts('We could not find a user id. You must be logged in to access the CiviCRM Home Page and menus.'));
         CRM_Core_Error::statusBounce(ts('We could not find a user id. You must be logged in to access the CiviCRM Home Page and menus.'));
     }
     $this->assign('contactId', $uid);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'view');
     $this->assign('action', $this->_action);
     // a user can always view their own activity history
     // if they have access CiviCRM permission
     $this->_permission = CRM_Core_Permission::VIEW;
     // make the permission edit if the user has edit permission on the contact
     require_once 'CRM/Contact/BAO/Contact/Permission.php';
     if (CRM_Contact_BAO_Contact_Permission::allow($uid, CRM_Core_Permission::EDIT)) {
         $this->_permission = CRM_Core_Permission::EDIT;
     }
     $displayName = $this->get('displayName');
     list($displayName, $contactImage, $contactType) = CRM_Contact_BAO_Contact::getDisplayAndImage($uid, true);
     $this->set('displayName', $displayName);
     $this->set('contactImage', $contactImage);
     CRM_Utils_System::setTitle($contactImage . ' ' . $displayName, $displayName);
     CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $uid), $uid, $contactType, $uid, $displayName);
     // call hook to get html from other modules
     require_once 'CRM/Utils/Hook.php';
     $contentPlacement = CRM_Utils_Hook::DASHBOARD_BELOW;
     // ignored but needed to prevent warnings
     $html = CRM_Utils_Hook::dashboard($uid, $contentPlacement);
     if (is_array($html)) {
         $this->assign_by_ref('hookContent', $html);
         $this->assign('hookContentPlacement', $contentPlacement);
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:39,代码来源:DashBoard.php

示例11: preProcess

 /**
  * Pre processing work done here.
  *
  * Gets session variables for table name, id of entity in table, type of entity and stores them.
  */
 public function preProcess()
 {
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
     $this->assign('cdType', FALSE);
     $this->_multiRecordDisplay = CRM_Utils_Request::retrieve('multiRecordDisplay', 'String', $this);
     if ($this->_cdType || $this->_multiRecordDisplay == 'single') {
         if ($this->_cdType) {
             $this->assign('cdType', TRUE);
         }
         // NOTE : group id is not stored in session from within CRM_Custom_Form_CustomData::preProcess func
         // this is due to some condition inside it which restricts it from saving in session
         // so doing this for multi record edit action
         $entityId = CRM_Utils_Request::retrieve('entityID', 'Positive', $this);
         if (!empty($entityId)) {
             $subType = CRM_Contact_BAO_Contact::getContactSubType($entityId, ',');
         }
         CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, NULL, NULL, $entityId);
         if ($this->_multiRecordDisplay) {
             $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this);
             $this->_tableID = $this->_entityId;
             $this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
             $mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
             $hasReachedMax = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($this->_groupID, $this->_tableID);
             if ($hasReachedMax && $mode == 'add') {
                 CRM_Core_Error::statusBounce(ts('The maximum record limit is reached'));
             }
             $this->_copyValueId = CRM_Utils_Request::retrieve('copyValueId', 'Positive', $this);
             $groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_groupID);
             $mode = CRM_Utils_Request::retrieve('mode', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET');
             $mode = ucfirst($mode);
             CRM_Utils_System::setTitle(ts('%1 %2 Record', array(1 => $mode, 2 => $groupTitle)));
             if (!empty($_POST['hidden_custom'])) {
                 $this->assign('postedInfo', TRUE);
             }
         }
         return;
     }
     $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE);
     $this->_tableID = CRM_Utils_Request::retrieve('tableId', 'Positive', $this, TRUE);
     $this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
     $this->_contactSubType = CRM_Contact_BAO_Contact::getContactSubType($this->_tableID, ',');
     $this->assign('contact_type', $this->_contactType);
     $this->assign('contact_subtype', $this->_contactSubType);
     list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID);
     CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
     // when custom data is included in this page
     if (!empty($_POST['hidden_custom'])) {
         for ($i = 1; $i <= $_POST['hidden_custom_group_count'][$this->_groupID]; $i++) {
             CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_contactSubType, $i, $this->_contactType, $this->_tableID);
             CRM_Custom_Form_CustomData::buildQuickForm($this);
             CRM_Custom_Form_CustomData::setDefaultValues($this);
         }
     }
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:59,代码来源:CustomData.php

示例12: fixFormValues

 function fixFormValues()
 {
     // if this search has been forced
     // then see if there are any get values, and if so over-ride the post values
     // note that this means that GET over-rides POST :)
     // we fix date_to here if set to be the end of the day, i.e. 23:59:59
     if (!CRM_Utils_System::isNull($this->_formValues['contribution_date_to'])) {
         $this->_formValues['contribution_date_to']['H'] = 23;
         $this->_formValues['contribution_date_to']['i'] = 59;
         $this->_formValues['contribution_date_to']['s'] = 59;
     }
     if (!$this->_force) {
         return;
     }
     $nullObject = null;
     $status = CRM_Utils_Request::retrieve('status', $nullObject);
     if ($status) {
         switch ($status) {
             case 'Valid':
             case 'Cancelled':
             case 'All':
                 $this->_formValues['contribution_status'] = $status;
                 $this->_defaults['contribution_status'] = $status;
                 break;
         }
     }
     $cid = CRM_Utils_Request::retrieve('cid', $nullObject);
     if ($cid) {
         $cid = CRM_Utils_Type::escape($cid, 'Integer');
         if ($cid > 0) {
             $this->_formValues['contact_id'] = $cid;
             list($display, $image) = CRM_Contact_BAO_Contact::getDisplayAndImage($cid);
             $this->_defaults['sort_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'sort_name');
             // also assign individual mode to the template
             $this->_single = true;
         }
     }
     $fromDate = CRM_Utils_Request::retrieve('start', $nullObject);
     if ($fromDate) {
         $fromDate = CRM_Utils_Type::escape($fromDate, 'Timestamp');
         $date = CRM_Utils_Date::unformat($fromDate, '');
         $this->_formValues['contribution_date_from'] = $date;
         $this->_defaults['contribution_date_from'] = $date;
     }
     $toDate = CRM_Utils_Request::retrieve('end', $nullObject);
     if ($toDate) {
         $toDate = CRM_Utils_Type::escape($toDate, 'Timestamp');
         $date = CRM_Utils_Date::unformat($toDate, '');
         $this->_formValues['contribution_date_to'] = $date;
         $this->_defaults['contribution_date_to'] = $date;
         $this->_formValues['contribution_date_to']['H'] = 23;
         $this->_formValues['contribution_date_to']['i'] = 59;
         $this->_formValues['contribution_date_to']['s'] = 59;
     }
     $this->_limit = CRM_Utils_Request::retrieve('limit', $this);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:56,代码来源:Search.php

示例13: buildQuickForm

 static function buildQuickForm(&$form)
 {
     if ($form->_context == 'caseActivity') {
         return;
     }
     if ($form->_context == 'standalone') {
         CRM_Contact_Form_NewContact::buildQuickForm($form);
     }
     $caseType = array('' => '-select-') + CRM_Case_PseudoConstant::caseType();
     $element = $form->add('select', 'case_type_id', ts('Case Type'), $caseType, TRUE, array('onchange' => "CRM.buildCustomData( 'Case', this.value );"));
     if ($form->_caseTypeId) {
         $element->freeze();
     }
     $caseStatus = CRM_Case_PseudoConstant::caseStatus();
     $form->add('select', 'status_id', ts('Case Status'), $caseStatus, TRUE);
     $form->add('text', 'duration', ts('Duration'), array('size' => 4, 'maxlength' => 8));
     $form->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger');
     if ($form->_currentlyViewedContactId) {
         list($displayName) = CRM_Contact_BAO_Contact::getDisplayAndImage($form->_currentlyViewedContactId);
         $form->assign('clientName', $displayName);
     }
     $form->addDate('start_date', ts('Case Start Date'), TRUE, array('formatType' => 'activityDateTime'));
     $form->add('select', 'medium_id', ts('Medium'), CRM_Case_PseudoConstant::encounterMedium(), TRUE);
     // calling this field activity_location to prevent conflict with contact location fields
     $form->add('text', 'activity_location', ts('Location'), CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location'));
     $form->addWysiwyg('activity_details', ts('Details'), array('rows' => 4, 'cols' => 60), FALSE);
     $form->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'upload', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:hguru,项目名称:224Civi,代码行数:28,代码来源:OpenCase.php

示例14: synchronize

 /**
  * Given a UF user object, make sure there is a contact
  * object for this user. If the user has new values, we need
  * to update the CRM DB with the new values
  *
  * @param Object $user
  *   The drupal user object.
  * @param bool $update
  *   Has the user object been edited.
  * @param $uf
  *
  * @param $ctype
  * @param bool $isLogin
  */
 public static function synchronize(&$user, $update, $uf, $ctype, $isLogin = FALSE)
 {
     $userSystem = CRM_Core_Config::singleton()->userSystem;
     $session = CRM_Core_Session::singleton();
     if (!is_object($session)) {
         CRM_Core_Error::fatal('wow, session is not an object?');
         return;
     }
     $userSystemID = $userSystem->getBestUFID($user);
     $uniqId = $userSystem->getBestUFUniqueIdentifier($user);
     // if the id of the object is zero (true for anon users in drupal)
     // have we already processed this user, if so early
     // return.
     $userID = $session->get('userID');
     $ufID = $session->get('ufID');
     if (!$update && $ufID == $userSystemID) {
         return;
     }
     //check do we have logged in user.
     $isUserLoggedIn = CRM_Utils_System::isUserLoggedIn();
     // reset the session if we are a different user
     if ($ufID && $ufID != $userSystemID) {
         $session->reset();
         //get logged in user ids, and set to session.
         if ($isUserLoggedIn) {
             $userIds = self::getUFValues();
             $session->set('ufID', CRM_Utils_Array::value('uf_id', $userIds, ''));
             $session->set('userID', CRM_Utils_Array::value('contact_id', $userIds, ''));
             $session->set('ufUniqID', CRM_Utils_Array::value('uf_name', $userIds, ''));
         }
     }
     // return early
     if ($userSystemID == 0) {
         return;
     }
     $ufmatch = self::synchronizeUFMatch($user, $userSystemID, $uniqId, $uf, NULL, $ctype, $isLogin);
     if (!$ufmatch) {
         return;
     }
     //make sure we have session w/ consistent ids.
     $ufID = $ufmatch->uf_id;
     $userID = $ufmatch->contact_id;
     $ufUniqID = '';
     if ($isUserLoggedIn) {
         $loggedInUserUfID = CRM_Utils_System::getLoggedInUfID();
         //are we processing logged in user.
         if ($loggedInUserUfID && $loggedInUserUfID != $ufID) {
             $userIds = self::getUFValues($loggedInUserUfID);
             $ufID = CRM_Utils_Array::value('uf_id', $userIds, '');
             $userID = CRM_Utils_Array::value('contact_id', $userIds, '');
             $ufUniqID = CRM_Utils_Array::value('uf_name', $userIds, '');
         }
     }
     //set user ids to session.
     $session->set('ufID', $ufID);
     $session->set('userID', $userID);
     $session->set('ufUniqID', $ufUniqID);
     // add current contact to recently viewed
     if ($ufmatch->contact_id) {
         list($displayName, $contactImage, $contactType, $contactSubtype, $contactImageUrl) = CRM_Contact_BAO_Contact::getDisplayAndImage($ufmatch->contact_id, TRUE, TRUE);
         $otherRecent = array('imageUrl' => $contactImageUrl, 'subtype' => $contactSubtype, 'editUrl' => CRM_Utils_System::url('civicrm/contact/add', "reset=1&action=update&cid={$ufmatch->contact_id}"));
         CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$ufmatch->contact_id}"), $ufmatch->contact_id, $contactType, $ufmatch->contact_id, $displayName, $otherRecent);
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:78,代码来源:UFMatch.php

示例15: preProcess

 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'add');
     $this->_dedupeButtonName = $this->getButtonName('refresh', 'dedupe');
     $this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
     $session =& CRM_Core_Session::singleton();
     if ($this->_action == CRM_Core_Action::ADD) {
         // check for add contacts permissions
         require_once 'CRM/Core/Permission.php';
         if (!CRM_Core_Permission::check('add contacts')) {
             CRM_Utils_System::permissionDenied();
             return;
         }
         $this->_contactType = CRM_Utils_Request::retrieve('ct', 'String', $this, true, null, 'REQUEST');
         if (!in_array($this->_contactType, array('Individual', 'Household', 'Organization'))) {
             CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
         }
         $this->_contactSubType = CRM_Utils_Request::retrieve('cst', 'String', $this);
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Integer', CRM_Core_DAO::$_nullObject, false, null, 'GET');
         $this->_tid = CRM_Utils_Request::retrieve('tid', 'Integer', CRM_Core_DAO::$_nullObject, false, null, 'GET');
         if ($this->_contactSubType) {
             CRM_Utils_System::setTitle(ts('New %1', array(1 => $this->_contactSubType)));
         } else {
             $title = ts('New Individual');
             if ($this->_contactType == 'Household') {
                 $title = ts('New Household');
             } else {
                 if ($this->_contactType == 'Organization') {
                     $title = ts('New Organization');
                 }
             }
             CRM_Utils_System::setTitle($title);
         }
         $session->pushUserContext(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
         $this->_contactId = null;
     } else {
         //update mode
         if (!$this->_contactId) {
             $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true);
         }
         if ($this->_contactId) {
             require_once 'CRM/Contact/BAO/Contact.php';
             $contact =& new CRM_Contact_DAO_Contact();
             $contact->id = $this->_contactId;
             if (!$contact->find(true)) {
                 CRM_Core_Error::statusBounce(ts('contact does not exist: %1', array(1 => $this->_contactId)));
             }
             $this->_contactType = $contact->contact_type;
             $this->_contactSubType = $contact->contact_sub_type;
             // check for permissions
             require_once 'CRM/Contact/BAO/Contact/Permission.php';
             if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
                 CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
             }
             list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
             CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
             $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId));
             $values = $this->get('values');
             // get contact values.
             if (!empty($values)) {
                 $this->_values = $values;
             } else {
                 $params = array('id' => $this->_contactId, 'contact_id' => $this->_contactId);
                 $contact = CRM_Contact_BAO_Contact::retrieve($params, $this->_values, true);
                 $this->set('values', $this->_values);
             }
         } else {
             CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
         }
     }
     $this->_editOptions = $this->get('contactEditOptions');
     if (CRM_Utils_System::isNull($this->_editOptions)) {
         require_once 'CRM/Core/BAO/Preferences.php';
         $this->_editOptions = CRM_Core_BAO_Preferences::valueOptions('contact_edit_options', true, null, false, 'name', true, 'AND v.filter = 0');
         $this->set('contactEditOptions', $this->_editOptions);
     }
     // build demographics only for Individual contact type
     if ($this->_contactType != 'Individual' && array_key_exists('Demographics', $this->_editOptions)) {
         unset($this->_editOptions['Demographics']);
     }
     // in update mode don't show notes
     if ($this->_contactId && array_key_exists('Notes', $this->_editOptions)) {
         unset($this->_editOptions['Notes']);
     }
     $this->assign('editOptions', $this->_editOptions);
     $this->assign('contactType', $this->_contactType);
     $this->assign('contactSubType', $this->_contactSubType);
     // get the location blocks.
     $this->_blocks = $this->get('blocks');
     if (CRM_Utils_System::isNull($this->_blocks)) {
         $this->_blocks = CRM_Core_BAO_Preferences::valueOptions('contact_edit_options', true, null, false, 'name', true, 'AND v.filter = 1');
         $this->set('blocks', $this->_blocks);
     }
     $this->assign('blocks', $this->_blocks);
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Contact.php


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