test-build failure fixes
[civicrm-core.git] / CRM / Contact / Form / Search / Basic.php
index 8bb31812ece72c9d057b8212a964ace33f2e4c3f..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
-   * @static
    */
   static $csv = array('contact_type', 'group', 'tag');
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    *
    * @return void
@@ -81,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 -'),
+          ));
       }
     }
 
@@ -102,10 +106,11 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Set the default form values
+   * Set the default form values.
    *
    *
-   * @return array the default array reference
+   * @return array
+   *   the default array reference
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -133,7 +138,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Add local and global form rules
+   * Add local and global form rules.
    *
    *
    * @return void
@@ -143,7 +148,7 @@ 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
    */
@@ -161,7 +166,7 @@ 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
    */
@@ -238,7 +243,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
       $this->_formValues['tag'][$tag] = 1;
     }
 
-    return;
+    return NULL;
   }
 
   /**
@@ -283,4 +288,5 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   public function getTitle() {
     return ts('Find Contacts');
   }
+
 }