private function landing() { $factory = new Factory(); if (\Current_User::isLogged()) { if (!\Current_User::allow('tailgate') && !$factory->isStudent(\Current_User::getUsername())) { return $this->notStudentMessage(); } $student = $factory->getCurrentStudent(); if ($student) { // student is logged in and has account return $this->showStatus($student->getId()); } else { // student is logged in but doesn't have an account return $this->createAccount(); } } else { // student is not logged in return $this->newAccountInformation(); } }
private function pickSpot() { $student = StudentFactory::getCurrentStudent(); $student_id = $student->getId(); $lotteryFactory = new Factory(); $spot_id = filter_input(INPUT_POST, 'spotId', FILTER_SANITIZE_NUMBER_INT); $lottery_id = filter_input(INPUT_POST, 'lotteryId', FILTER_SANITIZE_NUMBER_INT); $result = $lotteryFactory->pickSpot($lottery_id, $spot_id); $view = new \View\JsonView(array('success' => $result)); return $view; }