/** * 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(2 => array('title' => ts('Print Bookings'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => FALSE)); CRM_Utils_Hook::searchTasks('contribution', self::$_tasks); asort(self::$_tasks); } return self::$_tasks; }
/** * 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_Booking_Form_Task::PRINT_BOOKING; } else { $value = CRM_Utils_Array::value('task', $_POST); } if (!isset($value)) { $value = $this->_controller->get('task'); } $this->_controller->set('task', $value); return CRM_Booking_Form_Task::getTask($value); }
/** * Build the form * * @access public * * @return void */ function buildQuickForm() { // text for sort_name $this->addElement('text', 'sort_name', ts('Contact Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); CRM_Booking_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'] . "');")); } } $total = $cancel = 0; $permission = CRM_Core_Permission::getPermission(); $tasks = array('' => ts('- actions -')) + CRM_Booking_Form_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);")); //-- Remove print button as it causes an exception when pressed //-- TODO : Bring back search results print button functionality (See: PCBK-182) // $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))); }