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


PHP CRM_Contact_BAO_Contact_Location::getPhoneDetails方法代码示例

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


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

示例1: commonBuildQuickForm

 /**
  * @param $self
  */
 public static function commonBuildQuickForm($self)
 {
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $self);
     if (!$contactId) {
         $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
     }
     $urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype=";
     $activityTypes = $urls = array();
     $emailTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Email', 'name');
     $letterTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Print PDF Letter', 'name');
     $SMSId = CRM_Core_OptionGroup::getValue('activity_type', 'Text Message (SMS)', 'label');
     if (CRM_Utils_Mail::validOutBoundMail() && $contactId) {
         list($name, $email, $doNotEmail, $onHold, $isDeseased) = CRM_Contact_BAO_Contact::getContactDetails($contactId);
         if (!$doNotEmail && $email && !$isDeseased) {
             $activityTypes = array($emailTypeId => ts('Send an Email'));
         }
     }
     if ($contactId && CRM_SMS_BAO_Provider::activeProviderCount()) {
         // Check for existence of a mobile phone and ! do not SMS privacy setting
         $mobileTypeID = CRM_Core_OptionGroup::getValue('phone_type', 'Mobile', 'name');
         list($name, $phone, $doNotSMS) = CRM_Contact_BAO_Contact_Location::getPhoneDetails($contactId, $mobileTypeID);
         if (!$doNotSMS && $phone) {
             $sendSMS = array($SMSId => ts('Send SMS'));
             $activityTypes += $sendSMS;
         }
     }
     // this returns activity types sorted by weight
     $otherTypes = CRM_Core_PseudoConstant::activityType(FALSE);
     $activityTypes += $otherTypes;
     foreach (array_keys($activityTypes) as $typeId) {
         if ($typeId == $emailTypeId) {
             $urls[$typeId] = CRM_Utils_System::url('civicrm/activity/email/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
         } elseif ($typeId == $SMSId) {
             $urls[$typeId] = CRM_Utils_System::url('civicrm/activity/sms/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
         } elseif ($typeId == $letterTypeId) {
             $urls[$typeId] = CRM_Utils_System::url('civicrm/activity/pdf/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
         } else {
             $urls[$typeId] = CRM_Utils_System::url('civicrm/activity/add', "{$urlParams}{$typeId}", FALSE, NULL, FALSE);
         }
     }
     $self->assign('activityTypes', $activityTypes);
     $self->assign('urls', $urls);
     $self->assign('suppressForm', TRUE);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:47,代码来源:ActivityLinks.php

示例2: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 public function buildQuickForm()
 {
     if (!$this->_single) {
         $toArray = array();
         foreach ($this->_contactIds as $contactId) {
             list($toDisplayName, $toSMS) = CRM_Contact_BAO_Contact_Location::getPhoneDetails($contactId, 'Mobile');
             if (!empty($toSMS)) {
                 $toArray[] = "\"{$toDisplayName}\" <{$toSMS}>";
             }
         }
         $this->assign('to', implode(', ', $toArray));
     } else {
         $to =& $this->add('select', 'to', ts('To'), $this->_smsNumbers, true);
         if (count($this->_smsNumbers) <= 1) {
             foreach ($this->_smsNumbers as $number => $dontCare) {
                 $defaults = array('to' => $number);
                 $this->setDefaults($defaults);
             }
             $to->freeze();
         }
     }
     $session =& CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     list($fromDisplayName, $fromSMS) = CRM_Contact_BAO_Contact_Location::getPhoneDetails($userID, 'Mobile');
     if (!$fromSMS) {
         CRM_Core_Error::statusBounce(ts('Your user record does not have a valid SMS number'));
     }
     $from = '"' . $fromDisplayName . '"' . "<{$fromSMS}>";
     $this->assign('from', $from);
     $this->add('textarea', 'message', ts('Message'), CRM_Core_DAO::getAttribute('CRM_SMS_DAO_History', 'message'), true);
     if ($this->_single) {
         // also fix the user context stack
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/activity', '&show=1&action=browse&cid=' . $this->_contactIds[0]));
         $this->addDefaultButtons(ts('Send SMS'), 'next', 'cancel');
     } else {
         $this->addDefaultButtons(ts('Send SMS'));
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:44,代码来源:SMS.php

示例3: sendMessage

 /**
  * send the message to a specific contact
  *
  * @param string $from       the name and sms of the sender
  * @param int    $toID       the contact id of the recipient       
  * @param string $message    the message contents
  * @param string $smsNumber  use this 'number' instead of the default primary sms number
  * @param int    $activityID the activity ID that tracks the message
  *
  * @return array             (total, added, notAdded) count of emails sent
  * @access public
  * @static
  */
 static function sendMessage($from, $toID, &$message, $smsNumber, $activityID)
 {
     list($toDisplayName, $toSMS) = CRM_Contact_BAO_Contact_Location::getPhoneDetails($toID, 'Mobile');
     if ($toSMS) {
         $to = trim($toSMS);
     }
     // make sure sms number is non-empty
     if (empty($to)) {
         return false;
     }
     $params = array();
     $params['From'] = $from;
     $params['To'] = $to;
     $params['Body'] = $message;
     $params['id'] = substr(md5(uniqid(rand(), true)), 0, 31);
     $params['Type'] = "SMS_TEXT";
     $aggregator =& CRM_SMS_Protocol::singleton();
     if (!$aggregator->sendMessage($params)) {
         return false;
     }
     // we need to insert an activity history record here
     $params = array('entity_table' => 'civicrm_contact', 'entity_id' => $toID, 'activity_type' => ts('SMS Sent'), 'module' => 'CiviCRM', 'callback' => 'CRM_SMS_BAO_History::details', 'activity_id' => $activityID, 'activity_summary' => ts('To: %1; Message: %2', array(1 => "{$toDisplayName} <{$toSMS}>", 2 => $message)), 'activity_date' => date('YmdHis'));
     if (is_a(crm_create_activity_history($params), CRM_Core_Error)) {
         return false;
     }
     return true;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:40,代码来源:History.php


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