Ejemplo n.º 1
0
 /**
  * returns the column headers as an array of tuples:
  * (name, sortName (key to the sort array))
  *
  * @param string $action the action being performed
  * @param enum   $output what should the result set include (web/email/csv)
  *
  * @return array the column headers that need to be displayed
  * @access public
  */
 public function &getColumnHeaders($action = NULL, $output = NULL)
 {
     if (!isset(self::$_columnHeaders)) {
         self::$_columnHeaders = array(array('name' => ts('Type'), 'sort' => 'membership_type_id', 'direction' => CRM_Utils_Sort::DONTCARE), array('name' => ts('Member Since'), 'sort' => 'join_date', 'direction' => CRM_Utils_Sort::DESCENDING), array('name' => ts('Start Date'), 'sort' => 'membership_start_date', 'direction' => CRM_Utils_Sort::DONTCARE), array('name' => ts('End Date'), 'sort' => 'membership_end_date', 'direction' => CRM_Utils_Sort::DONTCARE), array('name' => ts('Source'), 'sort' => 'membership_source', 'direction' => CRM_Utils_Sort::DONTCARE), array('name' => ts('Status'), 'sort' => 'status_id', 'direction' => CRM_Utils_Sort::DONTCARE), array('name' => ts('Auto-renew?')), array('desc' => ts('Actions')));
         if (!$this->_single) {
             $pre = array(array('desc' => ts('Contact Type')), array('name' => ts('Name'), 'sort' => 'sort_name', 'direction' => CRM_Utils_Sort::DONTCARE));
             self::$_columnHeaders = array_merge($pre, self::$_columnHeaders);
         }
     }
     return self::$_columnHeaders;
 }
Ejemplo n.º 2
0
 /**
  * The post processing of the form gets done here.
  *
  * Key things done during post processing are
  *      - check for reset or next request. if present, skip post procesing.
  *      - now check if user requested running a saved search, if so, then
  *        the form values associated with the saved search are used for searching.
  *      - if user has done a submit with new values the regular post submissing is
  *        done.
  * The processing consists of using a Selector / Controller framework for getting the
  * search results.
  *
  * @param
  *
  * @return void
  * @access public
  */
 function postProcess()
 {
     if ($this->_done) {
         return;
     }
     $this->_done = TRUE;
     $this->_formValues = $this->controller->exportValues($this->_name);
     $this->fixFormValues();
     // We don't show test records in summaries or dashboards
     if (empty($this->_formValues['member_test']) && $this->_force) {
         $this->_formValues["member_test"] = 0;
     }
     CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $this->set('formValues', $this->_formValues);
     $this->set('queryParams', $this->_queryParams);
     $buttonName = $this->controller->getButtonName();
     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
         $stateMachine = $this->controller->getStateMachine();
         $formName = $stateMachine->getTaskFormName();
         $this->controller->resetPage($formName);
         return;
     }
     $sortID = NULL;
     if ($this->get(CRM_Utils_Sort::SORT_ID)) {
         $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION));
     }
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $selector = new CRM_Member_Selector_Search($this->_queryParams, $this->_action, NULL, $this->_single, $this->_limit, $this->_context);
     $selector->setKey($this->controller->_key);
     $prefix = NULL;
     if ($this->_context == 'basic') {
         $prefix = $this->_prefix;
     }
     $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SESSION, $prefix);
     $controller->setEmbedded(TRUE);
     $query =& $selector->getQuery();
     $controller->run();
 }
Ejemplo n.º 3
0
 /**
  * The post processing of the form gets done here.
  *
  * Key things done during post processing are
  *      - check for reset or next request. if present, skip post procesing.
  *      - now check if user requested running a saved search, if so, then
  *        the form values associated with the saved search are used for searching.
  *      - if user has done a submit with new values the regular post submissing is 
  *        done.
  * The processing consists of using a Selector / Controller framework for getting the
  * search results.
  *
  * @param
  *
  * @return void 
  * @access public
  */
 function postProcess()
 {
     if ($this->_done) {
         return;
     }
     $this->_done = true;
     $this->_formValues = $this->controller->exportValues($this->_name);
     $this->fixFormValues();
     // we don't show test memberships in Contact Summary / User Dashboard
     // in Search mode by default we hide test memberships
     if (!CRM_Utils_Array::value('member_test', $this->_formValues)) {
         $this->_formValues["member_test"] = 0;
     }
     require_once 'CRM/Core/BAO/CustomValue.php';
     CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
     require_once 'CRM/Contact/BAO/Query.php';
     $this->_queryParams =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $this->set('formValues', $this->_formValues);
     $this->set('queryParams', $this->_queryParams);
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->_actionButtonName || $buttonName == $this->_printButtonName) {
         // 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
         $stateMachine =& $this->controller->getStateMachine();
         $formName = $stateMachine->getTaskFormName();
         $this->controller->resetPage($formName);
         return;
     }
     $sortID = null;
     if ($this->get(CRM_Utils_Sort::SORT_ID)) {
         $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), $this->get(CRM_Utils_Sort::SORT_DIRECTION));
     }
     require_once 'CRM/Contact/BAO/Query.php';
     $this->_queryParams =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     require_once "CRM/Member/Selector/Search.php";
     $selector = new CRM_Member_Selector_Search($this->_queryParams, $this->_action, null, $this->_single, $this->_limit, $this->_context);
     $selector->setKey($this->controller->_key);
     $prefix = null;
     if ($this->_context == 'basic') {
         $prefix = $this->_prefix;
     }
     $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), $sortID, CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SESSION, $prefix);
     $controller->setEmbedded(true);
     $query =& $selector->getQuery();
     $controller->run();
 }