示例#1
0
文件: Task.php 项目: bhirsch/voipdev
 /**
  * build all the data structures needed to build the form
  *
  * @param
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_contributionIds = array();
     $values = $this->controller->exportValues('Search');
     $this->_task = $values['task'];
     $contributeTasks = CRM_Contribute_Task::tasks();
     $this->assign('taskName', $contributeTasks[$this->_task]);
     $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 = $this->get('queryParams');
         $query =& new CRM_Contact_BAO_Query($queryParams, null, null, false, false, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
         $result = $query->searchQuery(0, 0, null);
         while ($result->fetch()) {
             $ids[] = $result->contribution_id;
         }
         $this->assign('totalSelectedContributions', $this->get('rowCount'));
     }
     if (!empty($ids)) {
         $this->_componentClause = ' civicrm_contribution.id IN ( ' . implode(',', $ids) . ' ) ';
         $this->assign('totalSelectedContributions', count($ids));
     }
     $this->_contributionIds = $this->_componentIds = $ids;
     //set the context for redirection for any task actions
     $session =& CRM_Core_Session::singleton();
     $session->replaceUserContext(CRM_Utils_System::url('civicrm/contribute/search', 'force=1'));
 }
示例#2
0
 /**
  * build all the data structures needed to build the form
  *
  * @param
  * @return void
  * @access public
  */
 function preProcess()
 {
     $this->_contributionIds = array();
     $values = $this->controller->exportValues('Search');
     $this->_task = $values['task'];
     $contributeTasks = CRM_Contribute_Task::tasks();
     $this->assign('taskName', $contributeTasks[$this->_task]);
     $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);
             }
         }
         if (!empty($ids)) {
             $this->_contributionClause = ' civicrm_contribution.id IN ( ' . implode(',', $ids) . ' ) ';
             $this->assign('totalSelectedContributions', count($ids));
         }
     } else {
         $fv = $this->get('formValues');
         $query =& new CRM_Contact_BAO_Query($fv, null, null, false, false, CRM_CONTACT_BAO_QUERY_MODE_CONTRIBUTE);
         $result = $query->searchQuery(0, 0, null);
         while ($result->fetch()) {
             $ids[] = $result->contribution_id;
         }
         $this->assign('totalSelectedContributions', $this->get('rowCount'));
     }
     $this->_contributionIds = $ids;
 }
示例#3
0
 /**
  * Determine the form name based on the action. This allows us
  * to avoid using  conditional state machine, much more efficient
  * and simpler
  *
  * @param CRM_Core_Controller $controller the controller object
  *
  * @param string $formName
  *
  * @return string the name of the form that will handle the task
  * @access protected
  */
 function taskName($controller, $formName = 'Search')
 {
     // total hack, check POST vars and then session to determine stuff
     $value = CRM_Utils_Array::value('task', $_POST);
     if (!isset($value)) {
         $value = $this->_controller->get('task');
     }
     $this->_controller->set('task', $value);
     return CRM_Contribute_Task::getTask($value);
 }
