<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
/**
* This file is for Case search
*/
-class CRM_Case_Form_Search extends CRM_Core_Form {
-
- /**
- * Are we forced to run a search
- *
- * @var int
- * @access protected
- */
- protected $_force;
-
- /**
- * name of search button
- *
- * @var string
- * @access protected
- */
- protected $_searchButtonName;
-
- /**
- * name of print button
- *
- * @var string
- * @access protected
- */
- protected $_printButtonName;
-
- /**
- * name of action button
- *
- * @var string
- * @access protected
- */
- protected $_actionButtonName;
-
- /**
- * form values that we will be using
- *
- * @var array
- * @access protected
- */
- public $_formValues;
+class CRM_Case_Form_Search extends CRM_Core_Form_Search {
/**
* the params that are sent to the query
*/
protected $_queryParams;
- /**
- * have we already done this search
- *
- * @access protected
- * @var boolean
- */
- protected $_done;
-
/**
* are we restricting ourselves to a single contact
*
*/
protected $_limit = NULL;
- /**
- * what context are we being invoked from
- *
- * @access protected
- * @var string
- */
- protected $_context = NULL;
-
/**
* prefix for the controller
*
function preProcess() {
$this->set('searchFormName', 'Search');
- // js for changing activity status
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Case/Form/ActivityChangeStatus.js');
-
//check for civicase access.
if (!CRM_Case_BAO_Case::accessCiviCase()) {
CRM_Core_Error::fatal(ts('You are not authorized to access this page.'));
* set the button names
*/
$this->_searchButtonName = $this->getButtonName('refresh');
- $this->_printButtonName = $this->getButtonName('next', 'print');
$this->_actionButtonName = $this->getButtonName('next', 'action');
$this->_done = FALSE;
* @return void
*/
function buildQuickForm() {
+ parent::buildQuickForm();
$this->addElement('text',
'sort_name',
ts('Client Name or Email'),
CRM_Case_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.livePage.js');
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->addRowSelectors($rows);
}
- $total = $cancel = 0;
-
$permission = CRM_Core_Permission::getPermission();
- $tasks = array('' => ts('- actions -')) + CRM_Case_Task::permissionedTaskTitles($permission);
+ $tasks = CRM_Case_Task::permissionedTaskTitles($permission);
if (!empty($this->_formValues['case_deleted'])) {
unset($tasks[1]);
unset($tasks[4]);
}
- $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);",
- )
- );
-
- $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 );"));
+ $this->addTaskMenu($tasks);
}
- // add buttons
- $this->addButtons(array(
- array(
- 'type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
}
/**
$this->set('queryParams', $this->_queryParams);
$buttonName = $this->controller->getButtonName();
- if ($buttonName == $this->_actionButtonName || $buttonName == $this->_printButtonName) {
+ if ($buttonName == $this->_actionButtonName) {
// check actionName and if next, then do not repeat a search, since we are going to the next page
// hack, make sure we reset the task values
* global validation rules for the form
*
* @param array $fields posted values of the form
- * @param array $errors list of errors to be posted back to the form
+ *
+ * @internal param array $errors list of errors to be posted back to the form
*
* @return void
* @static
}
}
+ /**
+ * @return null
+ */
function getFormValues() {
return NULL;
}