die; } $navbar_signup_login = ""; $header_tag_extras = ""; $header_section_styles = ""; $header_section_metas = ""; $header_section_scripts = ""; $header_section_extras = ""; $body_tag_extras = ""; $body_section_styles = ""; $body_section_scripts = ""; require '../database/models.php'; $loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']); $logged_in_name = "Welcome " . $loggedin_user_info['name']; $result_allcourses = getAllCoursesByManagerID($_SESSION['user_id']); $result_derpartment = getDepartmentByManagerID($_SESSION['user_id']); $department_progress = getAvgDepartmentProgess($result_derpartment['ID']); $body_section_content = '<h1>List of Courses in ' . $result_derpartment['name'] . ' Department</h1> <p>The progress of the department: <progress value="' . $department_progress . '" max="1"></progress></p>'; $body_section_content .= '<ol>'; foreach ($result_allcourses as $val) { $progress = 6 - getCourseProgress($val['ID']); $missing_files = getTypesOfMissingFiles($val['ID']); $body_section_content .= '<li><a href="course.php?page_course_id=' . $val['ID'] . '">' . $val['name'] . '</a> <progress value="' . $progress . '" max="6"></progress> <p> Missing files: '; if (count($missing_files) == 6) { $body_section_content .= ' ALL FILES ARE MISSING!!'; } else { foreach ($missing_files as $file) { $body_section_content .= str_replace("_", " ", $file) . ' --- '; }
<?php session_start(); if (!isset($_SESSION['user_id']) || strcmp($_SESSION['type'], 'department_manager') != 0) { // redirect unauthorized user at once to homepage header('Location: http://localhost/qa/index.php'); die; } require '../database/models.php'; $loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']); $logged_in_name = "Welcome " . $loggedin_user_info['name']; // check if form submitted if (isset($_POST['code']) && isset($_POST['name']) && isset($_POST['semester']) && isset($_POST['year']) && isset($_POST['instructor'])) { $department = getDepartmentByManagerID($_SESSION['user_id']); if ($department == false) { die('D\'oh!'); } if (!checkCourseCodeExists($_POST['code'], $_POST['semester'], substr($_POST['year'], 0, 4))) { if (insertCourse($_POST['code'], $_POST['name'], $_POST['semester'], substr($_POST['year'], 0, 4), $_POST['instructor'], $department['ID'])) { // create directory for course uploads if (!file_exists('../uploads/' . $_POST['code'] . '_' . $_POST['semester'] . '_' . substr($_POST['year'], 0, 4))) { mkdir('../uploads/' . $_POST['code'] . '_' . $_POST['semester'] . '_' . substr($_POST['year'], 0, 4), 0777, true); } } else { echo "Failed to Add new Course, contact Technical support"; } } else { echo "Course Already Exists!"; } unset($_POST['code']); unset($_POST['name']);