Merge pull request #4721 from maxateff/apiexplorer-link
[civicrm-core.git] / CRM / Case / Form / Search.php
index 7fa31fb8dff16bf1db584db0963962cc9bd080e3..0ce694bdb6db6582d6aa134c55c183469ef1b42c 100644 (file)
 class CRM_Case_Form_Search extends CRM_Core_Form_Search {
 
   /**
-   * 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 action button
-   *
-   * @var string
-   * @access protected
-   */
-  protected $_actionButtonName;
-
-  /**
-   * form values that we will be using
-   *
-   * @var array
-   * @access protected
-   */
-  public $_formValues;
-
-  /**
-   * the params that are sent to the query
+   * The params that are sent to the query
    *
    * @var array
    * @access protected
@@ -79,15 +47,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   protected $_queryParams;
 
   /**
-   * have we already done this search
-   *
-   * @access protected
-   * @var boolean
-   */
-  protected $_done;
-
-  /**
-   * are we restricting ourselves to a single contact
+   * Are we restricting ourselves to a single contact
    *
    * @access protected
    * @var boolean
@@ -95,7 +55,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   protected $_single = FALSE;
 
   /**
-   * are we restricting ourselves to a single contact
+   * Are we restricting ourselves to a single contact
    *
    * @access protected
    * @var boolean
@@ -103,15 +63,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   protected $_limit = NULL;
 
   /**
-   * what context are we being invoked from
-   *
-   * @access protected
-   * @var string
-   */
-  protected $_context = NULL;
-
-  /**
-   * prefix for the controller
+   * Prefix for the controller
    *
    */
   protected $_prefix = 'case_';
@@ -119,7 +71,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   protected $_defaults;
 
   /**
-   * processing needed for buildForm and later
+   * Processing needed for buildForm and later
    *
    * @return void
    * @access public
@@ -220,7 +172,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   }
 
   /**
-   * Build the form
+   * Build the form object
    *
    * @access public
    *
@@ -236,33 +188,15 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
 
     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)) {
       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);
       }
 
-      $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]);
@@ -271,18 +205,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
         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);",
-        )
-      );
-
-      // 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 );"));
+      $this->addTaskMenu($tasks);
     }
 
   }
@@ -407,12 +330,10 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   }
 
   /**
-   * global validation rules for the form
+   * Global validation rules for the form
    *
    * @param array $fields posted values of the form
    *
-   * @internal param array $errors list of errors to be posted back to the form
-   *
    * @return void
    * @static
    * @access public
@@ -514,6 +435,9 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
     }
   }
 
+  /**
+   * @return null
+   */
   function getFormValues() {
     return NULL;
   }