예제 #1
0
 /**
  * @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);
 }
예제 #2
0
 public function buildQuickForm()
 {
     $this->applyFilter('__ALL__', 'trim');
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype=";
     $url = CRM_Utils_System::url('civicrm/contact/view/activity', $urlParams, false, null, false);
     $activityType = CRM_Core_PseudoConstant::activityType(false);
     $this->assign('emailSetting', false);
     require_once 'CRM/Utils/Mail.php';
     if (CRM_Utils_Mail::validOutBoundMail() && $contactId) {
         $this->assign('emailSetting', true);
         require_once 'CRM/Contact/BAO/Contact.php';
         list($name, $email, $doNotEmail, $onHold, $isDeseased) = CRM_Contact_BAO_Contact::getContactDetails($contactId);
         if (!$doNotEmail && $email && !$isDeseased) {
             $activityType += array('3' => ts('Send an Email'));
         }
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('select', 'other_activity', ts('Other Activities'), array('' => ts('- new activity -')) + $activityType, false, array('onchange' => "if (this.value) window.location='{$url}'+ this.value; else return false"));
     $this->assign('suppressForm', true);
 }
예제 #3
0
 public function buildQuickForm()
 {
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $urlParams = "action=add&reset=1&cid={$contactId}&selectedChild=activity&atype=";
     $url = CRM_Utils_System::url('civicrm/contact/view/activity', $urlParams, false, null, false);
     $activityTypes = array();
     require_once 'CRM/Utils/Mail.php';
     if (CRM_Utils_Mail::validOutBoundMail() && $contactId) {
         require_once 'CRM/Contact/BAO/Contact.php';
         list($name, $email, $doNotEmail, $onHold, $isDeseased) = CRM_Contact_BAO_Contact::getContactDetails($contactId);
         if (!$doNotEmail && $email && !$isDeseased) {
             $activityTypes = array('3' => ts('Send an Email'));
         }
     }
     // this returns activity types sorted by weight
     $otherTypes = CRM_Core_PseudoConstant::activityType(false);
     $activityTypes += $otherTypes;
     $this->assign('activityTypes', $activityTypes);
     $this->assign('url', $url);
     $this->assign('suppressForm', true);
 }
예제 #4
0
 /**
  * These tasks are the core set of tasks that the user can perform
  * on a contact / group of contacts
  *
  * @return array
  *   the set of tasks for a group of contacts
  */
 public static function &taskTitles()
 {
     self::initTasks();
     $titles = array();
     foreach (self::$_tasks as $id => $value) {
         $titles[$id] = $value['title'];
     }
     // hack unset update saved search
     unset($titles[self::SAVE_SEARCH_UPDATE]);
     if (!CRM_Utils_Mail::validOutBoundMail()) {
         unset($titles[self::EMAIL_CONTACTS]);
         unset($titles[self::CREATE_MAILING]);
     }
     // CRM-6806
     if (!CRM_Core_Permission::check('access deleted contacts') || !CRM_Core_Permission::check('delete contacts')) {
         unset($titles[self::DELETE_PERMANENTLY]);
     }
     asort($titles);
     return $titles;
 }
예제 #5
0
파일: Task.php 프로젝트: bhirsch/civicrm
 /**
  * These tasks are the core set of tasks that the user can perform
  * on a contact / group of contacts
  *
  * @return array the set of tasks for a group of contacts
  * @static
  * @access public
  */
 static function &taskTitles()
 {
     self::initTasks();
     $titles = array();
     foreach (self::$_tasks as $id => $value) {
         $titles[$id] = $value['title'];
     }
     // hack unset update saved search and print contacts
     unset($titles[14]);
     unset($titles[15]);
     $config =& CRM_Core_Config::singleton();
     require_once 'CRM/Utils/Mail.php';
     if (!CRM_Utils_Mail::validOutBoundMail()) {
         unset($titles[6]);
         unset($titles[20]);
     }
     if (!in_array('CiviSMS', $config->enableComponents)) {
         unset($titles[7]);
     }
     return $titles;
 }
예제 #6
0
 /**
  * These tasks are the core set of tasks that the user can perform
  * on a contact / group of contacts
  *
  * @return array the set of tasks for a group of contacts
  * @static
  * @access public
  */
 static function &taskTitles()
 {
     self::initTasks();
     $titles = array();
     foreach (self::$_tasks as $id => $value) {
         $titles[$id] = $value['title'];
     }
     // hack unset update saved search and print contacts
     unset($titles[14]);
     unset($titles[15]);
     $config = CRM_Core_Config::singleton();
     require_once 'CRM/Utils/Mail.php';
     if (!CRM_Utils_Mail::validOutBoundMail()) {
         unset($titles[6]);
         unset($titles[20]);
     }
     if (!in_array('CiviSMS', $config->enableComponents)) {
         unset($titles[7]);
     }
     // CRM-6806
     if (!CRM_Core_Permission::check('access deleted contacts') || !CRM_Core_Permission::check('delete contacts')) {
         unset($titles[self::DELETE_PERMANENTLY]);
     }
     asort($titles);
     return $titles;
 }