Merge pull request #3811 from colemanw/dynPath
[civicrm-core.git] / CRM / Profile / Page / Listings.php
index f25f6bbdf83d8b1e28e98913ca0658b7a82d07dd..a505ec9b22eb6839b07e3d017fa9cd3da199d571 100644 (file)
@@ -2,9 +2,9 @@
 
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -29,7 +29,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -157,7 +157,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     );
 
     foreach ($this->_fields as $name => $field) {
-      if ((substr($name, 0, 6) == 'custom') && CRM_Utils_Array::value('is_search_range', $field)) {
+      if ((substr($name, 0, 6) == 'custom') && !empty($field['is_search_range'])) {
         $from = CRM_Utils_Request::retrieve($name . '_from', 'String',
           $this, FALSE, NULL, 'REQUEST'
         );
@@ -227,7 +227,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
 
       $customField = CRM_Utils_Array::value($name, $this->_customFields);
 
-      if (!empty($_POST) && !CRM_Utils_Array::value($name, $_POST)) {
+      if (!empty($_POST) && empty($_POST[$name])) {
         if ($customField) {
           // reset checkbox/radio because a form does not send null checkbox values
           if (in_array($customField['html_type'],
@@ -327,9 +327,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     $this->assign('search', $this->_search);
 
     // search if search returned a form error?
-    if ((!CRM_Utils_Array::value('reset', $_GET) ||
-        CRM_Utils_Array::value('force', $_GET)
-      ) &&
+    if ((empty($_GET['reset']) || !empty($_GET['force'])) &&
       !$searchError
     ) {
       $this->assign('isReset', FALSE);
@@ -359,7 +357,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
           )
         );
       }
-      if (CRM_Utils_Array::value('group', $this->_params)) {
+      if (!empty($this->_params['group'])) {
         foreach ($this->_params['group'] as $key => $val) {
           if (!$val) {
             unset($this->_params['group'][$key]);
@@ -402,7 +400,10 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
   /**
    * Function to get the list of contacts for a profile
    *
-   * @param $form object
+   * @param $gid
+   *
+   * @return array
+   * @internal param object $form
    *
    * @access public
    */
@@ -423,7 +424,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
 
     // add group id to params if a uf group belong to a any group
     if ($groupId) {
-      if (CRM_Utils_Array::value('group', $params)) {
+      if (!empty($params['group'])) {
         $params['group'][$groupId] = 1;
       }
       else {
@@ -458,6 +459,11 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     return $contactIds;
   }
 
+  /**
+   * @param string $suffix
+   *
+   * @return null|string
+   */
   function checkTemplateFileExists($suffix = '') {
     if ($this->_gid) {
       $templateFile = "CRM/Profile/Page/{$this->_gid}/Listings.{$suffix}tpl";
@@ -478,11 +484,30 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page {
     return NULL;
   }
 
+  /**
+   * Use the form name to create the tpl file name
+   *
+   * @return string
+   * @access public
+   */
+  /**
+   * @return string
+   */
   function getTemplateFileName() {
     $fileName = $this->checkTemplateFileExists();
     return $fileName ? $fileName : parent::getTemplateFileName();
   }
 
+  /**
+   * Default extra tpl file basically just replaces .tpl with .extra.tpl
+   * i.e. we dont override
+   *
+   * @return string
+   * @access public
+   */
+  /**
+   * @return string
+   */
   function overrideExtraTemplateFileName() {
     $fileName = $this->checkTemplateFileExists('extra.');
     return $fileName ? $fileName : parent::overrideExtraTemplateFileName();