当前位置: 首页>>代码示例>>PHP>>正文


PHP Facilities::get_facility_data_specific方法代码示例

本文整理汇总了PHP中Facilities::get_facility_data_specific方法的典型用法代码示例。如果您正苦于以下问题:PHP Facilities::get_facility_data_specific方法的具体用法?PHP Facilities::get_facility_data_specific怎么用?PHP Facilities::get_facility_data_specific使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facilities的用法示例。


在下文中一共展示了Facilities::get_facility_data_specific方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_system_usage_specific

    public function send_system_usage_specific($county_id = NULL, $district_id = NULL, $facility_code = NULL, $listing_email_address = NULL)
    {
        //Karsan
        $time = date('M , d Y');
        $county_name = counties::get_county_name($county_id);
        $district_name = districts::get_district_name_($district_id);
        $cp_email_query = "SELECT * FROM email_listing_new WHERE county = {$county_id} AND usertype = 10";
        $cp_emails = $this->db->query($cp_email_query)->result_array();
        $scp_email_query = "SELECT * FROM email_listing_new WHERE county = {$county_id} AND usertype = 3";
        $scp_emails = $this->db->query($scp_email_query)->result_array();
        // echo "<pre>";print_r($cp_emails);exit;
        //CP
        $cp_emails_str = '';
        foreach ($cp_emails as $emails => $value) {
            $cp_emails_str = $cp_emails_str . ',' . $value['email'];
            // echo "<pre>";print_r($value['email']);exit;
        }
        $cp_emails_str = ltrim($cp_emails_str, ',');
        //SCP
        $scp_emails_str = '';
        foreach ($scp_emails as $emails => $value) {
            $scp_emails_str = $scp_emails_str . ',' . $value['email'];
            // echo "<pre>";print_r($value['email']);exit;
        }
        $scp_emails_str = ltrim($scp_emails_str, ',');
        // echo $scp_emails_str;exit;
        // echo "<pre>";print_r($scp_emails);exit;
        // echo "<pre>";print_r($district_name);
        // echo "<pre>OVER ";
        $appended = !empty($district_name) ? $district_name['district'] . " Subcounty" : $county_name['county'] . " County";
        $excel_title = 'HCMP facility activity log summary for ' . $appended;
        $email_subject = 'HCMP System usage report for ' . $appended . ' as at ' . $time;
        // echo $county_name.' '.$district_name;
        // echo $excel_title;exit;
        $active_facilities = Facilities::getAll_($county_id, $district_id);
        // echo "<pre>";print_r($active_facilities);echo "</pre>";exit;
        $last_seen = Facilities::get_facility_data_specific(NULL, $county_id, $district_id, $facility_code, 'all');
        $last_issued = Facilities::get_facility_data_specific('last_issued', $county_id, $district_id, $facility_code, 'all');
        $last_ordered = Facilities::get_facility_data_specific('last_ordered', $county_id, $district_id, $facility_code, 'all');
        $decommissioned = Facilities::get_facility_data_specific('last_decommissioned', $county_id, $district_id, $facility_code, 'all');
        $redistributed = Facilities::get_facility_data_specific('last_redistributed', $county_id, $district_id, $facility_code, 'all');
        $added_stock = Facilities::get_facility_data_specific('last_added_stock', $county_id, $district_id, $facility_code, 'all');
        // $all_faciliteis = Facilities::getAll_();
        // echo "<pre>";print_r($active_facilities);echo "</pre>";exit;
        $facility_count = empty($active_facilities) ? NULL : count($active_facilities);
        $final_array = array();
        $last_seen_count = count($last_seen);
        $last_issued_count = count($last_issued);
        $last_ordered_count = count($last_ordered);
        $decommissioned_count = count($decommissioned);
        $redistributed_count = count($redistributed);
        $added_stock_count = count($added_stock);
        foreach ($active_facilities as $a_c) {
            $final_array[] = array('Facility Name' => $a_c['facility_name'], 'Facility Code' => $a_c['facility_code'], 'County' => $a_c['county'], 'Sub-County' => $a_c['subcounty']);
        }
        //active_facilities foreach
        $final_array_count = count($final_array);
        $last_seen_time = NULL;
        $last_issued_time = NULL;
        $last_order_time = NULL;
        $last_deccommissioned_time = NULL;
        $last_redistributed_time = NULL;
        $last_added_stock_time = NULL;
        foreach ($final_array as $keyy => $value) {
            foreach ($last_seen as $key => $value) {
                if ($final_array[$keyy]['Facility Code'] == $last_seen[$key]['facility_code']) {
                    // echo "<pre>".$last_ordered[$j]['last_seen']."	".$last_ordered[$j]['facility_code'];
                    if ($last_seen[$key]['last_seen'] > $last_seen_time) {
                        $last_seen_time = $last_seen[$key]['last_seen'];
                        $days_last_seen = $last_seen[$key]['difference_in_days'];
                        // echo "<pre>".$last_seen_time;
                    }
                    $final_array[$keyy]['Date Last Seen'] = $last_seen_time;
                    $final_array[$keyy]['Days From Last Seen'] = $days_last_seen;
                    // echo "<pre>".$last_seen_time;
                    // $final_array[$i]['Days From Last Seen'] = abs($last_seen_time - $now);
                    $last_seen_time = NULL;
                }
                //end of facility code if
            }
            //end of last seen foreach
        }
        // echo "<pre>";print_r($final_array);echo "</pre>";exit;
        //last issued time
        foreach ($final_array as $keyy => $value) {
            foreach ($last_issued as $key => $value) {
                if ($final_array[$keyy]['Facility Code'] == $last_issued[$key]['facility_code']) {
                    // echo "<pre>".$last_ordered[$j]['last_seen']."	".$last_ordered[$j]['facility_code'];
                    if ($last_issued[$key]['last_seen'] > $last_issued_time) {
                        $last_issued_time = $last_issued[$key]['last_seen'];
                        $days = $last_issued[$key]['difference_in_days'];
                        // echo "<pre>".$last_order_time;
                    }
                    $final_array[$keyy]['Date Last Issued'] = $last_issued_time;
                    $final_array[$keyy]['Days From Last Issue'] = $days;
                    // $final_array[$i]['Days From Last Seen'] = abs($last_seen_time - $now);
                    $last_issued_time = NULL;
                }
                //end of facility code if
            }
//.........这里部分代码省略.........
开发者ID:HCMPKenya,项目名称:hcmp_demo,代码行数:101,代码来源:sms.php

示例2: monitoring

 public function monitoring($for_temporary_system_usage = null)
 {
     //being authored by Karsan as at 2015-08-04
     //pick values form the session
     // $facility_code = (!$this -> session -> userdata('facility_id')) ? null : $this -> session -> userdata('facility_id');
     // $district_id = (!$this -> session -> userdata('district_id')) ? null : $this -> session -> userdata('district_id');
     // $county_id = (!$this -> session -> userdata('county_id')) ? null : $this -> session -> userdata('county_id');
     // $category_data = $series_data = $graph_data = $series_data_ = array();
     $county_id = $this->session->userdata('county_id');
     $district_id = $this->session->userdata('district_id');
     $facility_code = $this->session->userdata('facility_id');
     $county_id = isset($county_id) && $county_id > 0 ? $county_id : NULL;
     $district_id = isset($district_id) && $district_id > 0 ? $district_id : NULL;
     $facility_code = isset($facility_code) && $facility_code > 0 ? $facility_code : NULL;
     // $facility_code = ($facility_code == "NULL") ? null : $facility_code;
     $identifier = $this->session->userdata('user_indicator');
     //the old query that causes too many locks on the mysql tables
     //$facility_data=Facilities::get_facilities_monitoring_data( $facility_code,$district_id,$county_id,$identifier);
     //get the monitoring data from the log tables
     // $facility_data = Facilities::facility_monitoring($county_id, $district_id, $facility_code);
     // $facility_data_new = Facilities::new_facility_monitoring_function($county_id, $district_id, $facility_code,'all');
     // get_facility_data_specific($report_type = NULL,$criteria = NULL,$county_id = NULL,$district_id = NULL,$facility_code = NULL)
     // echo $district_id;exit;
     $all_facilities = Facilities::getAll_($county_id, $district_id);
     // echo "<pre>";print_r($all_facilities);echo "</pre>";exit;
     $last_seen = Facilities::get_facility_data_specific(NULL, $county_id, $district_id, $facility_code);
     $last_issued = Facilities::get_facility_data_specific('last_issued', $county_id, $district_id, $facility_code);
     $last_ordered = Facilities::get_facility_data_specific('last_ordered', $county_id, $district_id, $facility_code);
     $decommissioned = Facilities::get_facility_data_specific('last_decommissioned', $county_id, $district_id, $facility_code);
     $redistributed = Facilities::get_facility_data_specific('last_redistributed', $county_id, $district_id, $facility_code);
     $added_stock = Facilities::get_facility_data_specific('last_added_stock', $county_id, $district_id, $facility_code);
     $final_array = array();
     $last_seen_count = count($last_seen);
     $last_issued_count = count($last_issued);
     $last_ordered_count = count($last_ordered);
     $decommissioned_count = count($decommissioned);
     $redistributed_count = count($redistributed);
     $added_stock_count = count($added_stock);
     /*
     		//previous system that chose which array had highest value and begun with
     $rollcall = array(
     	'last_seen' => $last_seen_count,
     	'last_issued' => $last_issued_count,
     	'last_ordered' => $last_ordered_count,
     	'decommissioned' => $decommissioned_count,
     	'redistributed' => $redistributed_count,
     	'added_stock' => $added_stock_count
     	);
     // echo "<pre>";print_r($rollcall);echo "</pre>";
     asort($rollcall);
     $rollcall = array_reverse($rollcall,true);
             $arr_key = key($rollcall);
     // echo "<pre>";print_r($arr_key);echo "</pre>";
     
     
     $highest = max($last_seen_count,$last_issued_count,$last_ordered_count,$decommissioned_count,$redistributed_count,$added_stock_count);
     $keys_na_si_alishia = array_search($highest, $rollcall);
     // echo $highest;
     switch ($keys_na_si_alishia) {
     	case 'last_seen':
     
     		foreach ($last_seen as $l_seen) { 
     		$final_array[] = array(
     			'Facility Name' => $l_seen['facility_name'], 
     			'Facility Code' => $l_seen['facility_code'],
     			'County' => $l_seen['county'],
     			'Sub-County' => $l_seen['district']
     			);
     		}//last issued foreach
     
     	case 'last_issued':
     		foreach ($last_issued as $l_seen) { 
     		$final_array[] = array(
     			'Facility Name' => $l_seen['facility_name'], 
     			'Facility Code' => $l_seen['facility_code'],
     			'County' => $l_seen['county'],
     			'Sub-County' => $l_seen['district']
     			);
     		}//last issued foreach
     
     	case 'last_ordered':
     		foreach ($last_ordered as $l_seen) { 
     		$final_array[] = array(
     			'Facility Name' => $l_seen['facility_name'], 
     			'Facility Code' => $l_seen['facility_code'],
     			'County' => $l_seen['county'],
     			'Sub-County' => $l_seen['district']
     			);
     		}//last issued foreach
     
     	case 'decommissioned':
     		foreach ($decommissioned as $l_seen) { 
     		$final_array[] = array(
     			'Facility Name' => $l_seen['facility_name'], 
     			'Facility Code' => $l_seen['facility_code'],
     			'County' => $l_seen['county'],
     			'Sub-County' => $l_seen['district']
     			);
     		}//last issued foreach
     	case 'redistributed':
//.........这里部分代码省略.........
开发者ID:HCMPKenya,项目名称:HCMP-ALPHA,代码行数:101,代码来源:reports.php

示例3: log_summary_weekly


//.........这里部分代码省略.........
        		"Date Last Redistributed", "Days From last Redistributed", "Date Last ordered", "Days From Last order", "Date Last Decommissioned",
        		 "Days From Last Decommissioned", "Date From Last Received Order", "Days From Last Received Order","Date Last Seen", "Days From Last Seen");
        		$excel_data['column_data'] = $column_data;
        		foreach ($temp2 as $key => $value) :
        		array_push($row_data, 
        		array($value['facility_name'],
        		$value['facility_code'],
        		$value['county'],
        		$value['district'],
        		(date('m-d-Y',strtotime($value['issue_event']))=='01-01-1970')? 'No Data Available' : $value['issue_event'],
        		($value['issue_d']==0)? 'No Data Available':$value['issue_d'],
        		(date('m-d-Y',strtotime($value['redistribute_event']))=='01-01-1970')? 'No Data Available' : $value['redistribute_event'],
        		($value['redistribute_d']=='')? 'No Data Available' :$value['redistribute_d'],
        		(date('m-d-Y',strtotime($value['ordered_event']))=='01-01-1970')? 'No Data Available' : $value['ordered_event'],
        		($value['ordered_d']=='')? 'No Data Available' :$value['ordered_d'] ,
        		(date('m-d-Y',strtotime($value['decommissioned_event']))=='01-01-1970')? 'No Data Available' : $value['decommissioned_event'],
        		($value['decommissioned_d']=='')? 'No Data Available':$value['decommissioned_d'],
        		(date('m-d-Y',strtotime($value['receive_event']))=='01-01-1970')? 'No Data Available' : $value['receive_event'],
        		($value['receive_event_d']=='')? 'No Data Available' :$value['receive_event_d'],
        		(date('m-d-Y',strtotime($value['date_event']))=='01-01-1970')? 'No Data Available' : $value['date_event'],
        		($value['date_event_d']=='')? 'No Data Available' :$value['date_event_d']
        		));
        		endforeach;
        		$excel_data['row_data'] = $row_data;
            // echo "<pre>";print_r($excel_data['row_data']);exit;
        		$excel_data['report_type']='Log Summary';
        		
        
        		$this -> hcmp_functions -> create_excel($excel_data);
        */
        /*END OF PRIOR TO CONVERSTION TO NEW QUERY*/
        $active_facilities = Facilities::getAll_();
        // echo "<pre>";print_r($active_facilities);echo "</pre>";exit;
        $last_seen = Facilities::get_facility_data_specific(NULL, $county_id, $district_id, $facility_code, 'all');
        $last_issued = Facilities::get_facility_data_specific('last_issued', $county_id, $district_id, $facility_code, 'all');
        $last_ordered = Facilities::get_facility_data_specific('last_ordered', $county_id, $district_id, $facility_code, 'all');
        $decommissioned = Facilities::get_facility_data_specific('last_decommissioned', $county_id, $district_id, $facility_code, 'all');
        $redistributed = Facilities::get_facility_data_specific('last_redistributed', $county_id, $district_id, $facility_code, 'all');
        $added_stock = Facilities::get_facility_data_specific('last_added_stock', $county_id, $district_id, $facility_code, 'all');
        // $all_faciliteis = Facilities::getAll_();
        // echo "<pre>";print_r($all_faciliteis);echo "</pre>";exit;
        $final_array = array();
        $last_seen_count = count($last_seen);
        $last_issued_count = count($last_issued);
        $last_ordered_count = count($last_ordered);
        $decommissioned_count = count($decommissioned);
        $redistributed_count = count($redistributed);
        $added_stock_count = count($added_stock);
        // echo "<pre>".$highest;exit;
        // echo "<pre>";print_r($last_seen);echo "</pre>";
        // echo "END OF LAST SEEN";
        // echo "<pre>";print_r($last_issued);echo "</pre>";
        // echo "END OF LAST ISSUED";
        // echo "<pre>";print_r($last_ordered);echo "</pre>";
        // echo "END OF LAST ORDERED";
        // echo "<pre>";print_r($decommissioned);echo "</pre>";
        // echo "END OF LAST DECOMMISSSIONED";
        // echo "<pre>";print_r($redistributed);echo "</pre>";
        // echo "END OF LAST REDISTRIBUTED";
        // echo "<pre>";print_r($added_stock);echo "</pre>";
        // echo "END OF LAST ADDED STOCK";
        // exit;
        foreach ($active_facilities as $a_c) {
            $final_array[] = array('Facility Name' => $a_c['facility_name'], 'Facility Code' => $a_c['facility_code'], 'County' => $a_c['county'], 'Sub-County' => $a_c['subcounty']);
        }
        //active_facilities foreach
开发者ID:karsanrichard,项目名称:hcmp_demo,代码行数:67,代码来源:sms.php


注:本文中的Facilities::get_facility_data_specific方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。