Пример #1
0
 /**
  * returns the highest weight.
  *
  * @param string $daoName full name of the DAO
  * @param array  $fieldValues field => value to be used in the WHERE
  * @param string $weightField field which contains the weight value,
  * defaults to 'weight'
  * @return integer
  */
 static function getMax($daoName, $fieldValues = null, $weightField = 'weight')
 {
     $selectField = "MAX(ROUND({$weightField})) AS max_weight";
     $weightDAO =& CRM_Utils_Weight::query('SELECT', $daoName, $fieldValues, $selectField);
     $weightDAO->fetch();
     if ($weightDAO->max_weight) {
         return $weightDAO->max_weight;
     }
     return 0;
 }