本文整理汇总了PHP中Facilities::getDistrictFacilities方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::getDistrictFacilities方法的具体用法?PHP Facilities::getDistrictFacilities怎么用?PHP Facilities::getDistrictFacilities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facilities
的用法示例。
在下文中一共展示了Facilities::getDistrictFacilities方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_disbursement
public function new_disbursement($id = null)
{
if ($id != null) {
$disbursement = Disbursements::getDisbursement($id);
$data['disbursement'] = $disbursement[0];
$data['edit'] = true;
$data['id'] = $id;
}
$districts = new Districts();
$regions = new Regions();
$facilities = new Facilities();
$additional_facilities = new Additional_Facilities();
$data['vaccines'] = Vaccines::getAll_Minified();
$archive_date = date('U');
$data['stock_balance'] = array();
$district_or_region = $this->session->userdata('district_province_id');
//Retrieve the user identifier from the session
$identifier = $this->session->userdata('user_identifier');
//Check if it's a provincial officer
if ($identifier == 'provincial_officer') {
foreach ($data['vaccines'] as $vaccine) {
$data['stock_balance'][$vaccine->id] = Disbursements::getRegionalPeriodBalance($district_or_region, $vaccine->id, $archive_date);
}
$data['districts'] = $districts->getAllDistricts();
$data['regions'] = $regions->getAllRegions();
} else {
if ($identifier == 'district_officer') {
foreach ($data['vaccines'] as $vaccine) {
$data['stock_balance'][$vaccine->id] = Disbursements::getDistrictPeriodBalance($district_or_region, $vaccine->id, $archive_date);
}
$district_province = $districts->getDistrictProvince($district_or_region);
$data['districts'] = $districts->getProvinceDistricts($district_province['province']);
$data['facilities'] = $facilities->getDistrictFacilities($district_or_region);
$data['additional_facilities'] = $additional_facilities->getExtraFacilities($district_or_region);
} else {
if ($identifier == 'national_officer') {
foreach ($data['vaccines'] as $vaccine) {
$data['stock_balance'][$vaccine->id] = Disbursements::getNationalPeriodBalance($vaccine->id, $archive_date);
}
$data['districts'] = $districts->getAllDistricts();
$data['regions'] = $regions->getAllRegions();
}
}
}
$data['title'] = "Disbursement Management::Disburse Vaccines";
$data['content_view'] = "add_disbursement_view";
$data['quick_link'] = "new_disbursement";
$this->base_params($data);
}
示例2: add
public function add($data = array())
{
$access_level = $this->session->userdata('user_indicator');
if ($access_level == "district_clerk") {
$district = $this->session->userdata('district_province_id');
$data['facilities'] = Facilities::getDistrictFacilities($district);
}
$provinces = Province::getAll();
$districts = District::getAll();
$diseases = Disease::getAllObjects();
$data['provinces'] = $provinces;
$data['districts'] = $districts;
$data['diseases'] = $diseases;
$data['editing'] = false;
$data['prediction'] = Surveillance::getPrediction();
$data['scripts'] = array("special_date_picker.js", "validationEngine-en.js", "validator.js");
$data["styles"] = array("validator.css");
$this->base_params($data);
}
示例3: get_district_facilities
public function get_district_facilities($district) {
$facilities = Facilities::getDistrictFacilities($district);
$facilities_array = array();
$counter = 0;
foreach ($facilities as $facility) {
$facility_details = array("facility_code" => utf8_encode($facility -> facilitycode), "name" => utf8_encode($facility -> name));
$facilities_array[$counter] = $facility_details;
$counter++;
}
echo json_encode($facilities_array);
}
示例4: send_emails
public function send_emails()
{
$this->load->helper(array('file'));
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = stripslashes('D.V.I.VaccinesKenya@gmail.com');
$config['smtp_pass'] = stripslashes('projectDVI');
$this->load->library('email', $config);
$this->load->database();
$period = 'Jun-12';
//First, retrieve all the districts that have recipients
$sql = "select distinct district, d.name as district_name from stock_out_recipient s left join districts d on district = d.id where s.disabled = '0'";
$query = $this->db->query($sql);
$district_array = $query->result_array();
//get the total number of vaccines that report dhis data
$vaccine_number = Vaccines::getTotalDHIS();
$vaccine_number++;
//Get the vaccines wiith dhis data
$vaccines = Vaccines::getDHIS();
$months = array();
foreach ($district_array as $district) {
$data_buffer = "\n\t\t\t<style>\n\t\t\ttable.data-table {\n\t\t\ttable-layout: fixed;\n\t\t\twidth: 1000px;\n\t\t\tborder-collapse:collapse;\n\t\t\tborder:1px solid black;\n\t\t\tmargin-top:20px;\n\t\t\t}\n\t\t\ttable.data-table td, th {\n\t\t\twidth: 100px;\n\t\t\tborder: 1px solid black;\n\t\t\t}\n\t\t\t.leftie{\n\t\t\t\ttext-align: left !important;\n\t\t\t}\n\t\t\t.right{\n\t\t\t\ttext-align: right !important;\n\t\t\t}\n\t\t\t.center{\n\t\t\t\ttext-align: center !important;\n\t\t\t}\n\t\t\t</style> \n\t\t\t";
$data_buffer .= "<table class='data-table'>";
$data_buffer .= $this->echoTitles();
$data_buffer .= "<tr>";
//loop through all the months in the season
for ($x = 1; $x <= 12; $x++) {
//get the month name
$text = "2012-" . $x . "-1";
$period = date("M-y", strtotime($text));
$months[$x] = $period;
$data_buffer .= "<td>" . $period . "</td>";
}
$data_buffer .= "</tr>";
//Loop through the returned districts, generating a report for each
$district_name = $district['district_name'];
$district = $district['district'];
//get all facilities for this district
$facilities = Facilities::getDistrictFacilities($district);
//loop through all the facilities to return immunization data
foreach ($facilities as $facility) {
$data_buffer .= "<tr><td rowspan='{$vaccine_number}'>" . $facility->name . "</td>";
$data_buffer .= "<td>Children Immunized</td>";
//get the total number of children immunized in this facility
foreach ($months as $month) {
$sql_children = "select fully_immunized_children from dhis_data where facility_code = '{$facility->facilitycode}' and reporting_period = '{$month}'";
$query_children = $this->db->query($sql_children);
$immunized_children = $query_children->row_array();
if (isset($immunized_children['fully_immunized_children'])) {
$data_buffer .= "<td>" . $immunized_children['fully_immunized_children'] . "</td>";
} else {
$data_buffer .= "<td>N/A</td>";
}
}
$data_buffer .= "</tr>";
foreach ($vaccines as $vaccine) {
$data_buffer .= "<tr><td>" . $vaccine->Name . "</td>";
$dhis_remaining = $vaccine->Dhis_Remaining;
$dhis_received = $vaccine->Dhis_Received;
$dhis_stock = $vaccine->Dhis_Stock;
foreach ($months as $month) {
//For each vaccine, create a query to get its dhis data
$sql_remaining = "select {$dhis_remaining}, {$dhis_received}, {$dhis_stock} from dhis_data where facility_code = '{$facility->facilitycode}' and reporting_period = '{$month}'";
$query_remaining = $this->db->query($sql_remaining);
$remaining_stock = $query_remaining->row_array();
//var_dump($query_remaining);
if (!empty($remaining_stock)) {
if (strlen($remaining_stock[$dhis_received]) > 0 || strlen($remaining_stock[$dhis_remaining]) > 0 || strlen($remaining_stock[$dhis_stock]) > 0) {
if ($remaining_stock[$dhis_remaining] == "0" || $remaining_stock[$dhis_remaining] == "" || $remaining_stock[$dhis_remaining] == null) {
$data_buffer .= "<td style='background-color: red;'>" . $remaining_stock[$dhis_remaining] . "</td>";
} else {
$data_buffer .= "<td>" . $remaining_stock[$dhis_remaining] . "</td>";
}
} else {
$data_buffer .= "<td style='text-align:center'>-</td>";
}
} else {
$data_buffer .= "<td style='text-align:center'>-</td>";
}
}
}
$data_buffer .= "</tr>";
}
$data_buffer .= "</table>";
//echo $data_buffer;
$this->generatePDF($data_buffer, $district_name);
}
}