function getAllPendingUsers() { checkConnectivity1(); $list = array(); $query = sprintf("select ID from user"); $result = mysqli_query($GLOBALS['connection_link'], $query); while ($row = mysqli_fetch_assoc($result)) { if (getUserTypeByID($row['ID']) == 'waiting user') { $list[] = getUserInfoByUserID($row['ID']); } } return $list; }
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; } $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 {
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/selectQuires.php'); require '../database/models.php'; $loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']); $logged_in_name = "Welcome " . $loggedin_user_info['name']; $info = getUserInfoByUserID($_REQUEST['page_user_id']); $type = getUserTypeString($info['type']); $body_section_content = '<h1> Information About User: </h1>'; $body_section_content .= '<p>you can change the user\'s role, approve or delete the user.</p> <form action="approve.php"> ID: <input type="text" name="ID" readonly value="' . $info['ID'] . '"/><br> username: <input type="text" name="username" readonly value="' . $info['user_name'] . '"/><br> Name: <input type="text" name="name" readonly value="' . $info['name'] . '"/><br> email: <input type="text" name="email" readonly value="' . $info['email'] . '"/><br> Role: <input type="text" name="role" readonly value="' . $type . '"/><br> new role:<select name="type"> <option value="instractor">Instructor</option> <option value="admin">Admin</option> <option value="qa_member">QA member</option> <option value="department_manager">Department Manager</option> </select><br>';
$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/selectQuires.php'); require '../database/models.php'; $loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']); $logged_in_name = "Welcome " . $loggedin_user_info['name']; $info = getInfoByCourseID($_REQUEST['page_course_id']); $result_derpartment = getDepartmentByManagerID($_SESSION['user_id']); $result_getAllInstructors = getAllInstructors(); $current_instructor = getUserInfoByUserID($info['instructor_id']); $body_section_content = '<h1> Information About Course: </h1>'; $body_section_content .= '<form action="approve.php"> ID: <input type="text" name="ID" readonly value="' . $info['ID'] . '"/><br> Code: <input type="text" name="code" readonly value="' . $info['code'] . '"/><br> Name: <input type="text" name="name" readonly value="' . $info['name'] . '"/><br> semster: <input type="text" name="semster" readonly value="' . $info['semster'] . '"/><br> year: <input type="text" name="year" readonly value="' . $info['year'] . '"/><br> department: <input type="text" name="department" readonly value="' . $result_derpartment['name'] . '"/><br> instructor name: <input type="text" name="current_instructor" readonly value="' . $current_instructor['name'] . '"/><br> <button type="submit" value="delete" name="action" onclick="return confirm(\'Are you sure that you want to delete this course?\')">Delete</button> <br><br><p>You can assign a new instructor to the course</p> Assign new instructor: <select name="instructor">'; foreach ($result_getAllInstructors as $val) { $body_section_content .= '<option value="' . $val['ID'] . '">' . $val['name'] . "</option>"; }