/** * Build the form * * @access public * * @return void */ function buildQuickForm() { //build the search form. CRM_Campaign_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)) { CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.searchForm.js'); 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(); $allTasks = CRM_Campaign_Task::permissionedTaskTitles($permission); //hack to serve right page to state machine. $taskMapping = array('interview' => 1, 'reserve' => 2, 'release' => 3); $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping); $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) { $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE); $surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_formValues['campaign_survey_id'], 'activity_type_id'); $taskValue = array($currentTaskValue => ts('Record %1 Responses', array(1 => $activityTypes[$surveyTypeId]))); } $this->add('select', 'task', ts('Actions:') . ' ', array('' => ts('- actions -')) + $taskValue); $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go')); // 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))); }
/** * Build the form object. */ public function buildQuickForm() { parent::buildQuickForm(); //build the search form. CRM_Campaign_BAO_Query::buildSearchForm($this); $rows = $this->get('rows'); if (is_array($rows)) { if (!$this->_single) { $this->addRowSelectors($rows); } $permission = CRM_Core_Permission::getPermission(); $allTasks = CRM_Campaign_Task::permissionedTaskTitles($permission); //hack to serve right page to state machine. $taskMapping = array('interview' => 1, 'reserve' => 2, 'release' => 3); $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping); $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) { $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE); $surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_formValues['campaign_survey_id'], 'activity_type_id'); $taskValue = array($currentTaskValue => ts('Record %1 Responses', array(1 => $activityTypes[$surveyTypeId]))); } $this->addTaskMenu($taskValue); } }
/** * Build the form * * @access public * @return void */ function buildQuickForm() { //build the search form. require_once 'CRM/Campaign/BAO/Query.php'; CRM_Campaign_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/Campaign/Task.php'; $allTasks = CRM_Campaign_Task::permissionedTaskTitles($permission); //hack to serve right page to state machine. $taskMapping = array('interview' => 1, 'reserve' => 2, 'release' => 3); $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping); $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); if ($this->_operation == 'interview' && CRM_Utils_Array::value('campaign_survey_id', $this->_formValues)) { require_once 'CRM/Core/PseudoConstant.php'; $activityTypes = CRM_Core_PseudoConstant::activityType(false, true, false, 'label', true); $surveyTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_formValues['campaign_survey_id'], 'activity_type_id'); $taskValue = array($currentTaskValue => ts('Record %1 Responses', array(1 => $activityTypes[$surveyTypeId]))); } $this->add('select', 'task', ts('Actions:') . ' ', $taskValue); $this->setDefaults(array('task' => $currentTaskValue)); $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go')); $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))); }