_taskList, * preferably by extending this method. * * @return array */ protected function buildTaskList() { return $this->_taskList; } /** * Common buildform tasks required by all searches */ public function buildQuickform() { $resources = CRM_Core_Resources::singleton(); if ($resources->ajaxPopupsEnabled) { // Script needed by some popups $this->assign('includeWysiwygEditor', TRUE); } $resources ->addScriptFile('civicrm', 'js/crm.searchForm.js', 1, 'html-header') ->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header'); $this->addButtons(array( array( 'type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE, ), )); $this->addClass('crm-search-form'); // for backwards compatibility we pass an argument to addTaskMenu even though // it could just as well access $this->_taskList internally $tasks = $this->buildTaskList(); $this->addTaskMenu($tasks); } /** * Add checkboxes for each row plus a master checkbox */ public function addRowSelectors($rows) { $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('class' => 'select-rows')); foreach ($rows as $row) { $this->addElement('checkbox', $row['checkbox'], NULL, NULL, array('class' => 'select-row')); } } /** * Add actions menu to search results form * @param $tasks */ public function addTaskMenu($tasks) { if (is_array($tasks) && !empty($tasks)) { $tasks = array('' => ts('Actions')) + $tasks; $this->add('select', 'task', NULL, $tasks, FALSE, array('class' => 'crm-select2 crm-action-menu huge crm-search-result-actions')); $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'hiddenElement crm-search-go-button')); // Radio to choose "All items" or "Selected items only" $selectedRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked')); $allRowsRadio = $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all'); $this->assign('ts_sel_id', $selectedRowsRadio->_attributes['id']); $this->assign('ts_all_id', $allRowsRadio->_attributes['id']); } } }