$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
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign("context", $this->_context);
+ $this->getUrlVariables();
// get user submitted values
// get it from controller only if form has been submitted, else preProcess has set this
$this->_printButtonName = $this->getButtonName('next', 'print');
$this->_actionButtonName = $this->getButtonName('next', 'action');
- //we allow the controller to set force/reset externally,
- //useful when we are being driven by the wizard framework
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
+ $this->getUrlVariables();
//operation for state machine.
$this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve');
$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
- */
-
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign('context', $this->_context);
-
- // get user submitted values
- // get it from controller only if form has been submitted, else preProcess has set this
- if (!empty($_POST) && !$this->controller->isModal()) {
- $this->_formValues = $this->controller->exportValues($this->_name);
- }
- else {
- $this->_formValues = $this->get('formValues');
- }
-
- if (empty($this->_formValues)) {
- if (isset($this->_ssID)) {
- $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
- }
- }
+ $this->getUrlVariables();
+ $this->getFormValues();
if ($this->_force) {
$this->postProcess();
// @todo - is this an error - $this->_defaults is used.
$this->defaults = array();
- /*
- * 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');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign("context", $this->_context);
+ $this->getUrlVariables();
// get user submitted values
// get it from controller only if form has been submitted, else preProcess has set this
}
+ /**
+ * we allow the controller to set force/reset externally, useful when we are being
+ * driven by the wizard framework
+ */
+ protected function getUrlVariables() {
+ $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
+ $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
+ $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
+ $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
+ $this->assign("context", $this->_context);
+ }
+
+ /**
+ * Get user submitted values.
+ *
+ * Get it from controller only if form has been submitted, else preProcess has set this
+ */
+ protected function getFormVariables() {
+ if (!empty($_POST) && !$this->controller->isModal()) {
+ $this->_formValues = $this->controller->exportValues($this->_name);
+ }
+ else {
+ $this->_formValues = $this->get('formValues');
+ }
+
+ if (empty($this->_formValues)) {
+ if (isset($this->_ssID)) {
+ $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
+ }
+ }
+ }
+
}
$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
- */
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
- $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this);
- $this->assign("context", $this->_context);
-
- // get user submitted values
- // get it from controller only if form has been submitted, else preProcess has set this
- if (!empty($_POST) && !$this->controller->isModal()) {
- $this->_formValues = $this->controller->exportValues($this->_name);
- }
- else {
- $this->_formValues = $this->get('formValues');
- }
-
- if (empty($this->_formValues)) {
- if (isset($this->_ssID)) {
- $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
- }
- }
+ $this->getUrlVariables();
+ $this->getFormValues();
if ($this->_force) {
$this->postProcess();
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2018
- * $Id$
- *
*/
/**
- * Files required
- */
-
-/**
- * This file is for civigrant search
+ * This file is for CiviGrant search
*/
class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
protected $_single = FALSE;
/**
- * Are we restricting ourselves to a single contact.
+ * Return limit.
*
- * @var boolean
+ * @var int
*/
protected $_limit = NULL;
*/
protected $_prefix = "grant_";
+ protected $entity = 'grant';
+
/**
* Processing needed for buildForm and later.
*
$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
- */
-
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign("context", $this->_context);
-
- // get user submitted values
- // get it from controller only if form has been submitted, else preProcess has set this
- if (!empty($_POST)) {
- $this->_formValues = $this->controller->exportValues($this->_name);
- }
- else {
- $this->_formValues = $this->get('formValues');
- }
-
- if (empty($this->_formValues)) {
- if (isset($this->_ssID)) {
- $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
- }
- }
+ $this->getUrlVariables();
+ $this->getFormVariables();
if ($this->_force) {
$this->postProcess();
/**
* Build the form object.
- *
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
$this->defaults = array();
- /*
- * 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');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign("context", $this->_context);
+ $this->getUrlVariables();
// get user submitted values
// get it from controller only if form has been submitted, else preProcess has set this
$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
-
- $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean');
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
- $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this);
- $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search');
-
- $this->assign("context", $this->_context);
+ $this->getUrlVariables();
// get user submitted values
// get it from controller only if form has been submitted, else preProcess has set this