Merge pull request #4961 from pratikshad/core-bugs
[civicrm-core.git] / CRM / Contact / Form / Search / Criteria.php
index 7bd9fb9aadaf061cdeeaf70afa39ee27d5cb8a3e..bf0f9e74e4151cb7d2ab8dee61e49d24ba82ec0a 100644 (file)
@@ -66,7 +66,7 @@ class CRM_Contact_Form_Search_Criteria {
         $form->add('select', 'group_type', ts('Group Types'), $groupOptions, FALSE,
           array('id' => 'group_type', 'multiple' => 'multiple', 'class' => 'crm-select2')
         );
-        $form->add('hidden','group_search_selected','group');
+        $form->add('hidden', 'group_search_selected', 'group');
       }
     }
 
@@ -85,7 +85,7 @@ class CRM_Contact_Form_Search_Criteria {
 
       $used_for = CRM_Core_OptionGroup::values('tag_used_for');
       $tagsTypes = array();
-      $showAllTagTypes = false;
+      $showAllTagTypes = FALSE;
       foreach ($used_for as $key => $value) {
         //check tags for every type and find if there are any defined
         $tags = CRM_Core_BAO_Tag::getTagsUsedFor($key, FALSE, TRUE, NULL);
@@ -94,13 +94,13 @@ class CRM_Contact_Form_Search_Criteria {
         if (count($tags) && $key != 'civicrm_file' && $key != 'civicrm_contact') {
           //if tags exists then add type to display in adv search form help text
           $tagsTypes[] = ts($value);
-          $showAllTagTypes = true;
+          $showAllTagTypes = TRUE;
         }
       }
       $tagTypesText = implode(" or ", $tagsTypes);
       if ($showAllTagTypes) {
         $form->add('checkbox', 'all_tag_types', ts('Include tags used for %1', array(1 => $tagTypesText)));
-        $form->add('hidden','tag_types_text', $tagTypesText);
+        $form->add('hidden', 'tag_types_text', $tagTypesText);
       }
     }
 
@@ -116,7 +116,6 @@ class CRM_Contact_Form_Search_Criteria {
     //added job title
     $form->addElement('text', 'job_title', ts('Job Title'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'job_title'));
 
-
     //added internal ID
     $form->addElement('text', 'contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
     $form->addRule('contact_id', ts('Please enter valid Contact ID'), 'positiveInteger');
@@ -158,7 +157,8 @@ class CRM_Contact_Form_Search_Criteria {
       'uf_group_id',
       ts('Search Views'),
       array(
-        '0' => ts('- default view -')) + $searchProfiles
+        '0' => ts('- default view -'),
+      ) + $searchProfiles
     );
 
     $componentModes = CRM_Contact_Form_Search::getModeSelect();
@@ -192,7 +192,8 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addElement('select',
       'operator',
       ts('Search Operator'),
-      array('AND' => ts('AND'),
+      array(
+        'AND' => ts('AND'),
         'OR' => ts('OR'),
       )
     );
@@ -234,7 +235,8 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addElement('select',
       'privacy_operator',
       ts('Operator'),
-      array('OR' => ts('OR'),
+      array(
+        'OR' => ts('OR'),
         'AND' => ts('AND'),
       )
     );
@@ -259,7 +261,7 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addGroup($commPreff, 'preferred_communication_method', ts('Preferred Communication Method'));
 
     //CRM-6138 Preferred Language
-    $form->addSelect('preferred_language', array('class' => 'twenty', 'option_url' => NULL));
+    $form->addSelect('preferred_language', array('class' => 'twenty', 'context' => 'search'));
 
     // Phone search
     $form->addElement('text', 'phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
@@ -310,8 +312,8 @@ class CRM_Contact_Form_Search_Criteria {
       list($title, $attributes, $select, $multiSelect) = $v;
 
       if (in_array($name,
-          array('street_number', 'street_name', 'street_unit')
-        )) {
+        array('street_number', 'street_name', 'street_unit')
+      )) {
         if (!$parseStreetAddress) {
           continue;
         }
@@ -352,12 +354,12 @@ class CRM_Contact_Form_Search_Criteria {
       $form->addElement('text', 'prox_distance', ts('Find contacts within'), array('class' => 'six'));
       $form->addElement('select', 'prox_distance_unit', NULL, array(
         'miles' => ts('Miles'),
-        'kilos' => ts('Kilometers')
+        'kilos' => ts('Kilometers'),
       ));
       $form->addRule('prox_distance', ts('Please enter positive number as a distance'), 'numeric');
     }
 
-    $form->addSelect('world_region', array('entity' => 'address', 'placeholder' => ts('- any -'), 'option_url' => NULL));
+    $form->addSelect('world_region', array('entity' => 'address', 'context' => 'search'));
 
     // select for location type
     $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
@@ -430,7 +432,7 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addRadio('relation_status', ts('Relationship Status'), $relStatusOption);
     $form->setDefaults(array('relation_status' => 0));
     // relation permission
-    $relPermissionOption = array(ts('Any'), ts('Yes'), ts('No') );
+    $relPermissionOption = array(ts('Any'), ts('Yes'), ts('No'));
     $form->addRadio('relation_permission', ts('Permissioned Relationship?'), $relPermissionOption);
     $form->setDefaults(array('relation_permission' => 0));
 
@@ -485,9 +487,8 @@ class CRM_Contact_Form_Search_Criteria {
 
     CRM_Core_Form_Date::buildDateRange($form, 'deceased_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
 
-
     // radio button for is_deceased
-    $form->addYesNo( 'is_deceased', ts('Deceased'), TRUE);
+    $form->addYesNo('is_deceased', ts('Deceased'), TRUE);
   }
 
   /**