/** * 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(); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', $this, false); if ($cid) { // not sure why this is needed :( // 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++; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight); $this->_contactIds = array($cid); $this->_single = true; $smsNumbers = CRM_Contact_BAO_Contact::allPhones($cid, 'Mobile'); $this->_emails = array(); $toName = CRM_Contact_BAO_Contact::displayName($cid); foreach ($smsNumbers as $number => $item) { $this->_smsNumbers[$number] = '"' . $toName . '" <' . $number . '> ' . $item['locationType']; if ($item['is_primary']) { $this->_smsNumbers[$number] .= ' ' . ts('(preferred)'); } $this->_smsNumbers[$number] = htmlspecialchars($this->_emails[$email]); } } else { parent::preProcess(); } $this->assign('single', $this->_single); }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { $cid = CRM_Utils_Request::retrieve('cid', $this, false); if ($cid) { // not sure why this is needed :( // 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++; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight); $this->_contactIds = array($cid); $this->_single = true; $this->assign('totalSelectedContacts', 1); } else { parent::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. * * @return void * @access public * */ function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', $this); $this->assign('id', $this->_id); $this->_contactId = CRM_Utils_Request::retrieve('cid', $this, true); if (!$this->_contactId) { CRM_Utils_System::statusBounce(ts('We could not find a contact id.')); } $this->assign('contactId', $this->_contactId); $this->_action = CRM_Utils_Request::retrieve('action', $this, false, 'browse'); $this->assign('action', $this->_action); // check for permissions $this->_permission = null; if (CRM_Contact_BAO_Contact::permissionedContact($this->_contactId, CRM_CORE_PERMISSION_EDIT)) { $this->assign('permission', 'edit'); $this->_permission = CRM_CORE_PERMISSION_EDIT; } else { if (CRM_Contact_BAO_Contact::permissionedContact($this->_contactId, CRM_CORE_PERMISSION_VIEW)) { $this->assign('permission', 'view'); $this->_permission = CRM_CORE_PERMISSION_VIEW; } else { CRM_Utils_System::statusBounce(ts('You do not have the necessary permission to view this contact.')); } } $this->getContactDetails(); $contactImage = $this->get('contactImage'); $displayName = $this->get('displayName'); $this->assign('displayName', $displayName); CRM_Utils_System::setTitle($contactImage . ' ' . $displayName); CRM_Utils_Recent::add($displayName, CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId), $contactImage, $this->_contactId); // also add the cid params to the Menu array CRM_Utils_Menu::addParam('cid', $this->_contactId); $this->assign('viewForm', $form); $this->assign('showBlocks1', $showBlocks); $this->assign('hideBlocks1', $hideBlocks); $this->assign('groupTree', $_groupTree); //------------ // create menus .. $startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view'); $startWeight++; CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($this->_contactId), 'civicrm/contact/view/cd', $startWeight); //display OtherActivity link $otherAct = CRM_Core_PseudoConstant::activityType(false); $activityNum = count($otherAct); $this->assign('showOtherActivityLink', $activityNum); }
/** * 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('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_Utils_System::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); 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(); }