From 5ba8842e53f30b01e215b8af3b5001e20ef584cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 21 Aug 2008 15:42:37 +0200 Subject: [PATCH] Order educations by graduation year in the database and in the display. --- modules/profile/general.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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; } -- 2.1.4