test-build failure fixes
[civicrm-core.git] / CRM / Contact / Form / Search / Basic.php
index 0b5e775f755cc2508494d98e3e92d7fb7db384a5..9387d6b08bb985dee78fe1f55a75894612078635 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
  */
 class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
-  /*
+  /**
    * csv - common search values
    *
    * @var array
-   * @access protected
-   * @static
    */
   static $csv = array('contact_type', 'group', 'tag');
 
   /**
-   * Build the form object
+   * Build the form object.
    *
-   * @access public
    *
    * @return void
    */
@@ -83,20 +80,25 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
       );
     }
 
+    // add select for groups
     if (!empty($searchOptions['groups'])) {
-      // Arrange groups into hierarchical listing (child groups follow their parents and have indentation spacing in title)
-      $groupHierarchy = CRM_Contact_BAO_Group::getGroupsHierarchy($this->_group, NULL, '&nbsp;&nbsp;', TRUE);
-
-      // add select for groups
-      $group = array('' => ts('- any group -')) + $groupHierarchy;
-      $this->add('select', 'group', ts('in'), $group, FALSE, array('class' => 'crm-select2'));
+      $this->addSelect('group', array(
+          'entity' => 'group_contact',
+          'label' => ts('in'),
+          'context' => 'search',
+          'placeholder' => ts('- any group -'),
+        ));
     }
 
     if (!empty($searchOptions['tags'])) {
       // tag criteria
       if (!empty($this->_tag)) {
-        $tag = array('' => ts('- any tag -')) + $this->_tag;
-        $this->add('select', 'tag', ts('with'), $tag, FALSE, array('class' => 'crm-select2'));
+        $this->addSelect('tag', array(
+            'entity' => 'entity_tag',
+            'label' => ts('with'),
+            'context' => 'search',
+            'placeholder' => ts('- any tag -'),
+          ));
       }
     }
 
@@ -104,11 +106,11 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Set the default form values
+   * Set the default form values.
    *
-   * @access protected
    *
-   * @return array the default array reference
+   * @return array
+   *   the default array reference
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -136,9 +138,8 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Add local and global form rules
+   * Add local and global form rules.
    *
-   * @access protected
    *
    * @return void
    */
@@ -147,10 +148,9 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Processing needed for buildForm and later
+   * Processing needed for buildForm and later.
    *
    * @return void
-   * @access public
    */
   public function preProcess() {
     $this->set('searchFormName', 'Basic');
@@ -166,10 +166,9 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * This method is called for processing a submitted search form
+   * This method is called for processing a submitted search form.
    *
    * @return void
-   * @access public
    */
   public function postProcess() {
     $this->set('isAdvanced', '0');
@@ -222,7 +221,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
    * multiple purposes (queries, save/edit etc)
    *
    * @return void
-   * @access private
    */
   public function normalizeFormValues() {
     $contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
@@ -245,7 +243,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
       $this->_formValues['tag'][$tag] = 1;
     }
 
-    return;
+    return NULL;
   }
 
   /**
@@ -283,7 +281,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
    * Return a descriptive name for the page, used in wizard header
    *
    * @return string
-   * @access public
    */
   /**
    * @return string
@@ -291,5 +288,5 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   public function getTitle() {
     return ts('Find Contacts');
   }
-}
 
+}