class CRM_Member_BAO_Query {
/**
+ * Get available fields.
+ *
* @return array
*/
public static function &getFields() {
}
/**
- * If membership are involved, add the specific membership fields
+ * If membership are involved, add the specific membership fields.
*
- * @param $query
+ * @param CRM_Contact_BAO_Query $query
*/
public static function select(&$query) {
// if membership mode add membership id
}
/**
- * @param $query
+ * Generate where clause.
+ *
+ * @param CRM_Contact_BAO_Query $query
*/
public static function where(&$query) {
- $grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (empty($query->_params[$id][0])) {
continue;
if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}
- $grouping = $query->_params[$id][3];
self::whereClauseSingle($query->_params[$id], $query);
}
}
}
/**
- * @param $values
- * @param $query
+ * Generate where for a single parameter.
+ *
+ * @param array $values
+ * @param CRM_Contact_BAO_Query $query
*/
public static function whereClauseSingle(&$values, &$query) {
- list($name, $op, $value, $grouping, $wildcard) = $values;
+ list($name, $op, $value, $grouping) = $values;
switch ($name) {
case 'member_join_date_low':
case 'member_join_date_high':
$date = CRM_Utils_Date::format($value);
if ($date) {
$query->_where[$grouping][] = "civicrm_membership.join_date {$op} {$date}";
- $date = CRM_Utils_Date::customFormat($value);
$format = CRM_Utils_Date::customFormat(CRM_Utils_Date::format(array_reverse($value), '-'));
$query->_qill[$grouping][] = ts('Member Since %2 %1', array(1 => $format, 2 => $op));
}
"Integer"
);
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Member_DAO_Membership', $name, $value, $op);
- $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $qillName, 2 => $op, 3 => $value));
+ $query->_qill[$grouping][] = ts('%1 %2 %3', array(
+ 1 => $qillName,
+ 2 => $op,
+ 3 => $value,
+ ));
$query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1;
return;
}
/**
+ * Generate from clause.
+ *
* @param string $name
- * @param $mode
- * @param $side
+ * @param int $mode
+ * @param string $side
*
- * @return null|string
+ * @return string
*/
public static function from($name, $mode, $side) {
$from = NULL;
}
/**
- * @param $mode
+ * Get default return properties.
+ *
+ * @param string $mode
* @param bool $includeCustomFields
*
* @return array|null
}
/**
+ * Build the search form.
+ *
* @param CRM_Core_Form $form
*/
public static function buildSearchForm(&$form) {
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus();
- $form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE,
- array('id' => 'membership_status_id', 'multiple' => 'multiple', 'class' => 'crm-select2')
- );
-
- $form->addSelect('membership_type_id',
- array('entity' => 'membership', 'multiple' => 'multiple', 'label' => ts('Membership Type(s)'), 'option_url' => NULL, 'placeholder' => ts('- any -'))
- );
+ $form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE, array(
+ 'id' => 'membership_status_id',
+ 'multiple' => 'multiple',
+ 'class' => 'crm-select2',
+ ));
$form->addElement('text', 'member_source', ts('Source'));
}
/**
- * @param $row
+ * Possibly un-required function.
+ *
+ * @param array $row
* @param int $id
*/
public static function searchAction(&$row, $id) {
}
/**
- * @param $tables
+ * Add membership table.
+ *
+ * @param array $tables
*/
public static function tableNames(&$tables) {
- //add membership table
if (!empty($tables['civicrm_membership_log']) || !empty($tables['civicrm_membership_status']) || CRM_Utils_Array::value('civicrm_membership_type', $tables)) {
$tables = array_merge(array('civicrm_membership' => 1), $tables);
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*/
/**
- * This file is for civimember search
+ * Membership search.
+ *
+ * Class is a pane in advanced search and the membership search page.
*/
class CRM_Member_Form_Search extends CRM_Core_Form_Search {
/**
* Processing needed for buildForm and later.
- *
- * @return void
*/
public function preProcess() {
$this->set('searchFormName', 'Search');
- /**
- * set the button names
- */
$this->_searchButtonName = $this->getButtonName('refresh');
$this->_actionButtonName = $this->getButtonName('next', 'action');
/**
* Build the form object.
- *
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
* done.
* The processing consists of using a Selector / Controller framework for getting the
* search results.
- *
- * @param
- *
- * @return void
*/
public function postProcess() {
if ($this->_done) {
$controller->run();
}
+ /**
+ * Set default values.
+ *
+ * @todo - can this function override be removed?
+ *
+ * @return array
+ */
public function setDefaultValues() {
return $this->_defaults;
}
+ /**
+ * If this search has been forced then see if there are any get values, and if so over-ride the post values.
+ *
+ * Note that this means that GET over-rides POST :) & that force with no parameters can be very destructive.
+ */
public function fixFormValues() {
- // if this search has been forced
- // then see if there are any get values, and if so over-ride the post values
- // note that this means that GET over-rides POST :)
-
if (!$this->_force) {
return;
}
}
/**
- * Return a descriptive name for the page, used in wizard header
+ * Return a descriptive name for the page, used in wizard header.
*
* @return string
*/