Пример #1
0
 * Created by PhpStorm.
 * User: rdok
 * Date: 9/26/2014
 * Time: 10:41 AM
 */
require __DIR__ . '/../app/init.php';
$general->loggedOutProtect();
$section = "appointments";
if (isset($_SESSION['success'])) {
    $successMessage[] = $_SESSION['success'];
    unset($_SESSION['success']);
}
if ($user->isTutor()) {
    $pageTitle = "" . $user->getFirstName() . " " . $user->getLastName();
    $appointments = AppointmentFetcher::retrieveAllOfCurrTermsByTutor($user->getId());
    $allReports = ReportFetcher::retrieveAllOfCurrTermsByTutor($user->getId());
    // TODO: add sepearate retrieval function for tutor. currently retrieves all students \/
    $students = AppointmentHasStudentFetcher::retrieveAllOnCurTerm();
} else {
    $pageTitle = "All Tutors";
    $appointments = AppointmentFetcher::retrieveAllOfCurrTerms();
    $allReports = ReportFetcher::retrieveAllOfCurrTerms();
    $students = AppointmentHasStudentFetcher::retrieveAllOnCurTerm();
}
function getStudentsIds($students, $appointmentId)
{
    $studentsIds = "";
    foreach ($students as $student) {
        if (strcmp($student[AppointmentHasStudentFetcher::DB_COLUMN_APPOINTMENT_ID], $appointmentId) === 0) {
            $studentsIds = $student[StudentFetcher::DB_COLUMN_STUDENT_ID] . ", " . $studentsIds;
        }