/**
  * Returns the list of coders of the month
  *
  * @param Request $r
  */
 public static function apiCoderOfTheMonthList(Request $r)
 {
     $response = array();
     $response['coders'] = array();
     try {
         $coders = CoderOfTheMonthDAO::getAll(null, null, 'time', 'DESC');
         foreach ($coders as $c) {
             $user = UsersDAO::getByPK($c->user_id);
             $email = EmailsDAO::getByPK($user->getMainEmailId());
             $response['coders'][] = array('username' => $user->getUsername(), 'gravatar_32' => 'https://secure.gravatar.com/avatar/' . md5($email->getEmail()) . '?s=32', 'date' => $c->getTime());
         }
     } catch (Exception $ex) {
         throw new InvalidDatabaseOperationException($e);
     }
     $response['status'] = 'ok';
     return $response;
 }
Example #2
0
 /**
  * Returns the list of coders of the month
  *
  * @param Request $r
  */
 public static function apiCoderOfTheMonthList(Request $r)
 {
     $response = array();
     $response["coders"] = array();
     try {
         $coders = CoderOfTheMonthDAO::getAll(null, null, "time", "DESC");
         foreach ($coders as $c) {
             $user = UsersDAO::getByPK($c->user_id);
             $email = EmailsDAO::getByPK($user->getMainEmailId());
             $response["coders"][] = array("username" => $user->getUsername(), "gravatar_32" => "https://secure.gravatar.com/avatar/" . md5($email->getEmail()) . "?s=32", "date" => $c->getTime());
         }
     } catch (Exception $ex) {
         throw new InvalidDatabaseOperationException($e);
     }
     $response["status"] = "ok";
     return $response;
 }