示例#4
0
文件: Task.php 项目: bhirsch/voipdev
 /**
  * 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 &tasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(3 => ts('Export Contributions'), 1 => ts('Delete Contributions'), 5 => ts('Send Email to Contacts'), 7 => ts('Print Contribution Receipts'), 6 => ts('Update Pending Contribution Status'), 4 => ts('Batch Update Contributions Via Profile'));
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete in CiviContribute')) {
             unset(self::$_tasks[1]);
         }
     }
     return self::$_tasks;
 }
示例#5
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 &tasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(1 => array('title' => ts('Delete Contributions'), 'class' => 'CRM_Contribute_Form_Task_Delete', 'result' => FALSE), 2 => array('title' => ts('Print Selected Rows'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => FALSE), 3 => array('title' => ts('Export Contributions'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), 4 => array('title' => ts('Batch Update Contributions Via Profile'), 'class' => array('CRM_Contribute_Form_Task_PickProfile', 'CRM_Contribute_Form_Task_Batch'), 'result' => TRUE), 5 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contribute_Form_Task_Email', 'result' => TRUE), 6 => array('title' => ts('Update Pending Contribution Status'), 'class' => 'CRM_Contribute_Form_Task_Status', 'result' => TRUE), 7 => array('title' => ts('Print or Email Contribution Receipts'), 'class' => 'CRM_Contribute_Form_Task_PDF', 'result' => FALSE), 8 => array('title' => ts('Thank-you Letters for Contributions'), 'class' => 'CRM_Contribute_Form_Task_PDFLetter', 'result' => FALSE));
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete in CiviContribute')) {
             unset(self::$_tasks[1]);
         }
         CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
         asort(self::$_tasks);
     }
     return self::$_tasks;
 }
示例#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 &tasks()
 {
     if (!self::$_tasks) {
         self::$_tasks = array(1 => array('title' => ts('Delete Contributions'), 'class' => 'CRM_Contribute_Form_Task_Delete', 'result' => false), 2 => array('title' => ts('Print Contributions'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => false), 3 => array('title' => ts('Export Contributions'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => false), 4 => array('title' => ts('Batch Update Contributions Via Profile'), 'class' => array('CRM_Contribute_Form_Task_PickProfile', 'CRM_Contribute_Form_Task_Batch'), 'result' => true), 5 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contribute_Form_Task_Email', 'result' => true), 6 => array('title' => ts('Update Pending Contribution Status'), 'class' => 'CRM_Contribute_Form_Task_Status', 'result' => true), 7 => array('title' => ts('Print or Email Contribution Receipts'), 'class' => 'CRM_Contribute_Form_Task_PDF', 'result' => false));
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete in CiviContribute')) {
             unset(self::$_tasks[1]);
         }
     }
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
     asort(self::$_tasks);
     return self::$_tasks;
 }
示例#7
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('Delete contributions'), 'class' => 'CRM_Contribute_Form_Task_Delete', 'result' => FALSE), 2 => array('title' => ts('Print selected rows'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => FALSE), 3 => array('title' => ts('Export contributions'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), 4 => array('title' => ts('Update multiple contributions'), 'class' => array('CRM_Contribute_Form_Task_PickProfile', 'CRM_Contribute_Form_Task_Batch'), 'result' => TRUE), 5 => array('title' => ts('Email - send now'), 'class' => 'CRM_Contribute_Form_Task_Email', 'result' => TRUE), 6 => array('title' => ts('Update pending contribution status'), 'class' => 'CRM_Contribute_Form_Task_Status', 'result' => TRUE), 7 => array('title' => ts('Receipts - print or email'), 'class' => 'CRM_Contribute_Form_Task_PDF', 'result' => FALSE), 8 => array('title' => ts('Thank-you letters - print or email'), 'class' => 'CRM_Contribute_Form_Task_PDFLetter', 'result' => FALSE), 9 => array('title' => ts('Invoices - print or email'), 'class' => 'CRM_Contribute_Form_Task_Invoice', 'result' => FALSE));
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete in CiviContribute')) {
             unset(self::$_tasks[1]);
         }
         //CRM-12920 - check for edit permission
         if (!CRM_Core_Permission::check('edit contributions')) {
             unset(self::$_tasks[4], self::$_tasks[6]);
         }
         // remove action "Invoices - print or email"
         $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
         $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
         if (!$invoicing) {
             unset(self::$_tasks[9]);
         }
         CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
         asort(self::$_tasks);
     }
     return self::$_tasks;
 }
示例#8
0
文件: Task.php 项目: kidaa30/yes
 /**
  * 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('Delete Contributions'), 'class' => 'CRM_Contribute_Form_Task_Delete', 'result' => FALSE), 2 => array('title' => ts('Print Selected Rows'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => FALSE), 3 => array('title' => ts('Export Contributions'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), 4 => array('title' => ts('Batch Update Contributions Via Profile'), 'class' => array('CRM_Contribute_Form_Task_PickProfile', 'CRM_Contribute_Form_Task_Batch'), 'result' => TRUE), 5 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contribute_Form_Task_Email', 'result' => TRUE), 6 => array('title' => ts('Update Pending Contribution Status'), 'class' => 'CRM_Contribute_Form_Task_Status', 'result' => TRUE), 7 => array('title' => ts('Print or Email Contribution Receipts'), 'class' => 'CRM_Contribute_Form_Task_PDF', 'result' => FALSE), 8 => array('title' => ts('Thank-you Letters for Contributions'), 'class' => 'CRM_Contribute_Form_Task_PDFLetter', 'result' => FALSE), 9 => array('title' => ts('Print or Email Contribution Invoices'), 'class' => 'CRM_Contribute_Form_Task_Invoice', 'result' => FALSE));
         //CRM-4418, check for delete
         if (!CRM_Core_Permission::check('delete in CiviContribute')) {
             unset(self::$_tasks[1]);
         }
         //CRM-12920 - check for edit permission
         if (!CRM_Core_Permission::check('edit contributions')) {
             unset(self::$_tasks[4], self::$_tasks[6]);
         }
         // remove action "Print or Email Contribution Invoices"
         $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
         $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
         if (!$invoicing) {
             unset(self::$_tasks[9]);
         }
         CRM_Utils_Hook::searchTasks('contribution', self::$_tasks);
         asort(self::$_tasks);
     }
     return self::$_tasks;
 }
示例#9
0
 static function preProcessCommon(&$form, $useTable = false)
 {
     $form->_contributionIds = array();
     $values = $form->controller->exportValues($form->get('searchFormName'));
     $form->_task = $values['task'];
     $contributeTasks = CRM_Contribute_Task::tasks();
     $form->assign('taskName', $contributeTasks[$form->_task]);
     $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');
         $query = new CRM_Contact_BAO_Query($queryParams, null, null, false, false, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
         $result = $query->searchQuery(0, 0, null);
         while ($result->fetch()) {
             $ids[] = $result->contribution_id;
         }
         $form->assign('totalSelectedContributions', $form->get('rowCount'));
     }
     if (!empty($ids)) {
         $form->_componentClause = ' civicrm_contribution.id IN ( ' . implode(',', $ids) . ' ) ';
         $form->assign('totalSelectedContributions', count($ids));
     }
     $form->_contributionIds = $form->_componentIds = $ids;
     //set the context for redirection for any task actions
     $session = CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
     require_once 'CRM/Utils/Rule.php';
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $searchFormName = strtolower($form->get('searchFormName'));
     if ($searchFormName == 'search') {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contribute/search', $urlParams));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/{$searchFormName}", $urlParams));
     }
 }
示例#10
0
 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     // text for sort_name
     $this->addElement('text', 'sort_name', ts('Contributor Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     $this->_group = CRM_Core_PseudoConstant::nestedGroup();
     // multiselect for groups
     if ($this->_group) {
         $this->add('select', 'group', ts('Groups'), $this->_group, FALSE, array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2'));
     }
     // multiselect for tags
     $contactTags = CRM_Core_BAO_Tag::getTags();
     if ($contactTags) {
         $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2'));
     }
     CRM_Contribute_BAO_Query::buildSearchForm($this);
     $rows = $this->get('rows');
     if (is_array($rows)) {
         if (!$this->_single) {
             $this->addRowSelectors($rows);
         }
         $permission = CRM_Core_Permission::getPermission();
         $queryParams = $this->get('queryParams');
         $softCreditFiltering = FALSE;
         if (!empty($queryParams)) {
             $softCreditFiltering = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($queryParams);
         }
         $tasks = CRM_Contribute_Task::permissionedTaskTitles($permission, $softCreditFiltering);
         $this->addTaskMenu($tasks);
     }
 }
示例#11
0
 /**
  * @param CRM_Core_Form $form
  * @param bool $useTable
  */
 public static function preProcessCommon(&$form, $useTable = FALSE)
 {
     $form->_contributionIds = array();
     $values = $form->controller->exportValues($form->get('searchFormName'));
     $form->_task = $values['task'];
     $contributeTasks = CRM_Contribute_Task::tasks();
     $form->assign('taskName', $contributeTasks[$form->_task]);
     $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);
         }
         $form->_includesSoftCredits = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($queryParams);
         $query = new CRM_Contact_BAO_Query($queryParams, array('contribution_id'), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
         // @todo the function CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled should handle this
         // can we remove? if not why not?
         if ($form->_includesSoftCredits) {
             $contactIds = $contributionContactIds = array();
             $query->_rowCountClause = " count(civicrm_contribution.id)";
             $query->_groupByComponentClause = " GROUP BY contribution_search_scredit_combined.id, contribution_search_scredit_combined.contact_id, contribution_search_scredit_combined.scredit_id ";
         } else {
             $query->_distinctComponentClause = ' civicrm_contribution.id';
             $query->_groupByComponentClause = ' GROUP BY civicrm_contribution.id ';
         }
         $result = $query->searchQuery(0, 0, $sortOrder);
         while ($result->fetch()) {
             $ids[] = $result->contribution_id;
             if ($form->_includesSoftCredits) {
                 $contactIds[$result->contact_id] = $result->contact_id;
                 $contributionContactIds["{$result->contact_id}-{$result->contribution_id}"] = $result->contribution_id;
             }
         }
         $result->free();
         $form->assign('totalSelectedContributions', $form->get('rowCount'));
     }
     if (!empty($ids)) {
         $form->_componentClause = ' civicrm_contribution.id IN ( ' . implode(',', $ids) . ' ) ';
         $form->assign('totalSelectedContributions', count($ids));
     }
     if (!empty($form->_includesSoftCredits) && !empty($contactIds)) {
         $form->_contactIds = $contactIds;
         $form->_contributionContactIds = $contributionContactIds;
     }
     $form->_contributionIds = $form->_componentIds = $ids;
     //set the context for redirection for any task actions
     $session = CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $form);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $searchFormName = strtolower($form->get('searchFormName'));
     if ($searchFormName == 'search') {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contribute/search', $urlParams));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url("civicrm/contact/search/{$searchFormName}", $urlParams));
     }
 }
