/** * Build the form object. */ public function buildQuickForm() { if ($this->_search) { return; } //build common search form. CRM_Campaign_BAO_Query::buildSearchForm($this); //build the array of all search params. $this->_searchParams = array(); foreach ($this->_elements as $element) { $name = $element->_attributes['name']; if ($name == 'qfKey') { continue; } $this->_searchParams[$name] = $name; } $this->set('searchParams', $this->_searchParams); $this->assign('searchParams', json_encode($this->_searchParams)); $defaults = array(); if (!$this->_surveyId) { $this->_surveyId = key(CRM_Campaign_BAO_Survey::getSurveys(TRUE, TRUE)); } if ($this->_force || $this->_votingTab) { $session = CRM_Core_Session::singleton(); $userId = $session->get('userID'); // get interviewer id $cid = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, $userId); $defaults['survey_interviewer_id'] = $cid; } if ($this->_surveyId) { $defaults['campaign_survey_id'] = $this->_surveyId; } if (!empty($defaults)) { $this->setDefaults($defaults); } //validate the required ids. $this->validateIds(); }
/** * 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. 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 * * @access public * @return void */ function buildQuickForm() { if ($this->_search) { return; } //build common search form. require_once 'CRM/Campaign/BAO/Query.php'; CRM_Campaign_BAO_Query::buildSearchForm($this); //build the array of all search params. $this->_searchParams = array(); foreach ($this->_elements as $element) { $name = $element->_attributes['name']; $this->_searchParams[$name] = $name; } $this->set('searchParams', $this->_searchParams); $this->assign('searchParams', json_encode($this->_searchParams)); $defaults = array(); if (!$this->_surveyId) { $this->_surveyId = key(CRM_Campaign_BAO_Survey::getSurvey(false, null, true)); } if ($this->_force || $this->_votingTab) { $session = CRM_Core_Session::singleton(); $userId = $session->get('userID'); // get interviewer id $cid = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, false, $userId); require_once 'CRM/Contact/BAO/Contact.php'; $defaults['survey_interviewer_id'] = $cid; $defaults['survey_interviewer_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'sort_name', 'id'); } if ($this->_surveyId) { $defaults['campaign_survey_id'] = $this->_surveyId; } if (!empty($defaults)) { $this->setDefaults($defaults); } //validate the required ids. $this->validateIds(); }
/** * 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))); }