/** * Run the page. * * This method is called after the page is created. */ public function run() { // get the emails for this contact $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name')); $entityBlock = array('contact_id' => $contactId); $emails = CRM_Core_BAO_Email::getValues($entityBlock); if (!empty($emails)) { foreach ($emails as $key => &$value) { $value['location_type'] = $locationTypes[$value['location_type_id']]; } } $contact = new CRM_Contact_BAO_Contact(); $contact->id = $contactId; $contact->find(TRUE); $privacy = array(); foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) { if (isset($contact->{$name})) { $privacy[$name] = $contact->{$name}; } } $this->assign('contactId', $contactId); $this->assign('email', $emails); $this->assign('privacy', $privacy); // check logged in user permission CRM_Contact_Page_View::checkUserPermission($this, $contactId); // finally call parent parent::run(); }
/** * simple helper function to dispatch getCall to lower comm blocks */ function getBlocks(&$params, &$values, &$ids, $blockCount = 0, &$parent) { $parent->address =& CRM_Core_BAO_Address::getValues($params, $values, $ids, $blockCount); $parent->phone =& CRM_Core_BAO_Phone::getValues($params, $values, $ids, $blockCount); $parent->email =& CRM_Core_BAO_Email::getValues($params, $values, $ids, $blockCount); $parent->im =& CRM_Core_BAO_IM::getValues($params, $values, $ids, $blockCount); }