D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
alumni
/
application
/
controllers
/
admin
/
Filename :
User.php
back
Copy
<?php /** * Description of User * * @author Softpro India Pvt. Ltd. */ class User extends CI_Controller { //put your code here public function __construct() { parent::__construct(); $this->load->model("admin/reports/GeneralReports"); $this->load->model("admin/UserManagement"); $this->load->model("admin/CourseManagement"); $this->load->model("admin/GallaryManagement"); $this->load->model("user/JobManagement"); } public function index() { if ($this->sessionvalidator->validateSession()) { if (isset($_POST['filterSubmitBtn']) != "") { $name = $this->input->post("userName"); $passingYear = $this->input->post("passingYear"); $startDate = trim($this->input->post("startDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("startDate")))); $endDate = trim($this->input->post("endDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("endDate")))); $userType = $this->input->post("userType"); $course = $this->input->post("course"); $viewData["users"] = $this->GeneralReports->getUsers($name, $course, $passingYear, $startDate, $endDate, $userType)->result(); $viewData["courses"] = $this->CourseManagement->getCourses()->result(); $this->load->view("admin/users", $viewData); } else { $viewData["users"] = $this->GeneralReports->getUsers()->result(); $viewData["courses"] = $this->CourseManagement->getCourses()->result(); $this->load->view("admin/users", $viewData); } } else { redirect("admin/"); } } public function toggleUserStatus($userid, $chnagedStatus) { if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") { $userUpdateData = array( 'userid' => $userid, 'user_status' => $chnagedStatus ); if ($this->UserManagement->updateUser($userUpdateData)) { $this->session->set_flashdata('successMessage', 'User Status Updated Successfully.'); redirect("admin/User/manageUsers"); } else { $this->session->set_flashdata('errorMessage', 'Failed To Update User Status.'); redirect("admin/User/manageUsers"); } } else { redirect("admin/"); } } public function manageUsers() { if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") { $viewData=array(); if (isset($_POST['filterSubmitBtn']) != "") { $name = $this->input->post("userName"); $passingYear = $this->input->post("passingYear"); $startDate = trim($this->input->post("startDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("startDate")))); $endDate = trim($this->input->post("endDate")) == "" ? "" : date('Y-m-d', strtotime(str_replace('/', '-', $this->input->post("endDate")))); $userType = $this->input->post("userType"); $course = $this->input->post("course"); $viewData["users"] = $this->GeneralReports->getUsers($name, $course, $passingYear, $startDate, $endDate, $userType)->result(); $viewData["courses"] = $this->CourseManagement->getCourses()->result(); //$this->load->view("admin/manageUsers", $viewData); } else { $viewData["users"] = $this->GeneralReports->getUsers()->result(); $viewData["courses"] = $this->CourseManagement->getCourses()->result(); //$this->load->view("admin/manageUsers", $viewData); } $this->load->view("admin/manageUsers", $viewData); } else { redirect("admin/"); } } public function toggleUserType($userid, $changedType) { if ($this->sessionvalidator->validateSession() && $this->sessionvalidator->getRole() == "Master Admin") { $userUpdateData = array( 'userid' => $userid, 'user_type' => $changedType ); if ($this->UserManagement->updateUser($userUpdateData)) { $this->session->set_flashdata('successMessage', 'User Type Updated Successfully.'); redirect("admin/User/manageUsers"); } else { $this->session->set_flashdata('errorMessage', 'Failed To Update User Type.'); redirect("admin/User/manageUsers"); } } else { redirect("admin/"); } } public function getUserCompleteDetails($userid) { if ($this->sessionvalidator->validateSession()) { if (sizeof($this->UserManagement->getUserPersoanlAndProfileDetails($userid)->result()) > 0) { $viewData["gallaryData"] = $this->GallaryManagement->getGalleryImagesByUserID($userid)->result(); $viewData["jobData"] = $this->JobManagement->getJobsForAdminViewByUserID($userid)->result(); $viewData["personalAndProfileData"] = $this->UserManagement->getUserPersoanlAndProfileDetails($userid)->result()[0]; $this->load->view("admin/userProfile", $viewData); } else { redirect("admin/User/manageUsers"); } } else { redirect("admin/"); } } public function deleteImage($pic_id, $userid) { if ($this->sessionvalidator->validateSession()) { if ($this->GallaryManagement->deleteGallaryImage($pic_id)) { echo "hello"; $this->session->set_flashdata('successMessage', 'Gallery Image Disabled Successfully'); //exit; redirect("admin/User/getUserCompleteDetails/" . $userid); } else { $this->session->set_flashdata("errorMessage", "Failed To Disable Gallery Image."); $this->index(); } } else { echo $this->sessionvalidator->validateSession(); //exit; redirect("admin/"); } } }