public function facility_offline() { $identifier = $this->session->userdata('user_indicator'); $user_type_id = $this->session->userdata('user_type_id'); $district = $this->session->userdata('district_id'); $county = $this->session->userdata('county_id'); if ($identifier == "district") { $data['facilities'] = Facilities::get_facility_details($district, NULL, 1); $data['identifier'] = $identifier; } elseif ($identifier == "county") { $data['facilities'] = Facilities::get_facility_details(NULL, $county, 1); $data['identifier'] = $identifier; $data['district_info'] = Districts::get_districts($county); } $permissions = 'district_permissions'; $data['user_types'] = Access_level::get_access_levels($permissions); $data['title'] = "Offline Facility Setup"; $data['district_id'] = $district; $data['banner_text'] = "Setup Facility Offline"; $template = 'shared_files/template/template'; // $data['sidebar'] = "shared_files/report_templates/side_bar_sub_county_v"; $data['active_panel'] = 'system_usage'; // $data['report_view'] = "shared_files/Facility_activation_v"; $data['content_view'] = "shared_files/facility_offline"; $this->load->view($template, $data); }
public function index() { $data['content_view'] = "dist_signup_v"; $data['banner_text'] = "Sign Up"; $data['level_l'] = Access_level::getAll2(); $this->load->view("template", $data); }
public function system_updates_home($update_status = NULL, $update_presence = NULL) { // echo "<pre>";print_r($update_presence);exit; $permissions = 'super_permissions'; $data['user_types'] = Access_level::get_access_levels($permissions); $identifier = $this->session->userdata('user_indicator'); $status = isset($update_presence) && ($update_presence = 1) ? 1 : NULL; if (isset($status) && $status == 1) { $status_ = "TRUE"; $available_update = 1; } else { $status_ = "FALSE"; $available_update = 0; } $latest_update_time = $this->latest_server_update_time(); // echo "<pre>";print_r($latest_update_time);echo "</pre>";exit; // echo $available_update;exit; $update_records = update_model::get_prior_records(); // echo "<pre>";print_r($update_records);exit; $data['available_update'] = $available_update; $data['latest_update_time'] = $latest_update_time; $data['update_status'] = $status_; $data['update_records'] = $update_records; $data['title'] = "System Updates"; $data['banner_text'] = "System Management"; $data['banner_text'] = "System Management"; $template = 'shared_files/template/template'; $data['latest_hash'] = $hash; $data['content_view'] = "offline/offline_admin_home"; $this->load->view($template, $data); }
public function get_user($search_string = null, $order = null, $order_type = 'DESC', $limit_start = null, $limit_end = null, $wherestatus = null, $user_id) { $get_parent_userids = model_load_model('user_role_extended_model')->get_user_role_extended_by_field_array(array("parent_user_id"), array(Access_level::session_user_id())); $this->db->select('*'); $this->db->from('order'); $this->db->where('user_id', $user_id); $query = $this->db->get(); return $query->result_array(); }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('purchase_details_data_model'); if (!$this->session->userdata('is_logged_in')) { redirect('admin/login'); } if (!Access_level::get_access('purchase_details_data')) { redirect('admin/dashboard'); } }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('category_price_model'); if (!$this->session->userdata('is_logged_in_admin')) { redirect('admin/login'); } if (!Access_level::get_access('category_price')) { redirect('admin/dashboard'); } }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->model('site_language_model'); if (!$this->session->userdata('is_logged_in_admin')) { redirect('admin/login'); } if (!Access_level::get_access('sitelanguage')) { redirect('admin/dashboard'); } }
public function manage_users() { $permissions = 'super_permissions'; $data['title'] = "Users"; $data['content_view'] = "Admin/users_v"; $data['listing'] = Users::get_user_list_all(); $data['counts'] = Users::get_users_count(); $data['counties'] = Counties::getAll(); $data['facilities'] = Facilities::getAll(); $data['sub_counties'] = Districts::getAll(); $data['user_types'] = Access_level::get_access_levels($permissions); $this->load->view("shared_files/template/dashboard_v", $data); }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('category_model'); $this->load->model('site_language_model'); $this->site_language = $this->site_language_model->get_language('', '', '', '', '', 'Active'); if (!$this->session->userdata('is_logged_in_admin')) { redirect('admin/login'); } if (!Access_level::get_access('category')) { redirect('admin/dashboard'); } }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('report_model'); $this->load->helper('url'); if (!$this->session->userdata('is_logged_in')) { redirect('admin/login'); } if (!Access_level::get_access('report_list')) { redirect('admin/dashboard'); } $this->load->model('user_role_extended_model'); }
/** * Fetch user data from the database * possibility to mix search, filter and order * @param string $search_string * @param strong $order * @param string $order_type * @param int $limit_start * @param int $limit_end * @return array */ public function get_user($search_string = null, $order = null, $order_type = 'DESC', $limit_start = null, $limit_end = null, $wherestatus = null) { $get_parent_userids = model_load_model('user_role_extended_model')->get_user_role_extended_by_field_array(array("parent_user_id"), array(Access_level::session_user_id())); $this->db->select('*'); $this->db->from('user'); $this->db->where('user_type', 'operator'); $parent_ids[] = Access_level::session_user_id(); switch (Access_level::session_user_type()) { case 'super_admin': break; case 'admin': for ($i = 0; $i < count($get_parent_userids); $i++) { $parent_ids[] = $get_parent_userids[$i]['user_id']; } break; default: break; } $parent_string = implode(",", $parent_ids); if (Access_level::session_user_type() != 'super_admin') { $this->db->where("user_id IN ({$parent_string})"); } if ($wherestatus != null) { $this->db->where('status', $wherestatus); } //$this->db->order_by('status', 'Active'); if ($search_string) { if ($order == 'language_interface') { $this->load->model('site_language_model'); //$language_interface = $this->site_language_model->get_language_by_id(); //$lang = !empty($language_interface[0]['language_longform']) ? $language_interface[0]['language_longform'] : '--'; $this->db->join('site_language', 'user.language_interface = site_language.site_language_id'); $order = 'site_language.language_longform'; } $this->db->like($order, $search_string); } $this->db->group_by('user_id'); if ($order) { $this->db->order_by($order, $order_type); } else { $this->db->order_by('user_id', $order_type); } if ($limit_start && $limit_end) { $this->db->limit($limit_start, $limit_end); } if ($limit_start != null) { $this->db->limit($limit_start, $limit_end); } $query = $this->db->get(); return $query->result_array(); }
public function admin_updates_home($update_status = NULL) { // echo "<pre> This";print_r($update_status);exit; $permissions = 'super_permissions'; $data['user_types'] = Access_level::get_access_levels($permissions); $identifier = $this->session->userdata('user_indicator'); $hash = $this->get_hash(); $local_hash = $this->github_update_status_local(); if ($hash != $local_hash) { $status = 1; } $res = $this->github_updater->get_hash(); // echo "<pre>";print_r($hash);echo "</pre>";exit; if (isset($status) && $status == 1) { $status_ = "TRUE"; $available_update = 1; } else { $status_ = "FALSE"; $available_update = 0; } // echo $available_update;exit; $git_records = Offline_model::get_prior_records(); // echo "<pre>";print_r($git_records);exit; $data['available_update'] = $available_update; $data['most_recent_commit'] = $hash; $data['update_status'] = $status_; $data['git_records'] = $git_records; $data['title'] = "System Updates"; $data['banner_text'] = "System Management"; // $data['content_view'] = "offline/offline_admin_home"; // $template = 'shared_files/template/dashboard_v'; $data['banner_text'] = "System Management"; // if ($identifier=='facility_admin') { // $template = 'shared_files/template/template'; // // $data['content_view'] = 'facility/offline_admin'; // $data['content_view'] = "offline/offline_admin_home"; // }else{ // $template = 'shared_files/template/dashboard_v'; // $data['content_view'] = "offline/offline_admin_home"; // } $template = 'shared_files/template/template'; $data['latest_hash'] = $hash; $data['content_view'] = "offline/offline_admin_home"; // $update_status = $this->github_update(); // $hash = $this->get_hash(); // $update_files = $this->get_zip($hash); // echo "<pre>";print_r($update_files);exit; $this->load->view($template, $data); }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('material_model'); $this->load->model('common_model'); $this->load->library('Common'); $this->load->library('Upload'); $this->load->library('upload'); if (!$this->session->userdata('is_logged_in')) { redirect('admin/login'); } if (!Access_level::get_access('material')) { redirect('admin/dashboard'); } }
/** * Responsable for auto load the model * @return void */ public function __construct() { parent::__construct(); $this->load->model('posts_model'); $this->load->model('common_model'); $this->load->model('home_model'); $this->load->library('Common'); $this->load->library('image_lib'); $this->load->library('Upload'); $this->load->library('upload'); $this->load->library('Functions'); $this->load->helper('text'); if (!$this->session->userdata('is_logged_in_admin')) { redirect('admin/login'); } if (!Access_level::get_access('posts')) { redirect('admin/dashboard'); } }
public function get_user_type_json() { $identifier = $this->session->userdata('user_indicator'); if ($identifier == "county") { $permissions = 'county_permissions'; } elseif ($identifier == "facility_admin") { $permissions = 'facilityadmin_permissions'; } else { $permissions = 'district_permissions'; } echo json_encode(Access_level::get_access_levels($permissions)); }
public function admin_updates_home() { $permissions = 'super_permissions'; $data['title'] = "System Updates"; $data['user_types'] = Access_level::get_access_levels($permissions); $data['banner_text'] = "User Management"; $data['content_view'] = "offline/offline_admin_home"; $template = 'shared_files/template/dashboard_v'; $update_status = $this->get_hash(); echo "<pre>"; print_r($update_status); exit; $this->load->view($template, $data); }
public function user_create_multiple($facility_code = null) { //get user details in session $identifier = $this->session->userdata('user_indicator'); $user_type_id = $this->session->userdata('user_type_id'); $district = $this->session->userdata('district_id'); $county = $this->session->userdata('county_id'); $facility = $this->session->userdata('facility_id'); //query to get user listing by type of user switch ($identifier) { case 'moh': $permissions = 'moh_permissions'; $template = 'shared_files/template/dashboard_template_v'; break; case 'facility_admin': $permissions = 'facilityadmin_permissions'; $data['listing'] = Users::get_user_list_facility($facility); $template = 'shared_files/template/template'; break; case 'district': $permissions = 'district_permissions'; $data['listing'] = Users::get_user_list_district($district); if ($facility_code == 0) { $data['facilities'] = Facilities::getFacilities($district); $facility_name = null; $facility_banner_text = null; $no_of_facilities = 0; } else { $data['facilities'] = Facilities::getFacilities_from_facility_code($facility_code); $facility_banner_text = ' to: ' . $data['facilities'][0]['facility_name']; $facility_name = $data['facilities'][0]['facility_name']; $no_of_facilities = 1; } $data['counts'] = Users::get_users_district($district); $template = 'shared_files/template/template'; break; case 'moh_user': $data['listing'] = Users::get_user_list($user_type_id); $template = 'shared_files/template/dashboard_template_v'; break; case 'district_tech': $data['listing'] = Users::get_user_list($user_type_id); $template = 'shared_files/template/template'; break; case 'rtk_manager': $data['listing'] = Users::get_user_list($user_type_id); $template = 'shared_files/template/template'; break; case 'super_admin': $permissions = 'super_permissions'; $data['title'] = "Users"; $data['content_view'] = "Admin/users_v"; $data['listing'] = Users::get_user_list_all(); $data['counts'] = Users::get_users_count(); $data['counties'] = Counties::getAll(); $template = 'shared_files/template/dashboard_v'; break; case 'allocation_committee': $data['listing'] = Users::get_user_list($user_type_id); $template = 'shared_files/template/template'; break; case 'county': $permissions = 'county_permissions'; if ($facility_code == 0) { $data['facilities'] = Facilities::getFacilities($district); $facility_name = null; $facility_banner_text = null; $district_name = null; $district_id = null; $no_of_facilities = 0; } else { $data['facilities'] = Facilities::getFacilities_from_facility_code($facility_code); $facility_banner_text = ' to: ' . $data['facilities'][0]['facility_name']; $facility_name = $data['facilities'][0]['facility_name']; $district_id = $data['facilities'][0]['district']; $district_data = Districts::get_district_name($district_id); $district_name = $district_data[0]['district']; $no_of_facilities = 1; } $data['listing'] = Users::get_user_list_county($county); $data['district_data'] = districts::getDistrict($county); $data['counts'] = Users::get_users_county($county); $template = 'shared_files/template/template'; break; } $data['title'] = "Add Multiple Users"; $data['user_types'] = Access_level::get_access_levels($permissions); $data['banner_text'] = "Multiple User Addition"; $data['facility_name'] = $facility_name; $data['facility_code'] = $facility_code; $data['facility_banner_text'] = $facility_banner_text; $data['district_name'] = $district_name; $data['district_id'] = $district_id; $data['no_of_facilities'] = $no_of_facilities; $data['content_view'] = "shared_files/add_users_multiple"; $this->load->view($template, $data); }
public function edit_user() { $use_id = $this->uri->segment(3); //echo $use_id; $data['title'] = "Reset Details"; $data['content_view'] = "detail_reset_v"; $data['banner_text'] = "Reset Details"; $data['users_det'] = User::getAllUser($use_id); $data['level_l'] = Access_level::getAll1(); $data['counties'] = Counties::getAll(); $data['link'] = "details_reset_v"; $this->load->view("template", $data); }
/** * Update item by his id * @return void */ public function update() { $id = $this->uri->segment(4); $cat_id = $this->uri->segment(5); //if save button was clicked, get the data sent via post if ($this->input->server('REQUEST_METHOD') === 'POST') { $this->form_validation->set_rules('category_id', 'Category', 'required'); $this->form_validation->set_rules('title', 'Title', 'required|edit_unique[products.title.' . $id . ']'); $this->form_validation->set_rules('product_type', 'Product Type', 'required'); $this->form_validation->set_rules('uom', 'Unit of Measurement', 'required'); $this->form_validation->set_rules('qty', 'Quantity', 'required'); $this->form_validation->set_rules('price', 'Price', 'required'); $chckedImage = $_FILES['images']['name']; // if (empty($chckedImage)) { // $this->form_validation->set_rules('images', 'Product Image', 'required'); // } $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">×</a><strong>', '</strong></div>'); if ($this->form_validation->run()) { $path = './uploads/product'; $this->load->library('upload'); $this->upload->initialize(array("upload_path" => $path, "allowed_types" => "*")); if (!empty($chckedImage)) { $data = $this->functions->do_upload_one('images', './uploads/product'); $file_name = $data['upload_data']['file_name']; $_POST['images'] = $file_name; @unlink("./uploads/product/" . $this->input->post('old_image')); } else { $file_name = $this->input->post('old_image'); $_POST['images'] = $file_name; } //if the insert has returned true then we show the flash message $redirect_url = $this->input->post('redirect_url'); foreach ($_POST as $k => $v) { if (in_array($k, array('redirect_url'))) { unset($_POST[$k]); } } $uid = Access_level::session_user_id(); $products_id = $this->input->post('products_id'); $category_id = $this->input->post('category_id'); $qty = $this->input->post('qty'); $title = $this->input->post('title'); $price = $this->input->post('price'); $images = $this->input->post('images'); $description = $this->input->post('description'); $status = $this->input->post('status'); $uom = $this->input->post('uom'); $product_type = $this->input->post('product_type'); $where = " AND uom_id={$uom}"; $uom_unit = $this->common_model->getFieldData('uom', 'uom', $where); if ($uom_unit == "KG" || $uom_unit == "LTR") { $convertedQty = Access_level::convertToMlOrGm($qty); } else { $convertedQty = $qty; } $is_group = $this->input->post('is_group'); if (!empty($is_group)) { $is_combo = $is_group; } else { $is_combo = "NO"; } $data_to_store = array("uid" => $uid, "category_id" => $category_id, "title" => $title, "images" => $images, "description" => $description, "price" => $price, "qty" => $convertedQty, "is_group" => $is_combo, "status" => $status, "product_type" => $product_type, "uom" => $uom); if ($this->products_model->update_products($data_to_store, $products_id) == TRUE) { $this->session->set_flashdata('flash_message', 'updated'); } else { $this->session->set_flashdata('flash_message', 'not_updated'); } $this->session->set_flashdata('flash_message', 'update'); redirect($redirect_url); } //validation run } $data['product_type_opt'] = $this->config->item('product_type_flag'); $data['uom_opt'] = $this->common_model->getDDArray('uom', 'uom_id', 'uom'); //if we are updating, and the data did not pass trough the validation //the code below wel reload the current data //product data $where = " AND parent_id= '0' "; $data['main_category_opt'] = $this->common_model->getDDArray('category', 'category_id', 'category_name', $where); //$data['country_opt'] = $this->common_model->getDDArray('country', 'country_id', 'country_name'); $data['products'] = $this->products_model->get_products_by_id($id); if ($data['products'][0]['category_id'] != "") { $where_subcategory = " AND parent_id!= '0' AND category_id='{$data['products'][0]['category_id']}'"; $data['subcategory_opt'] = $this->common_model->getDDArray('category', 'category_id', 'category_name', $where_subcategory); } //echo $id; die; $data['category'] = $this->category_model->get_category_by_id($cat_id); //echo "<pre>"; print_r($data['category']); die; $data['par_cat_array'] = $this->category_model->getParentCategoryList(0, $old_cat = "", 0, 1, 5); $data['main_content'] = 'admin/products/edit'; $this->load->view('admin/includes/template', $data); }
function addPosts() { $insertArr['uid '] = Access_level::session_user_id(); $insertArr['category_id'] = $_POST['category_id']; $insertArr['title'] = $_POST['title']; $insertArr['price'] = $_POST['price']; $insertArr['images'] = $_POST['images']; $insertArr['description'] = $_POST['description']; $insertArr['status'] = $_POST['status']; $insertArr['is_group'] = isset($_POST['is_group']) ? $_POST['is_group'] : ""; $insert = $this->db->insert('products', $insertArr); return $insert; }
public function add() { //echo "<pre>"; print_r($_POST); die; //if save button was clicked, get the data sent via post if ($this->input->server('REQUEST_METHOD') === 'POST') { //form validation $this->form_validation->set_rules('firstname', 'First name', 'trim|required'); $this->form_validation->set_rules('username', 'User name', 'trim|required|min_length[4]|is_unique[user.username]'); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[4]|max_length[32]'); $this->form_validation->set_rules('password2', 'Password Confirmation', 'trim|required|matches[password]'); $this->form_validation->set_rules('primary_email', 'primary E-mail', 'trim|required|valid_email|is_unique[user.primary_email]'); $this->form_validation->set_rules('company_id', 'Company name', 'trim|required'); $this->form_validation->set_error_delimiters('<div class="alert alert-error"><a class="close" data-dismiss="alert">×</a><strong>', '</strong></div>'); //if the form has passed through the validation if ($this->form_validation->run()) { $data = $this->functions->do_upload('avatar', './uploads/avatar/'); if (isset($data['upload_data'])) { $file_name = $data['upload_data']['file_name']; } else { $file_name = ""; } if (is_array($this->input->post('user_interests'))) { $user_interests = implode(",", $this->input->post('user_interests')); } else { $user_interests = ''; } if (is_array($this->input->post('language_id'))) { $language_ids = implode(",", $this->input->post('language_id')); } else { $language_ids = ''; } $user_rand_id = $this->functions->get_user_rand_id(); $data_to_store = array('firstname' => $this->input->post('firstname'), 'lastname' => $this->input->post('lastname'), 'username' => $this->input->post('username'), 'password' => $this->__encrip_password($this->input->post('password')), 'primary_email' => $this->input->post('primary_email'), 'company_id' => $this->input->post('company_id'), 'phone' => $this->input->post('phone'), 'user_type' => $this->input->post('user_type'), 'joining_date' => $this->input->post('joining_date'), 'end_date' => $this->input->post('end_date'), 'status' => $this->input->post('status')); //echo "<pre>"; print_r($data_to_store); die; //if the insert has returned true then we show the flash message if ($this->user_model->store_user($data_to_store)) { $user_id = $this->db->insert_id(); $ex_data = array('user_id' => $user_id, 'parent_user_id' => Access_level::session_user_id(), 'user_type' => $this->input->post('user_type')); $this->user_role_extended_model->store_user_role_extended($ex_data); $data['flash_message'] = TRUE; $this->session->set_flashdata('flash_message', 'add'); redirect('admin/user/'); //redirect('admin/user'.''); } else { $data['flash_message'] = FALSE; } } } $data['company'] = $this->company_model->get_company('', '', 'DESC', '', '', 'Active'); $data['main_content'] = 'admin/user/add'; $this->load->view('admin/includes/template', $data); }
<div class="control-group"> <label for="inputError" class="control-label">Unit of Measurement:-<span class="star">*</span></label> <div class="controls"> <?php $js = ""; $attribute = 'id="uom" onchange="' . $js . '" '; echo form_dropdown('uom', $uom_opt, $products_content['uom'], $attribute); ?> </div> </div> <?php $where = " AND uom_id={$products_content['uom']}"; $uom_unit = $ci->common_model->getFieldData('uom', 'uom', $where); if ($uom_unit == "KG" || $uom_unit == "LTR") { $convertedQty = Access_level::convertToLTROrKG($products_content['qty']); } else { $convertedQty = $products_content['qty']; } ?> <div class="control-group"> <label for="inputError" class="control-label">Quantity<span class="star">*</span></label> <div class="controls"> <input type="text" id="" name="qty" value="<?php echo $convertedQty; ?> "> </div> </div> <div class="control-group"> <label for="inputError" class="control-label">Price</label>
?> </h2> </div> <?php //form data $attributes = array('class' => 'form-horizontal', 'id' => ''); //form validationc echo validation_errors(); echo form_open_multipart('admin/user/add', $attributes); ?> <fieldset> <div class="control-group"> <label for="inputError" class="control-label">User Type</label> <div class="controls"> <?php $user_role_array = Access_level::user_role_dropdown(); $ci =& get_instance(); $user_type = $ci->session->userdata('type_of_membership'); ?> <select name="type_of_membership"> <?php foreach ($user_role_array[$user_type] as $key => $role_val) { ?> <option <?php echo custom_set_value('type_of_membership') == $key ? 'selected="selected"' : ''; ?> value="<?php echo $key; ?> "><?php