</tr> <tr> <th>Department</th> <td> <select name="department"> <option value="" selected>Department</option> <?php $dep = new Department(); $departments = $dep->getAllDepartment(); while ($department = $departments->fetch_object()) { ?> <option value="<?php echo $department->dept_id; ?> " <?php echo $t->getDep() == $department->dept_id ? 'selected' : ''; ?> ><?php echo $department->name; ?> </option> <?php } ?> </select> </td> </tr> <tr> <th>Email</th> <td><input type="text" placeholder="Email" class="" value="<?php echo $t->getEmail();
public function reject($tid, $cid, $did, $reject_msg) { if (!loggedIn()) { return 0; } $this->_connect(); $this->_teacher_id = $this->_db->real_escape_string($tid); $tid = $this->_db->real_escape_string($tid); $this->_course_code = $this->_db->real_escape_string($cid); $this->_course_dep = $this->_db->real_escape_string($did); if ($this->approved($cid, $did)) { if ($this->_status_level == '-1') { die('This result is already rejected.'); } if ($this->_status_level < 5) { $approved_by = explode(',', $this->_approved_by); $t = new Teacher(); $t->getInfo(Session::get('teacher_id')); $reject_msg = 'By ' . $t->getName() . '. ' . $reject_msg; $this->_reject_msg = $this->_db->real_escape_string($reject_msg); if (Session::get('privilege') === 'teacher') { $i = 0; while (isset($approved_by[$i])) { if ($approved_by[$i] == $tid) { return 2; break; } else { $i++; } } } else { if (Session::get('privilege') === 'dupc' || Session::get('privilege') === 'dppc') { $i = 1; if ($this->_status_level >= 3) { die("You cannot reject because all DUPC or DPPC members have approved!"); } if ($t->getDep() != $this->_course_dep) { die("Sorry! You cannot reject this result!"); } while (isset($approved_by[$i])) { if ($approved_by[$i] == $tid) { return 2; break; } else { $i++; } } } else { if (Session::get('privilege') === 'hod' && $this->_status_level == 3) { if ($t->getDep() != $this->_course_dep) { die("Sorry! You cannot reject this result!"); } } else { if (Session::get('privilege') === 'hod' && $this->_status_level < 3) { die("You cannot approve/reject this result being HOD because DUPC or DPPC members have not approved/rejected this result yet."); } else { if (Session::get('privilege') === 'hod' && $this->_status_level > 3) { die("You have already approved this result being HOD. So you cannot reject."); } else { if (Session::get('privilege') === 'dean' && $this->_status_level < 4) { die("You cannot approve/reject this result being DEAN because HOD or DUPC or DPPC members have not approved/rejected this result yet."); } } } } } } $approved_by = ''; $status_level = '-1'; $query = "UPDATE approval SET reject_msg='" . $this->_reject_msg . "',status_level='" . $status_level . "', approved_by='" . $approved_by . "' WHERE teacher_id='" . $this->_teacher_id . "' AND course_code='" . $this->_course_code . "' AND course_dep='" . $this->_course_dep . "' AND timestamp>='" . Session::get('semester_timestamp') . "'"; } else { die("Cannot Reject!"); } } else { die("Reject Error"); } $result = $this->_db->query($query); if ($this->_db->affected_rows) { if ($this->_db->error == '') { return 1; } else { die($this->_db->error); } } else { return 2; } }