<?php require __DIR__ . '/../app/init.php'; $general->loggedOutProtect(); // redirect if user elevation is not that of secretary or admin if ($user->isTutor()) { header('Location: ' . BASE_URL . "error-403"); exit; } function is_create_bttn_Pressed() { return isset($_POST['hidden_submit_pressed']) && empty($_POST['hidden_submit_pressed']); } try { $majors = MajorFetcher::retrieveMajorsToEdit(); if (isBtnUpdatePrsd()) { $updateDone = false; $majorId = trim($_POST['updateMajorIdModal']); $newMajorCode = trim($_POST['majorCodeUpdate']); $newMajorName = trim($_POST['majorNameUpdate']); $updateDone = false; if (($major = getMajor($majorId, $majors)) !== false) { $oldMajorCodeName = $major[MajorFetcher::DB_COLUMN_CODE]; $oldMajorName = $major[MajorFetcher::DB_COLUMN_NAME]; if (strcmp($newMajorName, $oldMajorName) !== 0) { $updateDone = true; Major::updateName($majorId, $newMajorName); } if (strcmp($newMajorCode, $oldMajorCodeName) !== 0) { $updateDone = true; Major::updateCode($majorId, $newMajorCode);
<?php require __DIR__ . '/../app/init.php'; $general->loggedOutProtect(); // redirect if user elevation is not that of secretary or tutor if (!$user->isAdmin()) { header('Location: ' . BASE_URL . "error-403"); exit; } try { $courses = CourseFetcher::retrieveAll(); $majors = MajorFetcher::retrieveMajors(); $terms = TermFetcher::retrieveCurrTerm(); //$majors = array_unique(array_column($courses, 'Major')); //$majors_extensions = array_unique(array_column($courses, 'Extension')); } catch (Exception $e) { $errors[] = $e->getMessage(); } function is_create_bttn_Pressed() { return isset($_POST['hidden_submit_pressed']) && empty($_POST['hidden_submit_pressed']); } if (isSaveBttnPressed()) { $first_name = trim($_POST['first_name']); $last_name = trim($_POST['last_name']); $email = trim($_POST['email']); $user_type = trim($_POST['user_type']); $userMajorId = isset($_POST['userMajor']) ? trim($_POST['userMajor']) : ""; $teachingCoursesIds = isset($_POST['teachingCoursesMulti']) ? $_POST['teachingCoursesMulti'] : null; $termIds = isset($_POST['termIds']) ? $_POST['termIds'] : null; try {
public static function delete($id) { self::validateId($id); MajorFetcher::delete($id); }