<?php
    class HOME_CORESAU extends HOME
    {
        public function home_coresau_javainit()
        {

        }

        public function fn_coresau_init()
        {
            if(isset($_REQUEST['task'])){$task=trim(strtolower($_REQUEST['task']));}
            if(isset($_POST['task'])){$task=trim(strtolower($_POST['task']));}
            if($_REQUEST||$_POST){if($_REQUEST['sec']||$_POST['sec']){$task=$this->dec($task);}}

            switch($task)
            {
                case "default":
                    $this->fn_default_sum();
                break;

                case $task:
                    $task="fn_".$task;
                    if(method_exists($this,$task)){$this->$task();}
                break;

                default:
                    $this->fn_default_sum();
                break;
            }
        }
        
        public function fn_default_sum()
        {
            echo $this->FN_CREATEHEADER();

            echo "<style>
                       .besidebtnsave {margin-left:80px;margin-top:-6px;position:absolute;}
                  </style>";
            echo "<script>
                       var myForm,myFormsearch,dgtra;
                       function initObject()
                       {";
                            $qry="select datasets,startvalue,stepvalue,endvalue from ".DB_APORTIL.".tbl_chart_trendsum
                                  where modules='coresaugsm' and isdeleted=0 order by id desc limit 1";
                            $spval=$this->fn_get_fieldsvalues("datasets,startvalue,stepvalue,endvalue",$qry);
                            $datasets=$spval[0];$startvalue=$spval[1];$stepvalue=$spval[2];$endvalue=$spval[3];                            
            echo "          var datasets=$datasets;
                            myLineChart =  new dhtmlXChart({
                                                view:\"line\",
                                                container:\"div_coresauline\",
                                                value:\"#saugsm#\",
                                                item:{
                                                    borderColor: \"#447900\",
                                                    color: \"#69ba00\"
                                                },
                                                line:{
                                                    color:\"#69ba00\",
                                                    width:2
                                                },
                                                tooltip:{
                                                    template:\"#saugsm#\"
                                                },
                                                offset:0,
                                                xAxis:{
                                                    template:\"'#times#\"
                                                },
                                                yAxis:{
                                                    start:$startvalue,
                                                    step: $stepvalue,
                                                    end: $endvalue,
                                                    title:'in Thousand'
                                                },
                                                padding:{
                                                    left:35,
                                                    bottom: 50
                                                },
                                                origin:0,
                                                legend:{
                                                    values:[{text:\"Sau GSM\"},{text:\"Sau WCDMA\"},{text:\"Sau LTE\"}],
                                                    align:\"right\",
                                                    valign:\"middle\",
                                                    layout:\"y\",
                                                    width: 100,
                                                    margin: 8,
                                                    marker:{
                                                        type: \"item\"
                                                    }
                                                }
                                            });
                                            myLineChart.addSeries({
                                                value:\"#sauwcdma#\",
                                                item:{
                                                    borderColor: \"#0a796a\",
                                                    color: \"#4aa397\",
                                                    type:\"s\",
                                                    radius: 4
                                                },
                                                line:{
                                                    color:\"#4aa397\",
                                                    width:2
                                                },
                                                tooltip:{
                                                    template:\"#sauwcdma#\"
                                                }
                                            });
                                            myLineChart.addSeries({
                                                value:\"#saulte#\",
                                                item:{
                                                    borderColor: \"#b7286c\",
                                                    color: \"#de619c\",
                                                    type:\"t\",
                                                    radius: 4
                                                },
                                                line:{
                                                    color:\"#de619c\",
                                                    width:2
                                                },
                                                tooltip:{
                                                    template:\"#saulte#\"
                                                }
                                            });
                                            myLineChart.parse(datasets,\"json\");";
            echo "     };
                  </script>";
            echo $this->FN_CLOSEHEADER();
            echo $this->FN_CREATEBODY("white");
            echo "<table width=\"98%\" height=\"100%\" border=\"0\">";
            echo "  <tr>
                        <td valign=\"top\" width=\"100%\">
                            <div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">Trend SAU Information Period ".date("d M Y")."</div>
                            <div id=\"div_coresauline\" style=\"width:100%;height:330px;\"></div>
                        </td>                        
                    </tr>
                    <tr>
                        <td valign=\"top\" style=\"border:1px solid black\">
                            <div style=\"width:100%;text-align:center;text-decoration:underline;font-size:24px;color:blue\">Space AVailable</div>
                            <div id=\"div_coresauline2\" style=\"width:100%;height:330px;\">
                                
                            </div>
                        </td> 
                    </tr>";
            echo "</table>";
            echo $this->FN_CREATEFOOTER();

        }
    }
?>