當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Facilities::getAll_方法代碼示例

本文整理匯總了PHP中Facilities::getAll_方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facilities::getAll_方法的具體用法?PHP Facilities::getAll_怎麽用?PHP Facilities::getAll_使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Facilities的用法示例。


在下文中一共展示了Facilities::getAll_方法的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


//.........這裏部分代碼省略.........
        		$row_data = array(); 
        		$column_data = array("Facility Name", "Facility Code", "County","Sub-County", "Date Last Issued", "Days from last issue",
        		"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']);
開發者ID:karsanrichard,項目名稱:hcmp_demo,代碼行數:67,代碼來源:sms.php


注:本文中的Facilities::getAll_方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。