public function new_weekly_usage($year = null, $month = null) { if (!isset($month)) { $month = date('m'); } if (!isset($year)) { $year = date('Y'); } $full_date = $year . '-' . $month . '-01'; $month_text = date('F', strtotime($full_date)); $data['year'] = $year; $data['month'] = $month; $data['month_text'] = $month_text; $data['title'] = "System Usage"; $data['content_view'] = "Admin/new_log_summary_v"; $data['banner_text'] = "System Usage"; $start_date = $year . '-' . $month . '-01'; $end_date = $year . '-' . $month . '-31'; $logged_within_month = Facilities::get_facilities_logged_in_month($start_date, $end_date); $issued_within_month = Facilities::get_facilities_issued_in_month($start_date, $end_date); $not_logged_within_month = Facilities::get_facilities_not_in_month($start_date, $end_date); $not_issued_within_month = Facilities::get_facilities_not_in_month($start_date, $end_date, null, null, 'issued'); $logged_within_month_4 = Facilities::get_facilities_count($start_date, $end_date, 4); $issued_within_month_4 = Facilities::get_facilities_count($start_date, $end_date, 4, null, null, 'issued'); $data['monthly_logs'] = array('logged_in' => $logged_within_month, 'not_logged_in' => $not_logged_within_month, 'logged_in_count' => $logged_within_month_4, 'issued_within_month' => $issued_within_month, 'issued_count' => $issued_within_month_4, 'not_issued' => $not_issued_within_month); $this->load->view("shared_files/template/dashboard_v", $data); }
public function new_system_usage_temp($year = null, $month = null, $ajax = null) { $identifier = $this->session->userdata('user_indicator'); $district_id = null; $county_id = null; if ($identifier == 'district') { $district_id = $this->session->userdata('district_id'); } if ($identifier == 'county') { $county_id = $this->session->userdata('county_id'); } // echo "$identifier";die; if (!isset($month)) { $month = date('m'); } if (!isset($year)) { $year = date('Y'); } $full_date = $year . '-' . $month . '-01'; $month_text = date('F', strtotime($full_date)); $data['year'] = $year; $data['month'] = $month; $data['month_text'] = $month_text; $data['title'] = " System Usage"; $data['banner_text'] = "System Use Statistics"; $data['content_view'] = "subcounty/ajax/new_system_usage_temporary"; $start_date = $year . '-' . $month . '-01'; $end_date = $year . '-' . $month . '-31'; $logged_within_month = Facilities::get_facilities_logged_in_month($start_date, $end_date, null, $county_id, $district_id); $issued_within_month = Facilities::get_facilities_issued_in_month($start_date, $end_date, null, $county_id, $district_id); $not_logged_within_month = Facilities::get_facilities_not_logged_in_month($start_date, $end_date, $county_id, $district_id); $not_issued_within_month = Facilities::get_facilities_not_issued_in_month($start_date, $end_date, $county_id, $district_id); $logged_within_month_4 = Facilities::get_facilities_count($start_date, $end_date, 4); // $logged_within_month_4 = Facilities::get_facilities_logged_in_count($start_date,$end_date,4,$county_id,$district_id); $issued_within_month_4 = Facilities::get_facilities_issued_in_count($start_date, $end_date, 4, $county_id, $district_id); $facilities_offline = Facilities::get_offline_facilities($county_id, $district_id); $data['monthly_logs'] = array('logged_in' => $logged_within_month, 'not_logged_in' => $not_logged_within_month, 'logged_in_count' => $logged_within_month_4, 'issued_within_month' => $issued_within_month, 'issued_count' => $issued_within_month_4, 'not_issued' => $not_issued_within_month, 'facilities_offline' => $facilities_offline); $view = null; if ($ajax != null) { $view = "subcounty/ajax/system_usage_filtered_ajax"; } else { $view = "subcounty/ajax/new_system_usage_temporary"; } return $this->load->view($view, $data); }