<?php include_once "../model/StudentModel.php"; include_once "../model/ProjectModel.php"; include_once "../model/TeamModel.php"; include_once "../model/WebFunctions.php"; require_once "../model/AuthenticateSession.php"; // TODO repair pagination $teamsPerPage = 4; $content = ""; $student_id = $_GET['student_id']; $student_name = StudentModel::getStudentById($student_id); $totalNumberOfTeams = count(TeamModel::getStudentTeams($student_id)); $totalNumberOfPages = ceil($totalNumberOfTeams / $teamsPerPage); $currentPage = isset($_GET['current_page']) ? (int) $_GET['current_page'] : 1; $startPage = ($currentPage - 1) * $teamsPerPage; // set content $listOfTeams = TeamModel::getStudentTeams($student_id, $startPage, $teamsPerPage); $content = ""; if (count($listOfTeams) == 0) { $content .= " <div class=\"row text-center\">\r\n <div class=\"col-lg-12\">\r\n <p>No teams attended</p>\r\n </div>\r\n </div>"; } else { for ($int = 0; $int < count($listOfTeams); $int++) { $teamID = $listOfTeams[$int]['team_id']; $content .= "<div class=\"col-md-3 portfolio-item\">\r\n <a href=\"team-id-{$teamID}\">\r\n <img class=\"img-responsive\" src=\"images/team.jpg\" alt=\"\">\r\n </a>\r\n <p style='text-align: center'>Team {$teamID}</p>\r\n </div>"; } } $pagination = WebFunctions::pagination($currentPage, $totalNumberOfPages); include_once "../view/profile-student.php";