コード例 #1
0
ファイル: Login.php プロジェクト: roderm/mkn151
 /**
  * Logout User and Send Url for redirect
  */
 public function logout()
 {
     if (isset($_SESSION['gameID']) && $_SESSION['gameID'] != 0) {
         include_once 'controller/Gamer.php';
         $gamer = new Gamer();
         $gamer->EndGame();
     }
     session_destroy();
     return json_encode(array("uri" => Uri::getAction('Login', 'getMain')));
 }
コード例 #2
0
ファイル: Admin.php プロジェクト: roderm/mkn151
 /**
  * Returns Main-Page from the Admin-Section as HTML-View
  * @return string
  */
 public function getMain()
 {
     include_once 'classes/person.php';
     if (person::getPermissionName() != 'admin') {
         $login = Uri::getAction('Login');
         header("Location: {$login}");
     } else {
         require 'classes/view.php';
         require './models/admin.php';
         $view = new view();
         return $view->loadTemplate(new admin_model());
     }
 }
コード例 #3
0
ファイル: Gamer.php プロジェクト: roderm/mkn151
 /**
  * Return Gamer-Main-Page as HTML-View
  */
 public function getMain()
 {
     if (person::getPermissionName() != 'admin' && person::getPermissionName() != 'gameuser') {
         $login = Uri::getAction('Login');
         header("Location: {$login}");
     } else {
         require 'classes/view.php';
         $model = new stdClass();
         $model->template = 'game/main';
         $model->hasFrage = isset($_SESSION['tmpFrage']['id']);
         $model->user = $_SESSION['username'];
         $model->points = 0;
         $model->message = $model->hasFrage ? 'Welcome back' : 'Welcome';
         $view = new view();
         return $view->loadTemplate($model);
     }
 }