示例#12
0
 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name
     $this->addElement('text', 'sort_name', ts('Contributor'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Contribute_Form_Search::buildQuickFormCommon($this);
     /* 
      * add form checkboxes for each row. This is needed out here to conform to QF protocol 
      * of all elements being declared in builQuickForm 
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         $this->addElement('checkbox', 'toggleSelect', null, null, array('onChange' => "return toggleCheckboxVals('mark_x_',this.form);"));
         $total = $cancel = 0;
         foreach ($rows as $row) {
             $this->addElement('checkbox', $row['checkbox'], null, null, array('onclick' => "return checkSelectedBox('" . $row['checkbox'] . "', '" . $this->getName() . "');"));
             if ($row['cancel_date']) {
                 $cancel += $row['total_amount'];
             } else {
                 $total += $row['total_amount'];
             }
         }
         $this->assign('total_amount', $total);
         $this->assign('cancel_amount', $cancel);
         $this->assign('num_amount', count($rows));
         $this->assign('single', $this->_single);
         // also add the action and radio boxes
         require_once 'CRM/Contribute/Task.php';
         $tasks = array('' => ts('- more actions -')) + CRM_Contribute_Task::tasks();
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         $this->add('submit', $this->_printButtonName, ts('Print'), array('class' => 'form-submit', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);"));
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', null, '', 'ts_sel', array('checked' => null));
         $this->addElement('radio', 'radio_ts', null, '', 'ts_all', array('onchange' => $this->getName() . ".toggleSelect.checked = false; toggleCheckboxVals('mark_x_'," . $this->getName() . "); return false;"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true)));
 }
示例#13
0
 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name
     $this->addElement('text', 'sort_name', ts('Contributor Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     require_once 'CRM/Contribute/BAO/Query.php';
     CRM_Contribute_BAO_Query::buildSearchForm($this);
     /* 
      * add form checkboxes for each row. This is needed out here to conform to QF protocol 
      * of all elements being declared in builQuickForm 
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         if (!$this->_single) {
             $this->addElement('checkbox', 'toggleSelect', null, null, array('onclick' => "toggleTaskAction( true ); return toggleCheckboxVals('mark_x_',this);"));
             foreach ($rows as $row) {
                 $this->addElement('checkbox', $row['checkbox'], null, null, array('onclick' => "toggleTaskAction( true ); return checkSelectedBox('" . $row['checkbox'] . "', '" . $this->getName() . "');"));
             }
         }
         $total = $cancel = 0;
         require_once "CRM/Core/Permission.php";
         $permission = CRM_Core_Permission::getPermission();
         require_once 'CRM/Contribute/Task.php';
         $tasks = array('' => ts('- more actions -')) + CRM_Contribute_Task::permissionedTaskTitles($permission);
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         $this->add('submit', $this->_printButtonName, ts('Print'), array('class' => 'form-submit', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);"));
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', null, '', 'ts_sel', array('checked' => 'checked'));
         $this->addElement('radio', 'radio_ts', null, '', 'ts_all', array('onclick' => $this->getName() . ".toggleSelect.checked = false; toggleCheckboxVals('mark_x_',this); toggleTaskAction( true );"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true)));
 }
示例#14
0
 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name
     $this->addElement('text', 'sort_name', ts('Contributor Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     $this->_group = CRM_Core_PseudoConstant::group();
     // multiselect for groups
     if ($this->_group) {
         $this->add('select', 'group', ts('Groups'), $this->_group, FALSE, array('id' => 'group', 'multiple' => 'multiple', 'class' => 'crm-select2'));
     }
     // multiselect for tags
     $contactTags = CRM_Core_BAO_Tag::getTags();
     if ($contactTags) {
         $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2'));
     }
     CRM_Contribute_BAO_Query::buildSearchForm($this);
     /*
      * add form checkboxes for each row. This is needed out here to conform to QF protocol
      * of all elements being declared in builQuickForm
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         if (!$this->_single) {
             $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('onclick' => "toggleTaskAction( true );", 'class' => 'select-rows'));
             foreach ($rows as $row) {
                 $this->addElement('checkbox', $row['checkbox'], NULL, NULL, array('onclick' => "toggleTaskAction( true );", 'class' => 'select-row'));
             }
         }
         $total = $cancel = 0;
         $permission = CRM_Core_Permission::getPermission();
         $tasks = array('' => ts('- actions -')) + CRM_Contribute_Task::permissionedTaskTitles($permission);
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked'));
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all', array('class' => 'select-rows', 'onclick' => $this->getName() . ".toggleSelect.checked = false; toggleTaskAction( true );"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
 }
 /**
  * Determine the form name based on the action. This allows us
  * to avoid using  conditional state machine, much more efficient
  * and simpler
  *
  * @param CRM_Core_Controller $controller the controller object
  *
  * @return string the name of the form that will handle the task
  * @access protected
  */
 function taskName($controller, $formName = 'Search')
 {
     // total hack, check POST vars and then session to determine stuff
     // fix value if print button is pressed
     if (CRM_Utils_Array::value('_qf_' . $formName . '_next_print', $_POST)) {
         $value = CRM_Contribute_Task::PRINT_CONTRIBUTIONS;
     } else {
         $value = CRM_Utils_Array::value('task', $_POST);
     }
     if (!isset($value)) {
         $value = $this->_controller->get('task');
     }
     $this->_controller->set('task', $value);
     return CRM_Contribute_Task::getTask($value);
 }