Esempio n. 1
0
 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);
 }