public function index() { $currUser = currentuser_session(); if ($currUser['loggedIn']) { redirect(base_url('welcome')); } $success = $this->session->flashdata('success'); $error = $this->session->flashdata('error'); $viewData['success'] = $success; $viewData['error'] = $error; view_load_view('login-view', $viewData); }
public function edit_site_map() { $curUser = currentuser_session(); if ($curUser['user_role'] != 1) { redirect(base_url()); } $Id = $this->input->get_post('id'); $where = array('site_map_id' => $Id); $basicModel = load_basic_model('site_mapping'); $viewData['siteMapData'] = $basicModel->get($where, 1); // print_array( $viewData['batchData']); load_fullview('edit_site_map_view', $viewData); }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $curUser = currentuser_session(); $userRole = $curUser['user_role']; $readOnly = 'readonly="readonly"'; $pageTitle = 'Site Info'; if (ADMIN || PM) { $readOnly = ""; $pageTitle = 'Edit Stie'; } ?> <section class="mid-cont"> <div class="nav-icon"> <span class="glyphicon glyphicon-align-justify" aria-hidden="true"></span> </div> <?php include_once 'includes/leftmenu.php'; ?> <div class="center-cont"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-8"> <div class="edit-sec"> <h5><?php echo $pageTitle; ?> <a href="<?php echo base_url('manage_sites');
function chk_admin() { $CI =& get_instance(); $admin = FALSE; $pm = FALSE; $qp = FALSE; $allowAdd = FALSE; $allowEdit = FALSE; if ($CI->router->class != "login") { $curUser = currentuser_session(); $userRole = $curUser['user_role']; switch ($userRole) { case 1: $admin = TRUE; $allowAdd = TRUE; $allowEdit = TRUE; break; case 2: $pm = TRUE; $allowAdd = TRUE; break; case 3: $qp = TRUE; $allowAdd = TRUE; break; } } define('ADMIN', $admin); define('PM', $pm); define('QP', $qp); define('ALLOW_ADD', $allowAdd); define('ALLOW_EDIT', $allowEdit); }
public function validate_implants() { $curUser = currentuser_session(); if ($curUser['user_role'] != 1) { redirect(base_url()); } $post = $this->input->post(NULL, TRUE); $total_implants = $post['total_implants']; $implant_all_qc = $post['implant_all_qc']; $implant_all_ct = $post['implant_all_ct']; $batch_number = $post['batch_number']; $this->load->model('generic_model'); $total_wastage = $this->generic_model->get_batch_wastage($batch_number); $select_deliveries = $this->generic_model->get_batch_deliveries_implants($batch_number); if (count($select_deliveries) > 0) { $total_deliver_implants = $select_deliveries->number_implants; } else { $total_deliver_implants = 0; } $select_implanted_admin = $this->generic_model->get_implant_admin($batch_number); if ($total_implants < $implant_all_ct + $implant_all_qc + $total_wastage + $total_deliver_implants + count($select_implanted_admin)) { if ($total_wastage > 0) { $result = array('msg' => 'There are already ' . $total_wastage . ' wastage registered.'); } else { $result = array('msg' => 'Allocated implants and wastage must be less then total implant.'); } } else { $result = array('msg' => 'ok'); } echo json_encode($result); }
public function user_profile() { check_session(); $curUser = currentuser_session(); $userId = $curUser['user_id']; $where = array('user_id' => $userId); $basicModel = load_basic_model('users'); $viewData['userData'] = $basicModel->get($where, 1); // get user roles $roleModel = load_basic_model('user_roles'); $viewData['userRoles'] = $roleModel->get(); load_fullview('user_profile_view', $viewData); }