本文整理汇总了PHP中Facilities::get_Facilities_using_HCMP方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::get_Facilities_using_HCMP方法的具体用法?PHP Facilities::get_Facilities_using_HCMP怎么用?PHP Facilities::get_Facilities_using_HCMP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facilities
的用法示例。
在下文中一共展示了Facilities::get_Facilities_using_HCMP方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_sub_county_facility_mapping_data
public function get_sub_county_facility_mapping_data($year = null, $month = NULL)
{
$year = isset($year) && $year > 0 ? $year : date("Y");
$month = isset($month) && $month > 0 ? $month : date("m");
$identifier = $this->session->userdata('user_indicator');
$county_id = $this->session->userdata('county_id');
//Get facility code
$facility_code = $this->session->userdata('facility_id');
$facility_code_ = isset($facility_code) && $facility_code > 0 ? facilities::get_facility_name_($facility_code)->toArray() : null;
$facility_name = $facility_code_[0]['facility_name'];
$district_id = $this->session->userdata('district_id');
$district = $this->session->userdata('district_id');
//Get the name of the county
$county_name = Counties::get_county_name($county_id);
$county_name = $county_name;
// echo $county_id."<pre>";echo $county_name;echo "</pre>";exit;
//get the name of the district
$district_name_ = isset($district_id) && $district_id > 0 ? Districts::get_district_name_($district_id) : null;
$district_name = $district_name_['district'];
$first_day_of_the_month = date("Y-m-1", strtotime(date($year . "-" . $month)));
$last_day_of_the_month = date("Y-m-t", strtotime(date($year . "-" . $month)));
$date_1 = new DateTime($first_day_of_the_month);
$date_2 = new DateTime($last_day_of_the_month);
$facility_data = Facilities::get_Facilities_using_HCMP($county_id, $district);
// echo "<pre>";print_r($facility_data);echo "</pre>";exit;
$series_data = array();
$category_data = array();
$series_data_monthly = array();
$category_data_monthly = array();
$seconds_diff = strtotime($last_day_of_the_month) - strtotime($first_day_of_the_month);
$date_diff = floor($seconds_diff / 3600 / 24);
switch ($identifier) {
case 'county':
$graph_category_data = $facility_data;
$graph_title = $county_name['county'] . " County ";
break;
case 'facility_admin':
case 'facility':
$graph_category_data = $facility_data;
$graph_title = $facility_name;
break;
case 'district':
$graph_category_data = $facility_data;
$graph_title = $district_name . " SubCounty ";
break;
}
for ($i = 0; $i <= $date_diff; $i++) {
$day = 1 + $i;
$new_date = "{$year}-{$month}-" . $day;
$new_date = date('Y-m-d', strtotime($new_date));
if (date('N', strtotime($new_date)) < 6) {
$date_ = date('D d', strtotime($new_date));
$category_data = array_merge($category_data, array($date_));
$temp_1 = array();
foreach ($graph_category_data as $facility_) {
$facility_id = $facility_->facility_code;
$facility_name = $facility_->facility_name;
$subcounty_data = Log::get_subcounty_login_count($county_id, $district_id, $facility_id, $new_date);
array_key_exists($facility_name, $series_data) ? $series_data[$facility_name] = array_merge($series_data[$facility_name], array((int) $subcounty_data[0]['total'])) : ($series_data = array_merge($series_data, array($facility_name => array((int) $subcounty_data[0]['total']))));
}
} else {
// do nothing
}
}
//for setting the month name in the graph when filtering
$m = date('F', strtotime('2000-' . $month . '-01'));
$graph_data_daily = array();
$graph_data_daily = array_merge($graph_data_daily, array("graph_id" => 'container'));
$graph_data_daily = array_merge($graph_data_daily, array("graph_title" => 'Daily Facility Access log for ' . $m . " for " . $graph_title));
$graph_data_daily = array_merge($graph_data_daily, array("graph_type" => 'line'));
$graph_data_daily = array_merge($graph_data_daily, array("graph_yaxis_title" => 'log In'));
$graph_data_daily = array_merge($graph_data_daily, array("graph_categories" => array()));
$graph_data_daily = array_merge($graph_data_daily, array("series_data" => $series_data));
$graph_data_daily['graph_categories'] = $category_data;
$graph_daily = $this->hcmp_functions->create_high_chart_graph($graph_data_daily);
for ($i = 0; $i < 12; $i++) {
$day = 1 + $i;
//changed it to be a month
$new_date = "{$year}-{$day}";
$new_date = date('Y-m', strtotime($new_date));
$date_ = date('M', strtotime($new_date));
$category_data_monthly = array_merge($category_data_monthly, array($date_));
foreach ($graph_category_data as $facility_) {
$facility_id = $facility_->facility_code;
$facility_name = $facility_->facility_name;
$subcounty_data = Log::get_subcounty_login_monthly_count($county_id, $district_id, $facility_id, $new_date);
array_key_exists($facility_name, $series_data_monthly) ? $series_data_monthly[$facility_name] = array_merge($series_data_monthly[$facility_name], array((int) $subcounty_data[0]['total'])) : ($series_data_monthly = array_merge($series_data_monthly, array($facility_name => array((int) $subcounty_data[0]['total']))));
}
}
$graph_data = array();
$graph_data = array_merge($graph_data, array("graph_id" => 'container_monthly'));
$graph_data = array_merge($graph_data, array("graph_title" => 'Monthly Facility Access for ' . $year));
$graph_data = array_merge($graph_data, array("graph_type" => 'line'));
$graph_data = array_merge($graph_data, array("graph_yaxis_title" => 'log In'));
$graph_data = array_merge($graph_data, array("graph_categories" => array()));
$graph_data = array_merge($graph_data, array("series_data" => $series_data_monthly));
$graph_data['graph_categories'] = $category_data_monthly;
$graph_monthly = $this->hcmp_functions->create_high_chart_graph($graph_data);
$graph_log_data = array();
$graph_log_data = array_merge($graph_log_data, array("graph_id" => 'log_data_graph'));
//.........这里部分代码省略.........