Infra 3722 - Fix the ordering on staff page
Added array proxy to allow sorting of staff XML. Used usort to sort
proxied list with strcompare and checking for Mike.
Change-Id: Ib1d9b4e228bf7829d13d69d2cb00740acb8443fd
Signed-off-by: Martin Lowe <martin.lowe@eclipse-foundation.org>
diff --git a/foundation/staff.php b/foundation/staff.php
index 0051995..fa22051 100644
--- a/foundation/staff.php
+++ b/foundation/staff.php
@@ -38,7 +38,25 @@
<?php
// @todo: Create a JS widjet to display staff bio from api.eclipse.org
$staff = simplexml_load_file(dirname(__FILE__) . '/staff.xml');
+ // create proxy to allow sorting
+ $staffProxy = array();
foreach ($staff as $member) {
+ $staffProxy[] = $member;
+ }
+ usort($staffProxy, function($a, $b) {
+ if ($a->name == "Mike Milinkovich") {
+ return -1;
+ } else if ($b->name == "Mike Milinkovich") {
+ return 1;
+ }
+ $aNameParts = explode(' ', $a->name);
+ $aLastName = $aNameParts[count($aNameParts) - 1];
+ $bNameParts = explode(' ', $b->name);
+ $bLastName = $bNameParts[count($bNameParts) - 1];
+ return strcmp($aLastName, $bLastName);
+ });
+ // iterate over proxy rather than raw data
+ foreach ($staffProxy as $member) {
print '<div class="media clearfix">';
print '<div class="col-xs-5 col-sm-4">';
if ($member->image) {