X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FActivity%2FForm%2FSearch.php;h=5c5b42ee5b8bf0fa52f1fcb31f85fc32bf097dcd;hb=32864ccf6ecdf9927f12f57a693ef0f22d9ccfb4;hp=9126675ad883e06fed27730e70c34c3f8068e4fb;hpb=785b0cfda8edb302604577e5992ad8168ddca3d8;p=civicrm-core.git diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 9126675ad8..5c5b42ee5b 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -1,7 +1,7 @@ set('searchFormName', 'Search'); - /** - * set the button names - */ + // set the button names $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ + // we allow the controller to set force/reset externally, useful when we are being + // driven by the wizard framework $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); @@ -216,55 +159,26 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { } /** - * Build the form + * Build the form object * - * @access public * * @return void */ - function buildQuickForm() { + public function buildQuickForm() { parent::buildQuickForm(); $this->addElement('text', 'sort_name', ts('Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); CRM_Activity_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') - ); - } + $this->addRowSelectors($rows); } $permission = CRM_Core_Permission::getPermission(); - $tasks = array('' => ts('- actions -')) + CRM_Activity_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', 'onchange' => $this->getName() . ".toggleSelect.checked = false; toggleTaskAction( true );") - ); + $this->addTaskMenu(CRM_Activity_Task::permissionedTaskTitles($permission)); } } @@ -284,9 +198,8 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { * @param * * @return void - * @access public */ - function postProcess() { + public function postProcess() { if ($this->_done) { return; } @@ -366,7 +279,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { $controller->run(); } - function fixFormValues() { + public function fixFormValues() { if (!$this->_force) { return; } @@ -457,7 +370,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { if ($dateHigh) { // Activity date time assumes midnight at the beginning of the date // This sets it to almost midnight at the end of the date - /* if ($dateHigh <= 99999999) { + /* if ($dateHigh <= 99999999) { $dateHigh = 1000000 * $dateHigh + 235959; } */ $dateHigh = date('m/d/Y', strtotime($dateHigh)); @@ -475,7 +388,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { /** * @return null */ - function getFormValues() { + public function getFormValues() { return NULL; } @@ -483,10 +396,8 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { * Return a descriptive name for the page, used in wizard header * * @return string - * @access public */ public function getTitle() { return ts('Find Activities'); } } -