/**
  * sub-function to sort an array
  *
  * @param	array	$a
  * @param	array	$b
  *
  * @return	boolean	true on success / false on error
  * @static
  * 
  */
 public static function sort_func($a, $b)
 {
     global $array_sortby, $array_sortorder;
     // this comparison should give optimal results if
     // locale is provided and mb string functions are supported
     if ($array_sortorder == "asc") {
         return ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
     }
     if ($array_sortorder == "desc") {
         return !ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
         return strcoll(ilStr::strToUpper($b[$array_sortby]), ilStr::strToUpper($a[$array_sortby]));
     }
 }
 /**
  * Compare two strings
  */
 function strCmp($a, $b)
 {
     global $ilCollator;
     if (is_object($ilCollator)) {
         return $ilCollator->compare(ilStr::strToUpper($a), ilStr::strToUpper($b)) > 0;
     } else {
         return strcoll(ilStr::strToUpper($a), ilStr::strToUpper($b)) > 0;
     }
 }
Beispiel #3
0
 /**
  * sub-function to sort an array
  *
  * @param	array	$a
  * @param	array	$b
  *
  * @return	boolean	true on success / false on error
  * @static
  * 
  */
 public static function sort_func($a, $b)
 {
     global $array_sortby, $array_sortorder;
     if (!isset($array_sortby)) {
         // occured in: setup -> new client -> install languages -> sorting of languages
         $array_sortby = 0;
     }
     // this comparison should give optimal results if
     // locale is provided and mb string functions are supported
     if ($array_sortorder == "asc") {
         return ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
     }
     if ($array_sortorder == "desc") {
         return !ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
         return strcoll(ilStr::strToUpper($b[$array_sortby]), ilStr::strToUpper($a[$array_sortby]));
     }
 }