public function edit_district($code)
 {
     $district = District::getDistrict($code);
     $data['district'] = $district[0];
     $data['title'] = "District Management::Edit " . $district->name . " District";
     $data['module_view'] = "add_district_view";
     $data['quick_link'] = "new_district";
     $data['provinces'] = Province::getAll();
     $this->base_params($data);
 }
 public function edit_user($id)
 {
     $user = Users::getUser($id);
     $data['user'] = $user;
     $data['title'] = "User Management::Edit " . $user->Name . "'s Details";
     $data['title'] = "User Management::Add New User";
     $data['module_view'] = "add_user_view";
     $data['levels'] = Access_Level::getAll();
     $data['districts'] = District::getAll();
     $data['provinces'] = Province::getAll();
     $this->base_params($data);
 }
Ejemplo n.º 3
0
 public function view_list()
 {
     $year = $this->input->post("year");
     $epiweek = $this->input->post("epiweek");
     $dnr_districts = District::getDNRDistricts($year, $epiweek);
     $provinces = Province::getAll();
     $data['provinces'] = $provinces;
     $data['dnr_districts'] = $dnr_districts;
     $data['report_view'] = "dnr_districts_v";
     $data['small_title'] = "DNR Districts in " . $year . " Epiweek " . $epiweek;
     $this->base_params($data);
 }
 public function edit_weekly_data($epiweek, $reporting_year, $district)
 {
     $provinces = Province::getAll();
     $districts = District::getAll();
     $diseases = Disease::getAllObjects();
     $data['provinces'] = $provinces;
     $data['districts'] = $districts;
     $data['diseases'] = $diseases;
     $data['prediction'] = Surveillance::getPrediction();
     $data['surveillance_data'] = Surveillance::getSurveillanceData($epiweek, $reporting_year, $district);
     $data['lab_data'] = Lab_Weekly::getWeeklyDistrictLabData($epiweek, $reporting_year, $district);
     $data['editing'] = true;
     $data['scripts'] = array("special_date_picker.js", "validationEngine-en.js", "validator.js");
     $data["styles"] = array("validator.css");
     $this->base_params($data);
 }
 public function add()
 {
     $provinces = Province::getAll();
     $districts = District::getAll();
     $facilities = Facilities::getAll();
     $diseases = Disease::getAllObjects();
     $data['provinces'] = $provinces;
     $data['districts'] = $districts;
     $data['facilities'] = $facilities;
     $data['diseases'] = $diseases;
     $data['scripts'] = array("jquery.ui.core.js", "jquery.ui.datepicker.js", "jquery.ui.widget.js");
     $data['styles'] = array("jquery.ui.all.css");
     $data['title'] = "Line List Data";
     $data['content_view'] = "linelist_data_add_v";
     $data['banner_text'] = "Linelist Data";
     $data['link'] = "submissions_management";
     $data['quick_link'] = "linelisted_data_management";
     $this->base_params($data);
     //$this -> load -> view("template", $data);
 }
 public function edit_duplicate($number_of_diseases, $first_surveillance_id, $malaria_data_id)
 {
     $last_surveillance_id = $first_surveillance_id + $number_of_diseases - 1;
     $provinces = Province::getAll();
     $districts = District::getAll();
     $diseases = Disease::getAllObjects();
     $data['provinces'] = $provinces;
     $data['districts'] = $districts;
     $data['diseases'] = $diseases;
     $data['prediction'] = Surveillance::getPrediction();
     $data['surveillance_data'] = Surveillance::getSurveillanceDataRange($first_surveillance_id, $last_surveillance_id);
     $data['lab_data'] = Lab_Weekly::getLabObjects($malaria_data_id);
     $data['editing'] = true;
     $data['scripts'] = array("special_date_picker.js", "validationEngine-en.js", "validator.js");
     $data["styles"] = array("validator.css");
     $data['title'] = "Duplicate Data Editing";
     $data['content_view'] = "weekly_data_add_v";
     $data['banner_text'] = "Weekly Data Correction";
     $data['link'] = "data_quality_management";
     $this->load->view("template", $data);
 }
 public function provincialDetails($epiweek, $diseaseId)
 {
     $currentyear = date('Y');
     $submissions = Surveillance::getLastEpiweek($currentyear);
     $provinces = Province::getAll();
     $years = Surveillance::getYears();
     $data['selected_epiweek'] = $submissions->epiweek;
     $data['provinces'] = $provinces;
     $data['years'] = $years;
     $data['values'] = $this->getAllProvinces($epiweek, $diseaseId, $provinces);
     $name = Disease::getName($diseaseId);
     $data['diseaseName'] = $name->Name;
     $data['content_view'] = 'submissions_prov_v';
     $this->base_params($data);
 }
 function dave()
 {
     $year = $_POST['year'];
     $disease = $_POST['disease'];
     $province = $_POST['province'];
     $epiweek = $_POST['epiweek'];
     $values = array($year, $disease, $province, $epiweek);
     $currentyear = date('Y');
     $rights = User_Right::getRights($this->session->userdata('access_level'));
     $menu_data = array();
     $menus = array();
     $counter = 0;
     foreach ($rights as $right) {
         $menu_data['menus'][$right->Menu] = $right->Access_Type;
         $menus['menu_items'][$counter]['url'] = $right->Menu_Item->Menu_Url;
         $menus['menu_items'][$counter]['text'] = $right->Menu_Item->Menu_Text;
         $counter++;
     }
     $this->session->set_userdata($menu_data);
     $this->session->set_userdata($menus);
     $provinces = Province::getAll();
     $epiweeks = Surveillance::getEpiweek();
     $years = Surveillance::getYears();
     $diseases = Diseases::getAllObjects();
     $this->load->database();
     $sql = 'select Districts.name as District, Lmcase,Gmcase,Lfcase,Gfcase from Surveillance,Districts,Diseases where Epiweek = ? and Disease = ? and Reporting_Year = ? and abs(Lmcase) != 0 and abs(Gmcase) != 0 and abs(Lfcase) != 0 and ABS(Gfcase) != 0  and surveillance.disease=diseases.id and surveillance.district=districts.id';
     $query = $this->db->query($sql, array($epiweek, $disease, $year));
     $data['epidemiks'] = $query->result_array();
     $data['epiweeks'] = $epiweeks;
     $data['provinces'] = $provinces;
     $data['years'] = $years;
     $data['diseases'] = $diseases;
     $data['values'] = $values;
     $data['scripts'] = array("FusionCharts/FusionCharts.js");
     $data['title'] = "System Home";
     $data['content_view'] = "home_v";
     $data['banner_text'] = "System Home";
     $data['link'] = "home";
     $this->load->view("template", $data);
 }
