/** * Function to sort users after getting the list in the DB. * Necessary because there are 2 or 3 queries. Called by usort() */ function sort_users($user_a, $user_b) { if (api_sort_by_first_name()) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } }
/** * Function to sort users after getting the list in the DB. * Necessary because there are 2 or 3 queries. Called by usort() */ function sort_users($user_a, $user_b) { $orderListByOfficialCode = api_get_setting('platform.order_user_list_by_official_code'); if ($orderListByOfficialCode === 'true') { $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } if (api_sort_by_first_name()) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } }
/** * Function to sort users after getting the list in the DB. * Necessary because there are 2 or 3 queries. Called by usort() */ function sort_users($user_a, $user_b) { global $_configuration; if (isset($_configuration['order_user_list_by_official_code']) && $_configuration['order_user_list_by_official_code']) { $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } if (api_sort_by_first_name()) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } }
public function sort_by_first_name($item1, $item2) { return api_strcmp($item1[3], $item2[3]); }
function sort_by_user($item1, $item2) { $user1 = $item1['user']; $user2 = $item2['user']; if (api_sort_by_first_name()) { $result = api_strcmp($user1['firstname'], $user2['firstname']); if ($result == 0) { return api_strcmp($user1['lastname'], $user2['lastname']); } } else { $result = api_strcmp($user1['lastname'], $user2['lastname']); if ($result == 0) { return api_strcmp($user1['firstname'], $user2['firstname']); } } return $result; }
/** * Performs string comparison, case insensitive, language sensitive, with extended multibyte support. * @param string $string1 The first string. * @param string $string2 The second string. * @param string $language (optional) The language in which comparison is to be made. If language is omitted, interface language is assumed then. * @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default. * @return int Returns < 0 if $string1 is less than $string2; > 0 if $string1 is greater than $string2; and 0 if the strings are equal. * This function is aimed at replacing the function strcasecmp() for human-language strings. * @link http://php.net/manual/en/function.strcasecmp */ function api_strcasecmp($string1, $string2, $language = null, $encoding = null) { return api_strcmp(api_strtolower($string1, $encoding), api_strtolower($string2, $encoding), $language, $encoding); }
function rsort_users($a, $b) { return api_strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); }
function sort_by_description($item1, $item2) { $result = api_strcmp($item1->get_description(), $item2->get_description()); if ($result == 0) { return $this->sort_by_name($item1, $item2); } return $result; }
function sort_by_first_name($item1, $item2) { return api_strcmp($item1['firstname'], $item2['firstname']); }