Пример #1
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 &tasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(1 => array('title' => ts('Print Mailing Recipients'), 'class' => 'CRM_Mailing_Form_Task_Print', 'result' => FALSE));
         CRM_Utils_Hook::searchTasks('mailing', self::$_tasks);
         asort(self::$_tasks);
     }
     return self::$_tasks;
 }
Пример #2
0
 static function preProcessCommon(&$form, $useTable = FALSE)
 {
     $values = $form->controller->exportValues($form->get('searchFormName'));
     $form->_task = CRM_Utils_Array::value('task', $values);
     $mailingTasks = CRM_Mailing_Task::tasks();
     $form->assign('taskName', CRM_Utils_Array::value('task', $values));
     // ids are mailing event queue ids
     $ids = array();
     if ($values['radio_ts'] == 'ts_sel') {
         foreach ($values as $name => $value) {
             if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
                 $ids[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
             }
         }
     } else {
         $queryParams = $form->get('queryParams');
         $sortOrder = null;
         if ($form->get(CRM_Utils_Sort::SORT_ORDER)) {
             $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
         }
         $query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_MAILING);
         $result = $query->searchQuery(0, 0, $sortOrder);
         while ($result->fetch()) {
             $ids[] = $result->mailing_recipients_id;
         }
         $form->assign('totalSelectedMailingRecipients', $form->get('rowCount'));
     }
     if (!empty($ids)) {
         $form->_componentClause = ' civicrm_mailing_recipients.id IN ( ' . implode(',', $ids) . ' ) ';
     }
     //set the context for redirection for any task actions
     $session = CRM_Core_Session::singleton();
     $fragment = 'search';
     if ($form->_action == CRM_Core_Action::ADVANCED) {
         $fragment .= '/advanced';
     }
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
     $session = CRM_Core_Session::singleton();
     $session->replaceUserContext($url);
 }