<?php include_once "../model/TrainerModel.php"; include_once "../model/ProjectModel.php"; include_once "../model/TeamModel.php"; include_once "../model/WebFunctions.php"; require_once "../model/AuthenticateSession.php"; // TODO repair pagination $projectPerPage = 4; $content = ""; $trainer_id = $_GET['trainer_id']; $trainer_name = TrainerModel::getTrainer($trainer_id); $totalNumberOfProjects = count(ProjectModel::getTrainerProjects($trainer_id)); $totalNumberOfPages = ceil($totalNumberOfProjects / $projectPerPage); $currentPage = isset($_GET['current_page']) ? (int) $_GET['current_page'] : 1; $startPage = ($currentPage - 1) * $projectPerPage; // set content $listOfProjects = ProjectModel::getTrainerProjectsLimit($trainer_id, $startPage, $projectPerPage); $content = ""; if (count($listOfProjects) == 0) { $content .= " <div class=\"row text-center\">\r\n <div class=\"col-lg-12\">\r\n <p>No projects created</p>\r\n </div>\r\n </div>"; } else { foreach ($listOfProjects as $proj) { $content .= "<div class=\"col-md-3 portfolio-item\">\r\n <a href=\"project-id-" . $proj['project_id'] . "\">\r\n <img class=\"img-responsive\" src=\"images/project.png\" alt=\"\">\r\n </a>\r\n <p style='text-align: center'>\"" . $proj['title'] . "</p>\r\n </div>"; } } $pagination = WebFunctions::pagination($currentPage, $totalNumberOfPages); include_once "../view/profile-trainer.php";
* Created by PhpStorm. * User: nillernoels * Date: 27/12/15 * Time: 13:57 */ require_once "../model/StudentModel.php"; require_once "../model/TrainerModel.php"; if (isset($_POST["user-id"]) && isset($_POST['p_wd'])) { $userID = $_POST["user-id"]; $p_wd = $_POST["p_wd"]; if ($userID == "" || $p_wd == "") { $error = "<div class='alert alert-danger'>Username was not entered correctly - please try again</div>"; include_once "../index.php"; } else { if (isset($_POST['is-trainer']) && $_POST['is-trainer'] == 'true') { $trainer = TrainerModel::getTrainerFromDB($userID, $p_wd); if ($trainer != null) { session_start(); $_SESSION['isTrainer'] = 'true'; $_SESSION['trainer_id'] = $userID; // add user-id to session $_SESSION['name'] = $trainer['name']; // add name to session header("Location: home-trainer"); } else { $error = "<div class='alert alert-danger'>Username or password was not entered correctly - please try again</div>"; include_once "../index.php"; } } else { $student = StudentModel::getStudent($userID, $p_wd); if ($student != null) {
<?php error_reporting(E_ALL); ini_set('display_errors', 1); // include required models require_once "../model/ProjectModel.php"; require_once "../model/ClassModel.php"; require_once "../model/TrainerModel.php"; require_once "../model/StudentModel.php"; require_once "../model/TeamModel.php"; //$var = ClassModel::CreateClass("EPITA MASTERS"); // create new class test $var = TrainerModel::CreateTrainer("Michel Plasse", 1); // test create new trainer //$var = TrainerModel::getLastTrainerID(); // Test latest row insert of trainer //echo $var; $date = '02/07/2016 12:00:00'; // to set deadline - maybe change this but it works -_- $date = preg_replace('#(\\d{2})/(\\d{2})/(\\d{4})\\s(.*)#', '$3-$2-$1 $4', $date); $var = ProjectModel::updateProject("Mor Projektet", "SubjectTest4", $date, 2); //$var = StudentModel::createStudent("newStuden11t", 1); // test create student //$var = TeamModel::createTeam("this is a summary", 1, 2); // test create Team //$var = TeamModel::addStudentToTeam(4,5); // why do we have a Team_id within the Student table?! //$var = TeamModel::removeStudentFromTeam(3,5); //$listOfProjects = ProjectModel::getAllProjects(1);