Example #1
0
 public function deleteTeam($id)
 {
     Flight::auth()->check(20);
     $team = Flight::teams()->getTeamWithId($id);
     $team->delete();
     Flight::redirect('/teams');
 }
Example #2
0
 public function showEvent($id)
 {
     Flight::auth()->check();
     $event = Flight::events()->getEventWithId($id);
     $team = Flight::teams()->getTeamWithId($event->team);
     Flight::util()->render('event', array("event" => $event, "team" => $team));
 }
Example #3
0
 public function showNewAbsence($team, $event)
 {
     if ($event != null) {
         $event = Flight::events()->getEventWithId($event);
     }
     $team = Flight::teams()->getTeamWithId($team);
     Flight::util()->render('newAbsence', array('team' => $team, 'event' => $event));
 }
Example #4
0
 public function register()
 {
     Flight::auth()->check(20);
     $response = Flight::util()->validate("user", Flight::request()->data);
     if (is_array($response)) {
         Flight::util()->render('newUser', array('error' => $response, "teams" => Flight::teams()->getAllTeams()));
         return;
     }
     $data = Flight::request()->data;
     $user = new user($data);
     $user->teams = Flight::request()->data->teams;
     $user->store();
     Flight::redirect("/createUser");
 }
Example #5
0
 public function getTeams()
 {
     if ($this->role == 20) {
         $this->teams = Flight::teams()->getAllTeams();
         return $this->teams;
     }
     $sql = "SELECT team.* FROM team, coach_team WHERE team.id = coach_team.team_id AND coach_team.coach_id = '{$this->id}'";
     $result = Flight::db()->query($sql);
     $this->teams = array();
     if ($result == false) {
         return $this->teams;
     } else {
         while ($row = $result->fetch_assoc()) {
             $this->teams[] = new team($row);
         }
         return $this->teams;
     }
 }
Example #6
0
 public function showUpdatePlayer($id)
 {
     Flight::auth()->check();
     Flight::util()->render('editPlayer', array('player' => Flight::players()->getPlayerWithId($id), 'teams' => Flight::teams()->getAllTeams()));
 }
Example #7
0
  <?php 
if (count($players) > 0) {
    ?>
    <table class='table'>
    <tr><th>Forename</th><th>Surname</th><th>Team</th><th>Detail</th></tr>
    <?php 
    foreach ($players as $player) {
        ?>
      <tr></td><td><?php 
        echo $player->forename;
        ?>
</td><td><?php 
        echo $player->surname;
        ?>
</td><td><?php 
        echo Flight::teams()->getTeamNameWithId($player->team);
        ?>
</td><td><a href='<?php 
        Flight::link('/player/' . $player->id);
        ?>
'>View Details</a></tr>
      <?php 
    }
    ?>
    </table>
    <?php 
} else {
    ?>
      <h5>No Players in this Team <a href="<?php 
    Flight::link('/asignPlayer');
    ?>
Example #8
0
 public function showNewUser()
 {
     Flight::auth()->check(20);
     Flight::util()->render('newUser', array("teams" => Flight::teams()->getAllTeams()));
 }