output->set_status_header ( 200 )->set_content_type ( 'application/json', 'utf-8' )->set_output ( json_encode ( $data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ) )->_display (); exit (); } /** * This function used to check the user is logged in or not */ function isLoggedIn() { $isLoggedIn = $this->session->userdata ( 'isLoggedIn' ); if (! isset ( $isLoggedIn ) || $isLoggedIn != TRUE) { redirect ( 'login' ); } else { $this->role = $this->session->userdata ( 'role' ); $this->vendorId = $this->session->userdata ( 'userId' ); $this->name = $this->session->userdata ( 'name' ); $this->roleText = $this->session->userdata ( 'roleText' ); $this->Designation = $this->session->userdata ( 'Designation' ); $this->DEPCode = $this->session->userdata ( 'DEPCode' ); $this->HeadDept = $this->session->userdata ( 'HeadDept' ); $this->DepartmentName = $this->session->userdata ( 'DepartmentName' ); $this->EmpID = $this->session->userdata ( 'EmpID' ); $this->global ['name'] = $this->name; $this->global ['role'] = $this->role; $this->global ['role_text'] = $this->roleText; $this->global ['DEPCode'] = $this->DEPCode; $this->global ['Designation'] = $this->Designation; } } /** * This function is used to check the access */ function isAdmin() { if ($this->role != ROLE_ADMIN) { return true; } else { return false; } } /** * This function is used to check the access */ function isTicketter() { if ($this->role != ROLE_ADMIN || $this->role != ROLE_MANAGER) { return true; } else { return false; } } /** * This function is used to load the set of views */ function loadThis() { $this->global ['pageTitle'] = 'Resico Industries : Access Denied'; $this->load->view ( 'includes/header', $this->global ); $this->load->view ( 'access' ); $this->load->view ( 'includes/footer' ); } /** * This function is used to logged out user from system */ function logout() { $this->session->sess_destroy (); redirect ( 'login' ); } /** * This function used to load views * @param {string} $viewName : This is view name * @param {mixed} $headerInfo : This is array of header information * @param {mixed} $pageInfo : This is array of page information * @param {mixed} $footerInfo : This is array of footer information * @return {null} $result : null */ function loadViews($viewName = "", $headerInfo = NULL, $pageInfo = NULL, $footerInfo = NULL){ $this->load->view('includes/header', $headerInfo); $this->load->view($viewName, $pageInfo); $this->load->view('includes/footer', $footerInfo); } /** * This function used provide the pagination resources * @param {string} $link : This is page link * @param {number} $count : This is page count * @param {number} $perPage : This is * records per page limit * @return {mixed} $result : This is array of records and pagination data */ function paginationCompress($link, $count, $perPage = 10) { $this->load->library ( 'pagination' ); $config ['base_url'] = base_url () . $link; $config ['total_rows'] = $count; $config ['uri_segment'] = SEGMENT; $config ['per_page'] = $perPage; $config ['num_links'] = 5; $config ['full_tag_open'] = ''; $config ['first_tag_open'] = '