Merge pull request #4087 from robinmitra/master
[civicrm-core.git] / CRM / Utils / Sort.php
index 7c93a5832dc497791cea78f4354e73c0d0ac8955..a01157c9656ea4c588d49fd50dc548281dc222ee 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | 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.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
  * if introducing additional functionality
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
 class CRM_Utils_Sort {
 
   /**
-   * constants to determine what direction each variable
+   * Constants to determine what direction each variable
    * is to be sorted
    *
    * @var int
@@ -56,27 +56,27 @@ class CRM_Utils_Sort {
   CONST ASCENDING = 1, DESCENDING = 2, DONTCARE = 4,
 
   /**
-   * the name for the sort GET/POST param
+   * The name for the sort GET/POST param
    *
    * @var string
    */
   SORT_ID = 'crmSID', SORT_DIRECTION = 'crmSortDirection', SORT_ORDER = 'crmSortOrder';
 
   /**
-   * name of the sort function. Used to isolate session variables
+   * Name of the sort function. Used to isolate session variables
    * @var string
    */
   protected $_name;
 
   /**
-   * array of variables that influence the query
+   * Array of variables that influence the query
    *
    * @var array
    */
   public $_vars;
 
   /**
-   * the newly formulated base url to be used as links
+   * The newly formulated base url to be used as links
    * for various table elements
    *
    * @var string
@@ -84,7 +84,7 @@ class CRM_Utils_Sort {
   protected $_link;
 
   /**
-   * what's the name of the sort variable in a REQUEST
+   * What's the name of the sort variable in a REQUEST
    *
    * @var string
    */
@@ -116,11 +116,11 @@ class CRM_Utils_Sort {
    * key names of variable (which should be the same as the column name)
    * value: ascending or descending
    *
-   * @param mixed  $vars             - assoc array as described above
+   * @param mixed $vars - assoc array as described above
    * @param string $defaultSortOrder - order to sort
    *
-   * @return void
-   * @access public
+   * @return \CRM_Utils_Sort
+  @access public
    */
   function __construct(&$vars, $defaultSortOrder = NULL) {
     $this->_vars = array();
@@ -139,7 +139,7 @@ class CRM_Utils_Sort {
       $this->_currentSortDirection = $this->_vars[$this->_currentSortID]['direction'];
     }
     $this->_urlVar = self::SORT_ID;
-    $this->_link = CRM_Utils_System::makeURL($this->_urlVar);
+    $this->_link = CRM_Utils_System::makeURL($this->_urlVar, TRUE);
 
     $this->initialize($defaultSortOrder);
   }
@@ -168,7 +168,7 @@ class CRM_Utils_Sort {
   }
 
   /**
-   * create the sortID string to be used in the GET param
+   * Create the sortID string to be used in the GET param
    *
    * @param int $index the field index
    * @param int $dir   the direction of the sort
@@ -182,7 +182,7 @@ class CRM_Utils_Sort {
   }
 
   /**
-   * init the sort ID values in the object
+   * Init the sort ID values in the object
    *
    * @param string $defaultSortOrder the sort order to use by default
    *
@@ -219,7 +219,7 @@ class CRM_Utils_Sort {
   }
 
   /**
-   * init the object
+   * Init the object
    *
    * @param string $defaultSortOrder the sort order to use by default
    *
@@ -255,7 +255,7 @@ class CRM_Utils_Sort {
   }
 
   /**
-   * getter for currentSortID
+   * Getter for currentSortID
    *
    * @return int returns of the current sort id
    * @acccess public
@@ -265,7 +265,7 @@ class CRM_Utils_Sort {
   }
 
   /**
-   * getter for currentSortDirection
+   * Getter for currentSortDirection
    *
    * @return int returns of the current sort direction
    * @acccess public
@@ -277,6 +277,9 @@ class CRM_Utils_Sort {
   /**
    * Universal callback function for sorting by weight
    *
+   * @param $a
+   * @param $b
+   *
    * @return array of items sorted by weight
    * @access public
    */