Exemplo n.º 1
0
 /**
  * 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;
         $emails = CRM_Contact_BAO_Contact::allEmails($cid);
         $this->_emails = array();
         $toName = CRM_Contact_BAO_Contact::displayName($cid);
         foreach ($emails as $email => $item) {
             if (!$email && count($emails) <= 1) {
                 $this->_emails[$email] = '"' . $toName . '"';
                 $this->_noEmails = true;
             } else {
                 if ($email) {
                     $this->_emails[$email] = '"' . $toName . '" <' . $email . '> ' . $item['locationType'];
                 }
             }
             if ($item['is_primary']) {
                 $this->_emails[$email] .= ' ' . ts('(preferred)');
             }
             $this->_emails[$email] = htmlspecialchars($this->_emails[$email]);
         }
     } else {
         parent::preProcess();
     }
     $this->assign('single', $this->_single);
 }