Example #1
0
 public function PlayerPayments($player = 0)
 {
     $this->template->setData("SelectedTab", "Connected players");
     // Find the player
     $this->Player = new Account($player);
     // Make sure the player exists
     if (!$this->Player->exists()) {
         Session::GoBack("Player could not be found.");
     }
     // Make sure manager is related to this player
     if (!Player_Manager::isRelatedTo($this->Player->id, Auth::Get("id"))) {
         Session::GoBack("You are not related to this player.");
     }
     // Get Payments
     $this->Payments = $this->Player->payments->include_related("fixture", array("id", "location"))->include_related("game_block", array("time"))->where(array("fixtures.owner" => Auth::Get("id")))->order_by("id", "DESC")->get_iterated();
     $this->load->view("manager/PlayerPayments");
 }
Example #2
0
 public function enter($player = 0, $block = 0)
 {
     Auth::RequireManager();
     $this->Block = new Game_Block($block);
     if (!$this->Block->exists()) {
         Session::GoBack("Game could not be found.");
     }
     // Try Getting Fixture
     if (!$this->Block->fixture->get()->exists()) {
         Session::GoBack("Fixture could not be found.");
     }
     if ($this->Block->fixture->owner != Auth::Get("id")) {
         Session::GoBack("You cannot manage this block.");
     }
     $this->Account = new Account($player);
     if (!$this->Account->exists()) {
         Session::GoBack("Player could not be found.");
     }
     if (!$this->Block->is_related_to($this->Account)) {
         Session::GoBack("This player is not playing in this game.");
     }
     // Check the limit of this block
     $this->PlayersCount = $this->Block->account->include_join_fields()->where(array("active" => 1))->count();
     if ($this->PlayersCount >= (int) $this->Block->fixture->type * 2) {
         Session::GoBack("This game is already full!");
     }
     $this->Block->set_join_field($this->Account, "active", 1);
     Session::GoBack("Player has joined.");
 }