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


PHP Facilities::getFacilityName方法代码示例

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


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

示例1: get_cummulative_graph

    function get_cummulative_graph($year = 0, $antigens = 0, $district = 0, $facility = 0)
    {
        $graph_sub_title = "";
        if ($year == 0) {
            $year = date('y');
        }
        //Start creating the sql query
        $sql = "select reporting_period, ";
        $antigen_count = 0;
        $antigen_array = array();
        $antigen_titles = array("dpt1_admin" => "DPT 1", "dpt2_admin" => "DPT 2", "dpt3_admin" => "DPT 3", "opv1_admin" => "OPV 1", "opv2_admin" => "OPV 2", "opv3_admin" => "OPV 3", "opv_birth_admin" => "OPV Birth", "pn1_admin" => "Pneumococal 1", "pn2_admin" => "Pneumococal 2", "pn3_admin" => "Pneumococal 3", "tt_pregnant" => "TT Pregnant Women", "tt_trauma" => "TT Trauma", "yellow_admin" => "Yellow Fever", "measles_admin" => "Measles", "bcg_admin" => "BCG");
        $antigen_data = array();
        $selected_antigens = array();
        $this->load->database();
        //If no antigens have been specified, get data for dpt1 and 3
        if (strlen($antigens) == 1) {
            $selected_antigens = array("dpt1_admin", "dpt3_admin");
        } else {
            $selected_antigens = explode("-", $antigens);
            array_pop($selected_antigens);
        }
        $counter = 1;
        //For each of the selected antigens, append it's retrieval chunk onto the sql query
        foreach ($selected_antigens as $selected_antigen) {
            array_push($antigen_array, $antigen_titles[$selected_antigen]);
            if (sizeof($selected_antigens) != $counter) {
                $sql .= "sum(" . $selected_antigen . ") as `" . $antigen_titles[$selected_antigen] . "`, ";
            } else {
                $sql .= "sum(" . $selected_antigen . ") as `" . $antigen_titles[$selected_antigen] . "` ";
            }
            $counter++;
        }
        //Finish creating the query based on whether the user is filtering down to a district or not
        if ($district == 0) {
            $graph_sub_title = "Nationwide";
            $sql .= " from dhis_data where reporting_period like '%{$year}%' group by reporting_period";
        } else {
            if ($district > 0) {
                if ($facility == 0) {
                    $district_object = Districts::getDistrict($district);
                    $graph_sub_title = "In " . $district_object->name . " District";
                    $sql .= " from dhis_data d left join facilities f on d.facility_code = f.facilitycode where reporting_period like '%{$year}%' and f.district = '" . $district . "' group by reporting_period";
                }
                if ($facility > 0) {
                    $facility_name = Facilities::getFacilityName($facility);
                    $graph_sub_title = "In " . $facility_name;
                    $sql .= " from dhis_data where reporting_period like '%{$year}%' and facility_code = '" . $facility . "' group by reporting_period";
                }
            }
        }
        $query = $this->db->query($sql);
        $immunizations = $query->result_array();
        foreach ($immunizations as $immunization) {
            foreach ($antigen_array as $antigen_dataset) {
                $antigen_data[$antigen_dataset][$immunization['reporting_period']] = $immunization["{$antigen_dataset}"];
            }
        }
        $chart = '<chart caption="Immunization Data" subcaption="' . $graph_sub_title . ' For \'' . $year . '" connectNullData="1" showValues="0" formatNumberScale="0" lineDashGap="6" xAxisName="Month" yAxisName="Cummulative Immunized" showValues="0" showBorder="0" showAlternateHGridColor="0" divLineAlpha="10"  bgColor="FFFFFF"  exportEnabled="1" exportHandler="' . base_url() . 'Scripts/FusionCharts/ExportHandlers/PHP/FCExporter.php" exportAtClient="0" exportAction="download">
<categories>
<category label="Jan"/>
<category label="Feb"/>
<category label="Mar"/>
<category label="Apr"/>
<category label="May"/>
<category label="Jun"/>
<category label="Jul"/>
<category label="Aug"/>
<category label="Sep"/>
<category label="Oct"/>
<category label="Nov"/>
<category label="Dec"/> 
</categories>';
        //Loop through all the months in the specified year
        $str_start = $year . "-01-01";
        $str_end = $year . "-12-31";
        $start = $month = strtotime($str_start);
        $end = strtotime($str_end);
        $loop_from = $str_start;
        $loop_to = $str_end;
        $days = array();
        $counter = 0;
        //create an array of the various months
        while (strtotime($loop_from) <= strtotime($loop_to)) {
            $days[$counter] = date('M-y', strtotime($loop_from));
            $loop_from = date("d-m-Y", strtotime("+1 month", strtotime($loop_from)));
            $counter++;
        }
        foreach ($antigen_array as $antigen_dataset) {
            $chart .= "<dataset seriesName='{$antigen_dataset}'>";
            $antigen_dataset_data = $antigen_data[$antigen_dataset];
            //Keep track of the cummulative totals
            $cummulative = 0;
            $counter = 0;
            while ($month < $end) {
                //get the description of the months
                $current_month = date('M-y', $month);
                if (isset($antigen_dataset_data[$current_month])) {
                    //check if the next value is non-existent, if so, display a dotted line, else, display a kawaida line
                    if (sizeof($antigen_dataset_data) != $counter) {
                        $cummulative += $antigen_dataset_data[$current_month];
//.........这里部分代码省略.........
开发者ID:EuniceManyasi,项目名称:DVI,代码行数:101,代码来源:vaccination_management.php


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