public function showTeam($id) { $team = TeamModel::getTeamById($id); if (empty($team)) { return View::make('error', array('error' => 'Team not found!')); } $teamMatches = MatchModel::getTeamMatches($id); return View::make('team', array('team' => $team, 'matches' => $teamMatches)); }
public function getTeam($id) { $team = TeamModel::getTeamById($id); if (empty($team)) { return array('error' => 'Team not found!'); } $teamMatches = MatchModel::getTeamMatches($id); return array('team' => $team[0], 'matches' => $teamMatches); }
<?php include_once "../model/TeamModel.php"; include_once "../model/WebFunctions.php"; include_once "../model/ProjectModel.php"; require_once "../model/AuthenticateSession.php"; $teamId = $_GET['team_id']; $team = TeamModel::getTeamById($teamId); $projectID = $team['project_id']; $classID = ProjectModel::getProjectClassById($projectID); $listOfAvailableStudents = ProjectModel::getFreeStudents($classID); $listOfTeamMembers = TeamModel::getTeamStudents($teamId); $table1 = ""; // table 1 - available students $table2 = ""; // table 2 - students already in team $summary = $team['summary']; $creatorId = $team['creator_id']; if (count($listOfAvailableStudents) > 0) { for ($int = 0; $int < count($listOfAvailableStudents); $int++) { $table1 .= "<li id='" . $listOfAvailableStudents[$int]['student_id'] . "'class=\"list-group-item ui-state-default hand-cursor\">" . $listOfAvailableStudents[$int]['name'] . "</li>"; // table 1 - available students } } if (count($listOfTeamMembers) > 0) { for ($int = 0; $int < count($listOfTeamMembers); $int++) { // table 2 - current students in team if ($listOfTeamMembers[$int]['student_id'] == $creatorId) { $table2 .= "<li id='" . $listOfTeamMembers[$int]['student_id'] . "' class=\"list-group-item ui-state-default ui-state-disabled\">" . $listOfTeamMembers[$int]['name'] . "<span class=\"badge\">Owner</span>" . "</li>"; } else { $table2 .= "<li id='" . $listOfTeamMembers[$int]['student_id'] . "' class=\"list-group-item ui-state-default hand-cursor\">" . $listOfTeamMembers[$int]['name'] . "</li>";
<?php include_once "../model/TeamModel.php"; include_once "../model/WebFunctions.php"; require_once "../model/AuthenticateSession.php"; $id = $_GET['team_id']; $team = TeamModel::getTeamById($id); $listOfStudents = TeamModel::getTeamStudents($id); $project_id = $team["project_id"]; $content = ""; foreach ($listOfStudents as $student) { $content .= "<a href=\"student-id-" . $student['student_id'] . "\">" . $student['name'] . " <br> </a>"; } // Check right of the user for editing the team session_start(); if (array_key_exists('student_id', $_SESSION) and $team['creator_id'] == $_SESSION['student_id']) { $edit_button = "<a href=\"team-edit-{$id}\">\r\n\t\t<button type=\"button\" class=\"btn btn-default\">\tEdit team </button> </a>"; } else { $edit_button = "<button type=\"button\" class=\"btn btn-default\" disabled>\tEdit team </button>"; } // add view include_once "../view/team-detail.php";