Merge pull request #5513 from mallezie/contact-select-file-16178
[civicrm-core.git] / CRM / Utils / Weight.php
index aebc9a9695a30c1a408b38bc0d61512469174e76..0ce6c2a61da45aa744c3ab93ec86043c8048fcbf 100644 (file)
@@ -3,7 +3,7 @@
   +--------------------------------------------------------------------+
   | CiviCRM version 4.6                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2014                                |
+  | Copyright CiviCRM LLC (c) 2004-2015                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
@@ -23,7 +23,7 @@
   | GNU Affero General Public License or the licensing of CiviCRM,     |
   | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
   +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * Class CRM_Utils_Weight
@@ -199,7 +199,7 @@ class CRM_Utils_Weight {
    * @param string $weightField
    *   Field which used to get the wt, default to 'weight'.
    *
-   * @return integer
+   * @return int
    */
   public static function getNewWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
     $selectField = "id AS fieldID, $weightField AS weight";
@@ -241,7 +241,7 @@ class CRM_Utils_Weight {
    *   Field which contains the weight value,.
    *   defaults to 'weight'
    *
-   * @return integer
+   * @return int
    */
   public static function getMax($daoName, $fieldValues = NULL, $weightField = 'weight') {
     $selectField = "MAX(ROUND($weightField)) AS max_weight";
@@ -264,7 +264,7 @@ class CRM_Utils_Weight {
    *   Field which contains the weight value,.
    *   defaults to 'weight'
    *
-   * @return integer
+   * @return int
    */
   public static function getDefaultWeight($daoName, $fieldValues = NULL, $weightField = 'weight') {
     $maxWeight = CRM_Utils_Weight::getMax($daoName, $fieldValues, $weightField);
@@ -291,7 +291,7 @@ class CRM_Utils_Weight {
    * @return CRM_Core_DAO
    *   objet that holds the results of the query
    */
-  static function &query(
+  public static function &query(
     $queryType,
     $daoName,
     $fieldValues = NULL,
@@ -303,7 +303,7 @@ class CRM_Utils_Weight {
 
     require_once str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php";
 
-    $dao = new $daoName;
+    $dao = new $daoName();
     $table = $dao->getTablename();
     $fields = &$dao->fields();
     $fieldlist = array_keys($fields);
@@ -514,4 +514,5 @@ class CRM_Utils_Weight {
       'userContext' => $url,
     ));
   }
+
 }