<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Pledge_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
+ * The params that are sent to the query
*
* @var array
- * @access protected
- */
- protected $_formValues;
-
- /**
- * the params that are sent to the query
- *
- * @var array
- * @access protected
*/
protected $_queryParams;
/**
- * have we already done this search
+ * Are we restricting ourselves to a single contact
*
- * @access protected
- * @var boolean
- */
- protected $_done;
-
- /**
- * are we restricting ourselves to a single contact
- *
- * @access protected
* @var boolean
*/
protected $_single = FALSE;
/**
- * are we restricting ourselves to a single contact
+ * Are we restricting ourselves to a single contact
*
- * @access protected
* @var boolean
*/
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 = "pledge_";
protected $_defaults;
/**
- * processing needed for buildForm and later
+ * Processing needed for buildForm and later
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
/**
* set the button names
);
}
-
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
$selector = new CRM_Pledge_Selector_Search($this->_queryParams,
$this->_action,
}
/**
- * Build the form
+ * Build the form object
*
- * @access public
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
parent::buildQuickForm();
$this->addElement('text', 'sort_name', ts('Pledger Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
CRM_Pledge_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_Pledge_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', 'onclick' => $this->getName() . ".toggleSelect.checked = false; toggleTaskAction( true );"));
+ $this->addTaskMenu(CRM_Pledge_Task::permissionedTaskTitles($permission));
}
}
* @param
*
* @return void
- * @access public
*/
- function postProcess() {
+ public function postProcess() {
if ($this->_done) {
return;
}
* All local rules are added near the element
*
* @return void
- * @access public
* @see valid_date
*/
- function addRules() {
+ public function addRules() {
$this->addFormRule(array('CRM_Pledge_Form_Search', 'formRule'));
}
/**
- * 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
+ * @param array $fields
+ * Posted values of the form.
*
* @return void
* @static
- * @access public
*/
- static function formRule($fields) {
+ public static function formRule($fields) {
$errors = array();
if (!empty($errors)) {
/**
* Set the default form values
*
- * @access protected
*
* @return array the default array reference
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$defaults = $this->_formValues;
return $defaults;
}
- function fixFormValues() {
+ public function fixFormValues() {
if (!$this->_force) {
return;
}
/**
* @return null
*/
- function getFormValues() {
+ public function getFormValues() {
return NULL;
}
* Return a descriptive name for the page, used in wizard header
*
* @return string
- * @access public
*/
public function getTitle() {
return ts('Find Pledges');
}
}
-