Ejemplo n.º 9
0
 public function generate()
 {
     $bata_buffer = "";
     $year = $this->input->post('year_from');
     $epiweek = $this->input->post('epiweek_to');
     $province = $this->input->post('province');
     $district = $this->input->post('district');
     $display_type = $this->input->post('display_type');
     $weekending = Surveillance::getWeekEnding($year, $epiweek);
     $provinces = array();
     $districts = array();
     //Check if a province has been specified
     if ($province > 0) {
         //if so, retrieve it's details from the database
         $provinces = Province::getProvince($province);
     } else {
         //if not, retrieve all provinces
         $provinces = Province::getAll();
     }
     //Check if a district has been specified
     if ($district > 0) {
         //if so, retrieve it's details from the database
         $districts = District::getDistrict($district);
         //also, retrieve the province details for this district
         $provinces = Province::getProvince($districts[0]['Province']);
     } else {
         //if not, empty the array
         $districts = array();
     }
     //Start displaying the header of the table
     $bata_buffer .= " <table class='data-table'>\n            <tr style='background: #F5D2AE;'>\n                <th rowspan=2>Province</th>\n                <th rowspan=2>District</th>\n                <th rowspan=2>Reports Expected</th>\n                <th rowspan=2>Reports Received</th>\n                <th rowspan=2>%RR</th>";
     $diseases["reports"] = "reports";
     $diseases["submitted"] = "submitted";
     $diseases["percentage"] = "percentage";
     $disease_array = Disease::getAll();
     foreach ($disease_array as $disease) {
         if ($disease['Name'] == 'Malaria') {
             $diseases[$disease['id']] = $disease['Name'];
             $diseases["tested"] = "tested";
             $diseases["positive"] = "positive";
             $bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
             $bata_buffer .= "<th  colspan=2 style='color:green;'>" . $disease['Name'] . " Indicators</th>";
         } else {
             $diseases[$disease['id']] = $disease['Name'];
             $bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
         }
     }
     //Finish Displaying the Header
     $bata_buffer .= " </tr>\n            <tr style='background: #F5D2AE'>\n                 <th >Tested</th><th >Positive</th>\n            </tr>\n\t\t";
     //Start retrieving all the rows for the data
     foreach ($provinces as $province_object) {
         $bata_buffer .= "<tr class='even'><td style='font-weight:bold; font-size:14px'>" . $province_object->Name . "</td></tr>";
         $province_districts = array();
         //check if a district was specified
         if (count($districts) > 0) {
             $province_districts = $districts;
         } else {
             //Get all the districts for this province
             $province_districts = district::getProvinceDistrict($province_object->id);
         }
         //loop through all the districts to get their data
         foreach ($province_districts as $province_district) {
             $available_data = array();
             $surveillance_counter = 2;
             $bata_buffer .= "<tr class='even' style='background:#C4E8B7'><td></td><td>" . $province_district['Name'] . "</td>";
             $surveillance_data = Surveillance::getWeeklySummaries($year, $epiweek, $province_district['id']);
             //Check if any surveillance data exists
             if (isset($surveillance_data[0])) {
                 $available_data['reports'] = $surveillance_data[0]['Expected'];
                 $available_data['submitted'] = $surveillance_data[0]['Submitted'];
                 //Calculate the reporting
                 $available_data['percentage'] = floor($available_data['submitted'] / $available_data['reports'] * 100);
                 //Display these Parameters
                 $bata_buffer .= "<td>" . $available_data['reports'] . "</td><td>" . $available_data['submitted'] . "</td><td>" . $available_data['percentage'] . "</td>";
             } else {
                 $bata_buffer .= "<td>DNR</td><td>DNR</td><td>0</td>";
             }
             //Check if there is any surveillance data
             if (isset($surveillance_data[0])) {
                 //Loop through all the surveillance data returned
                 foreach ($surveillance_data as $disease_data) {
                     $bata_buffer .= "<td>" . $disease_data['Cases'] . "(" . $disease_data['Deaths'] . ")</td>";
                     //Check if the disease is malaria and if so, get the lab data and display it
                     if ($disease_data['Disease'] == 1) {
                         //Get malaria data
                         $lab_weekly_data = Lab_Weekly::getWeeklyLabData($year, $epiweek, $province_district['id']);
                         //Check if any data exists
                         if (isset($lab_weekly_data)) {
                             $bata_buffer .= "<td>" . $lab_weekly_data['Tested'] . "</td><td>" . $lab_weekly_data['Positive'] . "</td>";
                         } else {
                             $bata_buffer .= "<td>DNR</td><td>DNR</td>";
                         }
                     }
                 }
             } else {
                 $total_diseases = count($disease_array);
                 $total_elements = $total_diseases + 1;
                 for ($x = 0; $x <= $total_elements; $x++) {
                     $bata_buffer .= "<td>DNR</td>";
                 }
             }
             //Marks the end of data for one district
             $bata_buffer .= "</tr>";
         }
         //End districts loop
     }
     //End provinces loop
     //Finish the table
     $bata_buffer .= "</table>";
     //Start section that shows cumulative data
     $bata_buffer .= "<table class='data-table'>\n            <tr style='background: #F5D2AE;'>\n                <th rowspan='2' colspan='5'>Cumulative Summaries</th>";
     //Loop through all the diseases to display their names
     foreach ($disease_array as $disease) {
         if ($disease['Name'] == 'Malaria') {
             $diseases[$disease['id']] = $disease['Name'];
             $diseases["tested"] = "tested";
             $diseases["positive"] = "positive";
             $bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
             $bata_buffer .= "<th  colspan=2 style='color:green;'>" . $disease['Name'] . " Indicators</th>";
         } else {
             $diseases[$disease['id']] = $disease['Name'];
             $bata_buffer .= "<th rowspan=2>" . $disease['Name'] . "</th>";
         }
     }
     //end diseases loop
     $bata_buffer .= "</tr>\n            <tr style='background: #F5D2AE'>\n                <th >Tested</th><th >Positive</th>\n            </tr>";
     //Get the malaria lab data summaries
     $lab_weekly_summary = Lab_Weekly::getWeeklyLabSummaries($year, $epiweek);
     //Start Displaying this week summary
     $bata_buffer .= "<tr class='even'><td rowspan='2' colspan='5'>Week " . $epiweek . " Summary</td>";
     //Get the summary for the week. Disease cases vs. deaths
     $disease_deaths = array();
     foreach ($disease_array as $disease_object) {
         $disease_summaries = Surveillance::getWeeklyDiseaseSummaries($year, $epiweek, $disease_object['id']);
         $bata_buffer .= "<td>" . $disease_summaries['Cases'] . "</td>";
         $disease_deaths[$disease_object['id']] = $disease_summaries['Deaths'];
         //check if the disease is Malaria. If so, display lab data
         if ($disease_object['Name'] == "Malaria") {
             $bata_buffer .= "<td rowspan=2>" . $lab_weekly_summary['Tested'] . "</td>";
             $bata_buffer .= "<td rowspan=2>" . $lab_weekly_summary['Positive'] . "</td>";
         }
     }
     //Finish the cases row
     $bata_buffer .= "</tr>";
     //Start the deaths row
     $bata_buffer .= "<tr>";
     //Loop through one more time to display the total number of deaths
     foreach ($disease_array as $disease_object) {
         $bata_buffer .= "<td>(" . $disease_deaths[$disease_object['id']] . ")</td>";
     }
     //finish the deaths row
     $bata_buffer .= "</tr>";
     //Get the annual summary
     //Get the malaria lab data summaries
     $lab_weekly_summary = Lab_Weekly::getAnnualLabSummaries($year);
     //Start Displaying this week summary
     $bata_buffer .= "<tr class='even' style='background:#BB00FF'><td rowspan='2' colspan='5'>Years Cummulative Summary</td>";
     //Get the summary for the week. Disease cases vs. deaths
     $disease_deaths = array();
     foreach ($disease_array as $disease_object) {
         $disease_summaries = Surveillance::getAnnualDiseaseSummaries($year, $disease_object['id']);
         $bata_buffer .= "<td>" . $disease_summaries['Cases'] . "</td>";
         $disease_deaths[$disease_object['id']] = $disease_summaries['Deaths'];
         //check if the disease is Malaria. If so, display lab data
         if ($disease_object['Name'] == "Malaria") {
             $bata_buffer .= "<td rowspan=2>" . $lab_weekly_summary['Tested'] . "</td>";
             $bata_buffer .= "<td rowspan=2>" . $lab_weekly_summary['Positive'] . "</td>";
         }
     }
     //Finish the cases row
     $bata_buffer .= "</tr>";
     //Start the deaths row
     $bata_buffer .= "<tr class='even' style='background:#BB00FF'>";
     //Loop through one more time to display the total number of deaths
     foreach ($disease_array as $disease_object) {
         $bata_buffer .= "<td>(" . $disease_deaths[$disease_object['id']] . ")</td>";
     }
     //finish the deaths row
     $bata_buffer .= "</tr></table>";
     $this->generatePDF($year, $bata_buffer, $epiweek, $weekending, $display_type);
 }