コード例 #1
0
 /**
  * @return null|object|Memorycard
  * get singleton instance
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new Memorycard();
     }
     return self::$instance;
 }
コード例 #2
0
 /**
  * show player details, show achievement and statistic.
  * role: administrator
  * redirected from: Controller.Player.suspend() whatever suspend result
  *                  Controller.Player.reactivate() whatever reactivate result
  */
 public function detail()
 {
     if (Authenticate::is_authorized()) {
         $model_player = Player::getInstance();
         $model_journal = Journal::getInstance();
         $model_achievement = Achievement::getInstance();
         $model_asset = Asset::getInstance();
         $model_material = Material::getInstance();
         $model_employee = Employee::getInstance();
         $model_memorycard = Memorycard::getInstance();
         $id = $this->framework->url->url_part(3);
         $this->framework->view->page = "player";
         $this->framework->view->content = "/backend/pages/player_detail";
         $this->framework->view->player_detail = $model_player->player_detail($id);
         $this->framework->view->player_summary = $model_player->fetch($id);
         $this->framework->view->player_performance = $model_player->performance($id);
         $this->framework->view->player_finance = $model_journal->finance_summaries($id);
         $this->framework->view->player_achievements = $model_achievement->get_achievement($id);
         $this->framework->view->player_assets = $model_asset->get_player_asset($id);
         $this->framework->view->player_employees = $model_employee->get_player_employee($id);
         $this->framework->view->player_materials = $model_material->get_player_material($id);
         $this->framework->view->player_game = $model_memorycard->load_game_data($id);
         $this->framework->view->show("backend/template");
     } else {
         transport("administrator");
     }
 }
コード例 #3
0
 /**
  * role: player
  * @return string
  */
 public function insert_simulation()
 {
     if (Authenticate::is_player()) {
         if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) {
             $this->model_memorycard = Memorycard::getInstance();
             $day = $_POST['day'];
             $served = $_POST['served'];
             $loss = $_POST['loss'];
             $stress = $_POST['stress'];
             $work = $_POST['work'];
             $location = $_POST['location'];
             $popularity = $_POST['popularity'];
             $overview = $_POST['overview'];
             $result = $this->model_memorycard->insert_simulation($day, $served, $loss, $stress, $work, $location, $popularity, $overview);
             $this->model_asset = Asset::getInstance();
             $this->model_asset->increase_depreciation();
             $log = Log::getInstance();
             $log->logging_game_simulation(json_encode(array($day, $served, $loss, $stress, $work, $location, $popularity, $overview)));
             $binding = array("result_var" => "session_ready", "simulation_var" => $result);
             binding_data($binding);
         } else {
             transport("error404");
         }
     } else {
         $binding = array("result_var" => "no_session");
         binding_data($binding);
     }
 }