Example #1
0
 public static function updateEndingDate($id, $newEndingDate, $oldEndingDate)
 {
     if (strcmp($newEndingDate, $oldEndingDate) === 0) {
         return false;
     }
     Dates::initDateTime($newEndingDate, $oldEndingDate);
     ScheduleFetcher::updateSingleColumn($id, ScheduleFetcher::DB_COLUMN_END_TIME, $newEndingDate, PDO::PARAM_STR);
     return true;
 }
Example #2
0
 /**
  * Add a new appointment to data set.
  *
  * @param $user
  * @param $dateStart
  * @param $dateEnd
  * @param $courseId
  * @param $studentsIds
  * @param $tutorId
  * @param $instructorsIds
  * @param $termId
  * @param $secretaryName
  * @throws Exception
  */
 public static function add($user, $dateStart, $dateEnd, $courseId, $studentsIds, $tutorId, $instructorsIds, $termId, $secretaryName)
 {
     $dateStart = Dates::initDateTime($dateStart);
     $dateEnd = Dates::initDateTime($dateEnd);
     Course::validateId($courseId);
     if (sizeof($studentsIds) != sizeof($instructorsIds)) {
         throw new Exception("An instructor is required for each student.");
     }
     Student::validateIds($studentsIds);
     Instructor::validateIds($instructorsIds);
     Tutor::validateId($tutorId);
     Term::validateId($termId);
     self::validateNewDates($user, $termId, $tutorId, $dateStart, $dateEnd);
     AppointmentFetcher::insert($dateStart, $dateEnd, $courseId, $studentsIds, $tutorId, $instructorsIds, $termId);
     header('Location: ' . BASE_URL . 'appointments/add/success');
     exit;
 }