public function Index() { if (CommonController::IsAuthentified()) { $data = array($_SESSION['id']); $WSCtrl = new WebServicesController(); $userResponse = $WSCtrl->Call("User", "GET", $data); $user = json_decode($userResponse, true); $collectionCtrl = new CollectionController(); $data = array('user' => $user, 'url' => array('newCollection' => CommonController::GetLink("Collection", "Create"), 'displayCollection' => CommonController::GetLink("Collection"), 'signUp' => CommonController::GetLink("Login", "SignIn")), 'collections' => $collectionCtrl->GetPrivateCollections()); CommonController::SetView("home", "index", $data); } else { CommonController::Redirect("Login"); } }
public static function IsAuthentified() { $WebSevCtrl = new WebServicesController(); return $WebSevCtrl->Call('Login') === 'true'; }
public function GetCollection($id) { if (CommonController::IsAuthentified()) { $wSCtrl = new WebServicesController(); $response = $wSCtrl->Call("Collection", "GET", ["id" => $id]); return json_decode($response, true); } return null; }
<?php /** * Created by PhpStorm. * User: Arthur * Date: 01/10/2015 * Time: 17:27 */ require_once __DIR__ . '/bootstrap.php'; use src\controllers\CommonController; use src\controllers\WebServicesController; use src\webServices; $WSCtrl = new WebServicesController(); $uri = CommonController::GetCurrentUri(); $explodedUri = preg_split('@/@', CommonController::GetCurrentUri(), NULL, PREG_SPLIT_NO_EMPTY); echo $WSCtrl->Process($explodedUri[1]);