From: Stéphane Jacob Date: Thu, 21 Aug 2008 13:42:37 +0000 (+0200) Subject: Order educations by graduation year in the database and in the display. X-Git-Tag: xorg/1.0.0~332^2~524 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5ba8842e53f30b01e215b8af3b5001e20ef584cd;p=platal.git Order educations by graduation year in the database and in the display. --- diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 0c4191b..794f746 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -86,6 +86,13 @@ class ProfileEdu implements ProfileSetting { } + static function sortByGradYear($line1, $line2) { + if ($line1['grad_year'] == $line2['grad_year']) { + return 0; + } + return ($line1['grad_year'] < $line2['grad_year']) ? -1 : 1; + } + public function value(ProfilePage &$page, $field, $value, &$success) { $success = true; @@ -113,6 +120,7 @@ class ProfileEdu implements ProfileSetting } $i++; } + usort($value, array("ProfileEdu", "sortByGradYear")); } return $value; }