public function change() { if (!isset($_SESSION['UserID'])) { redirect('Login/logout'); } //Create new user and load its data $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } //If user did not load, logout the session if ($user->isGuest()) { redirect('Mainpage'); } //If not a student, redirect to mainpage $oldpw = $this->input->post('oldpw'); $newpw = $this->input->post('newpw'); $newpw2 = $this->input->post('newpw2'); if (!$user->authenticate($oldpw)) { $this->load->view('changePassword', array('user' => $user, 'error' => TRUE)); } elseif ($newpw != $newpw2) { $this->load->view('changePassword', array('user' => $user, 'error2' => TRUE)); } elseif (strpbrk($newpw, '!@#$%&*-+=1234567890') === FALSE || strlen($newpw) < 8) { $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE)); } elseif (strpbrk($newpw, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') === FALSE || strlen($newpw) < 8) { $this->load->view('changePassword', array('user' => $user, 'error3' => TRUE)); } else { $user->setPassword($newpw); $user->update(); $this->load->view('changePassword', array('user' => $user, 'success' => TRUE)); } }
public function index() { //load models $this->load->model('Curriculum_model', 'Curriculum_course_slot_model', 'Course_model', 'User_model'); $this->load->helper('url'); $user = new User_model(); //~ //verify the user is valid and a program chair if (isset($_SESSION['UserID'])) { $user->loadPropertiesFromPrimaryKey($_SESSION['UserID']); if (!$user->isProgramChair()) { redirect('login'); } } else { redirect('login'); } $curriculum = new Curriculum_Model(); $_SESSION['maxCurriculumIndex'] = 1; $_SESSION['reqs'] = array(); //call and pass data to initial curriculum view $curriculums = $curriculum->getAllCurriculums(); $data = array(); //creating easy to use array for table foreach ($curriculums as $curr) { $arr = ['name' => $curr->getName(), 'id' => $curr->getCurriculumID(), 'date' => $curr->getDateCreated()]; array_push($data, $arr); } $this->load->view('curriculum_choice', array('data' => $data)); }
public function index($advisorUserID = "all", $studentUserID = "all", $advisingLogEntryType = "all") { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isProgramChair() && !$user->isAdvisor()) { redirect('Login/logout'); } if ($advisingLogEntryType === "all") { $advisingLogEntryType = null; } if ($advisorUserID === "all") { $advisorUserID = null; } if ($user->isAdvisor() && !$user->isProgramChair() && ($advisorUserID == null || $advisorUserID != $user->getUserID())) { $advisorUserID = $user->getUserID(); } if ($studentUserID === "all") { $studentUserID = null; } $advisors = $user->isProgramChair() ? User_model::getAllAdvisors() : array($user); $students = $user->isProgramChair() ? array() : $user->getAdvisees(); $types = Advising_log_entry_model::getAllAdvisingLogEntryTypes(); $data = array('user' => $user, 'logEntries' => Advising_log_entry_model::getAllAdvisingLogEntries($advisorUserID, $studentUserID, $advisingLogEntryType), 'advisors' => $advisors, 'students' => $students, 'types' => $types, 'advisorUserID' => $advisorUserID == null ? "all" : $advisorUserID, 'studentUserID' => $studentUserID == null ? "all" : $studentUserID, 'advisingLogEntryType' => $advisingLogEntryType == null ? "all" : $advisingLogEntryType); $this->load->view('advisinglog_index_view', $data); }
public function removeProgramChair() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID']) || !$user->isAdmin()) { header("Content-type: text/plain", true, 403); echo "Invalid session user credentials"; return; } if (!isset($_POST['userid'])) { header("Content-type: text/plain", true, 400); echo "Missing User ID"; return; } $m_user = new User_model(); if (!$m_user->loadPropertiesFromPrimaryKey($_POST['userid'])) { header("Content-type: text/plain", true, 400); echo "Invalid User ID"; return; } if ($m_user->isProgramChair()) { $m_user->removeRole(User_model::ROLE_PROGRAM_CHAIR); } header("Content-type: text/plain", true, 200); echo " "; }
public function submit() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isAdmin()) { header("Content-type: text/plain", true, 401); echo "Unauthorized access"; return; } // Check $_FILES['upfile']['error'] value. switch ($_FILES['boss_file']['error']) { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_NO_FILE: header("Content-type: text/plain", true, 400); echo "No file sent"; return; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; default: header("Content-type: text/plain", true, 500); echo "Unknown error occurred"; return; } // You should also check filesize here. if ($_FILES['boss_file']['size'] > self::MAX_FILE_SIZE) { header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; } $file_name = hash("md5", time() . $_FILES['boss_file']['tmp_name']); $file_path = self::UPLOAD_FILE_DIR . "/" . $file_name . ".txt"; if (!move_uploaded_file($_FILES['boss_file']['tmp_name'], $file_path)) { header("Content-type: text/plain", true, 500); echo "Failed to move uploaded file"; return; } include_once 'application/libraries/boss_import/ParserServerTest.php'; $result = ParseFile($file_path); // In future, possibly check to make sure file was successfully deleted here unlink($file_path); if ($result == null) { header("Content-type: text/plain", true, 200); echo "Success"; } else { header("Content-type: text/plain", true, 400); echo $result; } }
public function guestLogin() { //Create a new user object $user = new User_model(); //Load userdata $user->loadPropertiesFromPrimaryKey('123'); //Setup session $_SESSION['UserID'] = $user->getUserID(); //Redirect to the mainpage controller redirect('Mainpage'); }
public function index() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isAdvisor()) { redirect('Login/logout'); } $data = array("user" => $user); $this->load->view('view_advisees', $data); }
public function remove($curriculumID = null) { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isStudent()) { redirect('Login/logout'); } $curriculum = new Curriculum_model(); if ($curriculum->loadPropertiesFromPrimaryKey($curriculumID)) { $user->removeCurriculum($curriculum); } redirect('Selectcurriculum/index'); }
public function admin() { //Load the admin mainpage if user is a admin if (!isset($_SESSION['UserID'])) { redirect('Login/logout'); } $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if ($user->isAdmin()) { $this->load->view('MainPages/admin_main_page', array('user' => $user)); } else { index(); } }
public function index() { if (!isset($_SESSION['UserID'])) { redirect('Login/logout'); } //Create new user and load its data $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } //If user did not load, logout the session if (!$user->isStudent()) { redirect('Mainpage'); } //If not a student, redirect to mainpage $advisor = $user->getAdvisor(); $advisorName = $advisor->getName(); $data = array('user' => $user, 'advisor' => $advisor); $this->load->view('advisorInfo', $data); }
<?php if (count($logEntries) < 1) { echo "<div class='alert alert-warning'><strong>No Advising Log Entries Found</strong></div>"; } ?> </div> </div> <div class="row" style="position: relative;"> <div id="entryLogWrapper" class="col-xs-12"> <ul class="list-group" style="color: black;"> <?php foreach ($logEntries as $entry) { $advisor = new User_model(); $advisor->loadPropertiesFromPrimaryKey($entry->getAdvisorUserID()); $student = new User_model(); $student->loadPropertiesFromPrimaryKey($entry->getStudentUserID()); $timestamp = $entry->getTimestamp(); $content = $timestamp . " - "; switch ($entry->getAdvisingLogEntryType()) { case Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_COMPLETE: $content .= $student->getName() . " advising appt with " . $advisor->getName() . " complete"; break; case Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_CANCELED_BY_STUDENT: $content .= $student->getName() . " canceled advising appt with " . $advisor->getName(); break; case Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_CANCELED_BY_ADVISOR: $content .= $student->getName() . " advising appt canceled by " . $advisor->getName(); break; case Advising_log_entry_model::ENTRY_TYPE_ADVISING_FORM_SAVED_BY_STUDENT: $content .= $student->getName() . " saved advising form"; break;
public function addCourseSection() { $this->checkSec(); $sID = $this->input->post('sID'); $sectionID = $this->input->post('sectionID'); $slotID = $this->input->post('slotID'); $slot = new Curriculum_course_slot_model(); $slot->loadPropertiesFromPrimaryKey($slotID); $section = new Course_section_model(); $grade = $this->input->post('grade'); //Cannot add a grade to a slot if it doesn't meet the minimum grade requirement. if (!isset($grade) || strcmp($grade, $slot->getMinimumGrade()) < 0) { redirect('User/prepareAddCourseSection/' . $slotID); } $student = new User_model(); $student->loadPropertiesFromPrimaryKey($sID); if (!$student->addCourseSection($section, $grade)) { show_error('Failed to add Course section: ' . $section . ' with grade ' . $grade); } redirect('User/prepareAddCourses/' . $sID); }
public function create() { if ($this->startTime != null && filter_var($this->startTime, FILTER_VALIDATE_INT) && $this->endTime != null && filter_var($this->endTime, FILTER_VALIDATE_INT)) { $data = array('AdvisingScheduleID' => $this->advisingScheduleID, 'StartTime' => $this->startTime, 'EndTime' => $this->endTime); $this->db->insert('AdvisingAppointments', $data); if ($this->db->affected_rows() > 0) { $this->advisingAppointmentID = $this->db->insert_id(); if (!$this->isOpen()) { $data = array('AdvisingAppointmentID' => $this->advisingAppointmentID, 'StudentUserID' => $this->studentUserID, 'AppointmentStateID' => $this->advisingAppointmentStateID); $this->db->where('AdvisingAppointmentID', $this->advisingAppointmentID); $this->db->update('ScheduledAdvisingAppointments', $data); if ($this->db->affected_rows() > 0) { return true; } else { $this->db->insert('ScheduledAdvisingAppointments', $data); if ($this->db->affected_rows() > 0) { $entry = new Advising_log_entry_model(); $student = new User_model(); $student->loadPropertiesFromPrimaryKey($this->studentUserID); $entry->setStudentUser($student); $entry->setAdvisorUser($student->getAdvisor()); if ($this->isCanceledByAdvisor()) { $entry->setAdvisingLogEntryType(Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_CANCELED_BY_ADVISOR); } else { if ($this->isCanceledByStudent()) { $entry->setAdvisingLogEntryType(Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_CANCELED_BY_STUDENT); } else { if ($this->isScheduled()) { $entry->setAdvisingLogEntryType(Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_SIGNED_UP_BY_STUDENT); } else { if ($this->isCompleted()) { $entry->setAdvisingLogEntryType(Advising_log_entry_model::ENTRY_TYPE_ADVISING_APPOINTMENT_COMPLETE); } } } } $entry->create(); return true; } } } return true; } } return false; }
public function send($userID = NULL, $email = NULL) { $session_user = new User_model(); if (!$session_user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$session_user->isAdvisor()) { redirect('Login/logout'); } $this->load->library('email'); $user = new User_model(); $user->loadPropertiesFromPrimaryKey($userID); if ($user->getAdvisor()->getUserID() != $session_user->getUserID()) { redirect('Login/logout'); } //Loads user's email if optional email wasn't set if ($email == NULL) { $email = $user->getEmailAddress(); } //Array of characters to generate password $charset = array('!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '~', '=', '+', '_', '-', '?', '/', '>', '<', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'w', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'W', 'Z'); //Generate random password $passlen = mt_rand(8, 12); $pass = NULL; for ($i = 0; $i < $passlen; $i++) { $pass = $pass . $charset[mt_rand(0, count($charset) - 1)]; } //Set user password //Email user their login information $this->email->from('*****@*****.**', 'Admin Name'); $this->email->to('*****@*****.**'); $this->email->subject('Subject'); $this->email->message('Password: '******'Username: '******'headers', 'subject', 'body')); $user->setPassword($pass); //Email user their login information $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smpt_crypt'] = 'ssl'; $config['smtp_host'] = 'ssl://smtp.gmail.com'; $config['smtp_port'] = '465'; $config['smtp_user'] = '******'; $config['smtp_pass'] = '******'; $config['mailtype'] = 'html'; $config['charset'] = 'utf-8'; $config['newline'] = "\r\n"; $config['validate'] = FALSE; $config['bcc_batch_mode'] = FALSE; $config['bcc_batch_size'] = 200; $this->email->initialize($config); $this->email->from('*****@*****.**', 'Senior'); $list = array('*****@*****.**'); $this->email->to($list); $this->email->reply_to('*****@*****.**', 'Senior'); $this->email->subject('Subject'); $this->email->message('Email works great!'); if ($user->update() && $this->email->send()) { $_SESSION['activation.message'] = "Success!"; } else { $_SESSION['activation.error'] = "Sending email failed!<br />" . $this->email->print_debugger(); } redirect('Activation/index'); }
/** * Summary of getAllProgramChairs * Get all of the users in the database with a program chair role * * @return Array An array containing all users who have a program chair role */ public static function getAllProgramChairs() { $db = get_instance()->db; $models = array(); $db->select('Users.UserID'); $db->from('Users'); $db->join('UserRoles', 'Users.UserID = UserRoles.UserID', 'inner'); $db->where('UserRoles.RoleID', self::ROLE_PROGRAM_CHAIR); $results = $db->get(); if ($results->num_rows() > 0) { foreach ($results->result_array() as $row) { $model = new User_model(); if ($model->loadPropertiesFromPrimaryKey($row['UserID'])) { array_push($models, $model); } } } return $models; }
public function delete() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isProgramChair()) { redirect('Login/logout'); } if (!$this->uri->segment(3)) { redirect('Coursemanager/index'); } $course = new Course_model(); if (!$course->loadPropertiesFromPrimaryKey($this->uri->segment(3))) { redirect('Coursemanager/index'); } $course->delete(); redirect('Coursemanager/index/' . $course->getCourseName()); }
public function submit() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isAdmin()) { header("Content-type: text/plain", true, 401); echo "Unauthorized access"; return; } if (!isset($_POST['year']) || !isset($_POST['quarter'])) { header("Content-type: text/plain", true, 400); echo "Missing required academic quarter information"; return; } $academic_quarter = new Academic_quarter_model(); if (!$academic_quarter->loadPropertiesFromNameAndYear($_POST['quarter'], $_POST['year'])) { $academic_quarter->setName($_POST['quarter']); $academic_quarter->setYear($_POST['year']); if (!$academic_quarter->create()) { header("Content-type: text/plain", true, 500); echo "Unable to load academic quarter"; return; } } // Check $_FILES['upfile']['error'] value. switch ($_FILES['boss_file']['error']) { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_NO_FILE: header("Content-type: text/plain", true, 400); echo "No file sent"; return; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; default: header("Content-type: text/plain", true, 500); echo "Unknown error occurred"; return; } // You should also check filesize here. if ($_FILES['boss_file']['size'] > self::MAX_FILE_SIZE) { header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; } $file_name = hash("md5", time() . $_FILES['boss_file']['tmp_name']); $file_path = self::UPLOAD_FILE_DIR . "/" . $file_name . ".txt"; if (!move_uploaded_file($_FILES['boss_file']['tmp_name'], $file_path)) { header("Content-type: text/plain", true, 500); echo "Failed to move uploaded file"; return; } $result = self::parseFutureCourseOfferingsFile($file_path, $academic_quarter->getAcademicQuarterID()); // In future, possibly check to make sure file was successfully deleted here unlink($file_path); if ($result == null) { header("Content-type: text/plain", true, 200); echo "Success"; } else { header("Content-type: text/plain", true, 400); echo $result; } }
public function confirm_remove() { if (!isset($_SESSION['UserID'])) { redirect('Login/logout'); } //Create new user and load its data $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isProgramChair()) { redirect('Mainpage'); } $tcourse = $this->input->post("transferCourseID"); $t_course = new Student_transfer_course_model(); $norm_course = new Course_model(); //explode this, then load the data from pimary key, then load course from primary, then add equilvilent course $str_array = explode(",", $tcourse); $t_course->loadPropertiesFromPrimaryKey(intval($str_array[0])); $norm_course->loadPropertiesFromPrimaryKey(intval($str_array[1])); $t_course->removeEquivilentCourse($norm_course); redirect('Transfer_controller/viewIdMapping'); }
$sectionID = $filledSlots[$slotName]; } $slotID = $currSlot->getCurriculumCourseSlotID(); //Setup action for button next to currriculum slot info. if ($sectionID > 0) { $submitAction = site_url('User/prepareRemoveCourseSection/' . $sectionID); } else { $submitAction = site_url('User/prepareAddCourseSection/' . $slotID); } echo '<form action="' . $submitAction . '" method="POST">'; echo '<input type="hidden" name="sID" value="' . $sID . '" />'; echo '<tr><td><input type="submit"'; if ($sectionID > 0) { echo 'value="Remove Course" /></tc></td>'; $student = new User_model(); $student->loadPropertiesFromPrimaryKey($sID); $section = new Course_section_model(); $section->loadPropertiesFromPrimaryKey($sectionID); $quarterName = $section->getAcademicQuarter()->getName(); $quarterYear = $section->getAcademicQuarter()->getYear(); $grade = $student->getGradeForCourseSection($section); echo '<td>' . $currSlot->getName() . '</td>' . '<td>' . $quarterName . $quarterYear . '</td>' . '<td>' . $section->getSectionName() . '</td>' . '<td>' . $grade . '</td>'; } else { echo 'value=" Add Course " /></tc></td>'; // Need Curriculum Slot echo '<td>' . $slotName . '</td>' . '<td>' . $unassigned . '</td>' . '<td>' . $unassigned . '</td>' . '<td>' . $unassigned . '</td>'; } echo '</tr></form>'; } ?> </table>
public function save() { //*troubleshooting tip* //keep in mind when you press "save" this function will run //and what ever you print_r will show in the success window popup //print_r($_POST); //this should first remove all data that is currently saved //next this will gather the data from javascript //if(isset($_POST['name'])){ // print_r($_POST['name']); //$jsonReceiveData = json_encode($_POST['{"Info":'], JSON_PRETTY_PRINT); //$uid = $_SESSION['UserID']; if (isset($_SESSION['StudCWID'])) { $this->uid = $_SESSION['StudCWID']; } else { if (!isset($_SESSION['UserID'])) { redirect('login'); } $this->uid = $_SESSION['UserID']; } $currentquarter = academic_quarter_model::getLatestAcademicQuarter(); $previous_form = $this->loadAdvisingForm($this->uid); if ($previous_form !== false) { $previous_form->delete(); } if (!isset($_POST['data'])) { header("Content-type: text/plain", true, 400); echo "Missing data"; return; } //$data = $_POST['Info']; $data = json_decode($_POST['data']); //['data']); $mod = new advising_form_model(); $mod->setStudentUserID(intval($this->uid)); $mod->setAcademicQuarterID($currentquarter->getAcademicQuarterID()); $mod->create(); $entry = new Advising_log_entry_model(); $student = new User_model(); if ($student->loadPropertiesFromPrimaryKey($this->uid)) { $createdByAdvisor = $this->uid != $_SESSION['UserID']; $entry->setStudentUser($student); $entry->setAdvisorUser($student->getAdvisor()); $entry->setAdvisingLogEntryType($createdByAdvisor ? Advising_log_entry_model::ENTRY_TYPE_ADVISING_FORM_SAVED_BY_ADVISOR : Advising_log_entry_model::ENTRY_TYPE_ADVISING_FORM_SAVED_BY_STUDENT); $entry->create(); } foreach ($data->Info as $section) { //print_r($course->Type); $callNum = $section->CallNumber; $sections = $currentquarter->getAllCourseSections(); $target = new course_section_model(); /*foreach($sections as $sec) { if ($sec->getCallNumber() === $callNum) { $target->loadPropertiesFromPrimaryKey($sec->getCourseSectionID()); break; } }*/ $target->loadPropertiesFromPrimaryKey($callNum); $state = $section->Type == "norm" ? advising_form_model::COURSE_SECTION_STATE_PREFERRED : advising_form_model::COURSE_SECTION_STATE_ALTERNATE; $mod->addCourseSection($target, $state); } //$previous_form->delete(); //print_r($_POST['{"Info":']); /*$blarg = json_decode($jsonReceiveData, true); foreach($blarg as $item) { foreach($item as $key => $value) { $info = $json_decode($key, true); foreach($info as $inf) { echo "\n\n" . $inf; } } }*/ /*$blarg = json_decode($jsonReceiveData); var_dump($blarg);*/ //} //then it will store the new information in the database }
public function submit() { $user = new User_model(); if (!$user->loadPropertiesFromPrimaryKey($_SESSION['UserID'])) { redirect('Login/logout'); } if (!$user->isAdmin()) { header("Content-type: text/plain", true, 401); echo "Unauthorized access"; return; } // Check $_FILES['upfile']['error'] value. switch ($_FILES['boss_file']['error']) { case UPLOAD_ERR_OK: break; case UPLOAD_ERR_NO_FILE: header("Content-type: text/plain", true, 400); echo "No file sent"; return; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; default: header("Content-type: text/plain", true, 500); echo "Unknown error occurred"; return; } // You should also check filesize here. if ($_FILES['boss_file']['size'] > self::MAX_FILE_SIZE) { header("Content-type: text/plain", true, 400); echo "Exceeded file size limit"; return; } $file_name = hash("md5", time() . $_FILES['boss_file']['tmp_name']); $file_path = self::BACKUP_FILE_DIR . "/" . $file_name . ".backup"; if (!move_uploaded_file($_FILES['boss_file']['tmp_name'], $file_path)) { header("Content-type: text/plain", true, 500); echo "Failed to move uploaded file"; return; } if ($result == null) { header("Content-type: text/plain", true, 200); echo "Success"; } else { header("Content-type: text/plain", true, 400); echo $result; } }
public function Student_Cancel() { $User_model = new User_model(); $User_model->loadPropertiesFromPrimaryKey($_SESSION['UserID']); $quarter = Academic_quarter_model::getLatestAcademicQuarter(); $quarter = $quarter->getAcademicQuarterID(); $Advising_schedule = new Advising_schedule_model(); $Advising_appointment = new Advising_appointment_model(); $advisor = $User_model->getAdvisor(); $advisor = $advisor->getUserID(); $Advising_schedule->loadPropertiesFromAdvisorIDAndAcademicQuarterID($advisor, $quarter); $app_array = $Advising_schedule->getAllAdvisingAppointments(); foreach ($app_array as $key) { if ($key->getScheduledStudentUserID() == $_SESSION['UserID'] && $key->isScheduled()) { $Advising_appointment->loadPropertiesFromPrimaryKey($key->getAdvisingAppointmentID()); $Advising_appointment->setAdvisingAppointmentState(3); $Advising_appointment->update(); break; } } //SEND Optional Email redirect('appointment_controller'); }