From: Stéphane Jacob Date: Thu, 21 Aug 2008 14:54:05 +0000 (+0200) Subject: Order educations by graduation year in the database and in the display (Ooops, sorry). X-Git-Tag: xorg/1.0.0~332^2~523 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=22f0a0a857bc6ba3fedb543f580af5bc7a45ab42;p=platal.git Order educations by graduation year in the database and in the display (Ooops, sorry). --- diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 794f746..59ed455 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -87,10 +87,12 @@ class ProfileEdu implements ProfileSetting } static function sortByGradYear($line1, $line2) { - if ($line1['grad_year'] == $line2['grad_year']) { + $a = (int) $line1['grad_year']; + $b = (int) $line2['grad_year']; + if ($a == $b) { return 0; } - return ($line1['grad_year'] < $line2['grad_year']) ? -1 : 1; + return ($a < $b) ? -1 : 1; } public function value(ProfilePage &$page, $field, $value, &$success)