예제 #1
0
파일: index.php 프로젝트: stevenimle/GMA
     }
     return $chapter->toArray();
 });
 $router->map("GET", "/organization/[i:id]/chapter/[i:cid]/user/", function ($id, $cid) use($_pdo) {
     $org = \FMA\Organization\GreekOrganization::find($_pdo, $id);
     if (is_null($org)) {
         return ["err" => true, "msg" => "No organization by that id."];
     }
     $chapter = \FMA\Organization\Chapter::find($_pdo, $cid);
     if (is_null($chapter)) {
         return ["err" => true, "msg" => "No chapter by that id."];
     }
     if ($chapter->getGreekOrganizationId() != $org->getId()) {
         return ["err" => true, "msg" => "Organization has no chapter by that id."];
     }
     return \FMA\User\User::findAllForChapterAsArray($_pdo, $chapter);
 });
 $router->map("GET", "/organization/[i:id]/chapter/[i:cid]/user/[i:uid]/", function ($id, $cid, $uid) use($_pdo) {
     $org = \FMA\Organization\GreekOrganization::find($_pdo, $id);
     if (is_null($org)) {
         return ["err" => true, "msg" => "No organization by that id."];
     }
     $chapter = \FMA\Organization\Chapter::find($_pdo, $cid);
     if (is_null($chapter)) {
         return ["err" => true, "msg" => "No chapter by that id."];
     }
     if ($chapter->getGreekOrganizationId() != $org->getId()) {
         return ["err" => true, "msg" => "Organization has no chapter by that id."];
     }
     $user = \FMA\User\User::find($_pdo, $uid);
     if (is_null($user)) {