Ejemplo n.º 1
0
 public static function setOrderBy($ArOrderBy = array(), $BoAsc = TRUE)
 {
     if (!empty($ArOrderBy) && is_array($ArOrderBy)) {
         if (empty($BoAsc)) {
             $StSort = 'DESC';
         } else {
             $StSort = 'ASC';
         }
         $ArField = array_keys($ArOrderBy);
         $ArOrderByValidated = array();
         foreach ((array) $ArField as $Table) {
             $StTableAlias = self::FieldTableValidate($Table);
             $StField = addslashes($ArOrderBy[$Table]);
             $ArOrderByValidated[] = "{$StTableAlias}.{$StField}";
         }
         $StOrderBy = implode(', ', $ArOrderByValidated);
         if (!empty($StOrderBy)) {
             self::$StOrderBy = " ORDER BY {$StOrderBy} {$StSort}";
         }
     } else {
         self::$StOrderBy = '';
     }
 }