Files
aportil/objectx/obj_home/home.html.php

517 lines
37 KiB
PHP

<?php
class BASE_HOME extends MY_DHTMLX // base class and derived class from fs_library
{
public function fn_page_construct()
{
}
}
class HOME_HTML extends BASE_HOME // derived class
{
public function fn_page_default()
{
//$year=$this->fn_get_fieldvalue("years","select years from ".DB_DMCS.".tbl_smsc_sumyears where isdeleted=0 order by id desc limit 1");
$year=date("Y");
$month=date("m");
//$month=$this->fn_get_fieldvalue("period","select period from ".DB_DMCS.".tbl_smsc_sumtop5month where isdeleted=0 order by id desc limit 1");
$monthname=$this->FN_GETMONTHNAME((int)$month);
echo $this->FN_CREATEHEADER();
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/font/fontface.css\"/>";
echo "<style>
.spnumber {
width:60px;height:60px;background-color:black;color:#76FF03;text-align:center;
display:table-cell;font-family:tahoma;
font-size:60pt;vertical-align:middle;
}
</style>"; //dseg7modernregular
echo "<script>
var t1;
function initObject()
{";
//$qrymax="select count(m.id) totalmax
// from ".DB_DIMAS.".tbl_siswa m inner join ".DB_DIMAS.".tbl_kelas f on f.id=m.idkelas
// where m.isdeleted=0 and thnmasuk>=(".date("Y")."-5) and thnmasuk<=".date("Y")."
// group by m.idkelas,m.thnmasuk
// order by count(m.id) desc limit 1";
// $max=$this->fn_get_fieldvalue("totalmax",$qrymax);
// $max=round($max/100)*100;
// $qrylegend="select distinct f.kdkelas
// from ".DB_DIMAS.".tbl_siswa m inner join ".DB_DIMAS.".tbl_kelas f on f.id=m.idkelas
// where m.isdeleted=0 and thnmasuk>=(".date("Y")."-5) and thnmasuk<=".date("Y")."
// group by m.idkelas,m.thnmasuk
// order by f.id,m.thnmasuk asc";
// $rslegend=$this->selectquery($qrylegend);
// if($rslegend)
// {
// $casewhen="";$sumfield="";
// while($rw=$this->data_row_object($rslegend))
// {
// $casewhen.="case f.kdkelas when '".$rw->kdkelas."' then count(m.id) else 0 end '".$rw->kdkelas."',";
// $sumfield.="sum(x.`".$rw->kdkelas."`) '".$rw->kdkelas."',";
// }
// $casewhen=substr($casewhen,0,strlen($casewhen)-1);
// $sumfield=substr($sumfield,0,strlen($sumfield)-1);
// }
// $this->clearrecordset($rslegend);
//
// $qry="select x.thnmasuk,$sumfield
// from
// (
// select m.thnmasuk,$casewhen
// from ".DB_DIMAS.".tbl_siswa m inner join ".DB_DIMAS.".tbl_kelas f on f.id=m.idkelas
// where m.isdeleted=0 and m.thnmasuk>=(".date("Y")."-5) and m.thnmasuk<=".date("Y")."
// group by f.id,f.kdkelas,m.thnmasuk
// ) x group by x.thnmasuk";
// $rs=$this->selectquery($qry);
// if($rs)
// {
// $arrval=array();
// while($rw=$this->data_row_array($rs))
// {
// array_push($arrval,array("fI"=>$rw["I"],"fII"=>$rw["II"],"fIII"=>$rw["III"],"Tahun"=>$rw["thnmasuk"]));
// }
// $jsonencode=json_encode($arrval);
// }
// $this->clearrecordset($rs);
$arrval=array();$max=700;
array_push($arrval,array("HITS"=>100,"Periode"=>"Jan"));
array_push($arrval,array("HITS"=>150,"Periode"=>"Feb"));
array_push($arrval,array("HITS"=>125,"Periode"=>"Mar"));
array_push($arrval,array("HITS"=>135,"Periode"=>"Apr"));
array_push($arrval,array("HITS"=>189,"Periode"=>"Mei"));
array_push($arrval,array("HITS"=>289,"Periode"=>"Jun"));
array_push($arrval,array("HITS"=>290,"Periode"=>"Jul"));
array_push($arrval,array("HITS"=>350,"Periode"=>"Aug"));
array_push($arrval,array("HITS"=>638,"Periode"=>"Sept"));
array_push($arrval,array("HITS"=>0,"Periode"=>"Okt"));
array_push($arrval,array("HITS"=>0,"Periode"=>"Nov"));
array_push($arrval,array("HITS"=>0,"Periode"=>"Des"));
$jsonencode=json_encode($arrval);
// === LAYOUT TRAFIC
echo " var jsonval=$jsonencode;
var chart1 = new dhtmlXChart({
view:\"line\",
container:\"divtrendhits\",
value:\"#HITS#\",
item:{
borderColor: \"#1293f8\",
color: \"#ffffff\"
},
line:{
color:\"#1293f8\",
width:3
},
tooltip:{
template:\"#HITS#\"
},
offset:0,
xAxis:{
template:\"#Periode#\"
},
yAxis:{
start:0,
step:50,
end:$max,
template:function(value){
return value%100?\"\":value
}
},
padding:{
left:35,
bottom: 50
},
origin:0,
legend:{
layout:\"x\",
width: 75,
align:\"center\",
valign:\"bottom\",
values:[
{text:\"SMS\",color:\"#3399ff\"}
],
margin:10
}
});
chart1.parse(jsonval,\"json\");
// === SUM OF YEARS
t1=setTimeout(function(){fn_sumofyears();fn_sumoftop5();fn_sumoftop3();},500);
}
function fn_sumofyears()
{
var sumofyears=ajaxuridhtmlx('".$this->enc("obj_home")."','obj=".$this->enc("home_marsal")."&task=".$this->enc("sumofyears")."&years=$year');
var valsumofyears='-----------'+sumofyears.toString();
//alert(sumofyears);
valsumofyears=valsumofyears.substring(valsumofyears.length-11,valsumofyears.length);
for(i=0;i<9;i++)
{
document.getElementById('dvsum'+(i+1)).innerHTML=valsumofyears.substring(i,i+1);
}
t1=setTimeout(function(){fn_sumofyears();fn_sumoftop5();fn_sumoftop3();},1000);
}
function fn_sumoftop5()
{
var sumoftop5=ajaxuridhtmlx('".$this->enc("obj_home")."','obj=".$this->enc("home_marsal")."&task=".$this->enc("sumoftop5")."&years=$year&months=$month');
//alert(sumoftop5);
var valsumoftop5=JSON.parse(sumoftop5).toString().split(',');
for(i=0;i<valsumoftop5.length;i++)
{
var valtop5=valsumoftop5[i].split('|');
document.getElementById('divrate5'+(i+1)).innerHTML=valtop5[0];
document.getElementById('divrateval5'+(i+1)).innerHTML=valtop5[1]+' SMS';
}
}
function fn_sumoftop3()
{
var sumoftop3=ajaxuridhtmlx('".$this->enc("obj_home")."','obj=".$this->enc("home_marsal")."&task=".$this->enc("sumoftop3")."&years=$year');
var valsumoftop3=JSON.parse(sumoftop3).toString().split(',');
for(i=0;i<valsumoftop3.length;i++)
{
var valtop3=valsumoftop3[i].split('|');
document.getElementById('divrate3'+(i+1)).innerHTML=valtop3[0];
document.getElementById('divrateval3'+(i+1)).innerHTML=valtop3[1]+' SMS';
}
}
</script>";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("white");
echo "<table width=\"100%\" style=\"height:100%;\" cellpadding=\"0\" cellspacing=\"0\">
<tr>";
// === HITS MONITORING
echo " <td width=\"50%\" style=\"background-color:#F50057\" valign=\"top\" align=\"center\">
<div style=\"position:absolute;margin:0px 0px;padding:5px;z-index:9999;background-color:blue;color:white;font-size:12pt;\">
PERIODE : $year
</div>
<table style=\"margin-top:25%;color:white;font-size:20pt;\" border=\"0\">
<tr>
<td valign=\"middle\" align=\"center\">TOTAL SMS $year</td>
</tr>
<tr>
<td align=\"center\" valign=\"middle\">
<table cellpadding=\"1\" cellspacing=\"0\">
<tr>
<td><div id=\"dvsum1\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum2\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum3\" class=\"spnumber\">-</div></td>
<td>.</td>
<td><div id=\"dvsum4\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum5\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum6\" class=\"spnumber\">-</div></td>
<td>.</td>
<td><div id=\"dvsum7\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum8\" class=\"spnumber\">-</div></td>
<td><div id=\"dvsum9\" class=\"spnumber\">-</div></td>
</tr>
</table>
</td>
</tr>
<tr style=\"height:80px;\">
<td valign=\"bottom\" align=\"center\">UPT TOP 5 RATING IN $monthname $year</td>
</tr>
<tr>
<td align=\"center\" valign=\"middle\">
<table cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">
<tr>
<td width=\"60%\">
<div id=\"divrate51\">Medan Utara</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval51\">300 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate52\">Medan Selayang</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval52\">120 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate53\">Medan Denai</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval53\">80 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate54\">Sunggal</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval54\">78 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate55\">Medan Marelan</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval55\">60 SMS</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
<table width=\"100%\" style=\"height:100%;\">";
// === LAYOUT 3 Top Rating
echo "<tr height=\"225px\">
<td style=\"background-color:#FFEB3B\" colspan=\"2\" valign=\"top\" align=\"center\">
<table style=\"color:#212121;font-size:20pt;\" border=\"0\" width=\"75%\">
<tr style=\"height:60px;\">
<td valign=\"bottom\" align=\"center\"><b>UPT TOP 3 RATING IN $year</b></td>
</tr>
<tr>
<td align=\"center\" valign=\"middle\">
<table cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">
<tr>
<td width=\"60%\">
<div id=\"divrate31\">Medan Utara</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval31\">111.026 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate32\">Medan Denai</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval32\">80.900 SMS</div>
</td>
</tr>
<tr>
<td width=\"60%\">
<div id=\"divrate33\">Medan Selayang</div>
</td>
<td width=\"2%\">:</td>
<td style=\"text-align:right;\">
<div id=\"divrateval33\">78.989 SMS</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>";
// === LAYOUT OPERATOR TSEL or NON TSEL
echo "<tr>
<td style=\"background-color:#FF5722\" valign=\"top\" width=\"50%\">
<div style=\"float:left;padding:5px;position:relative;z-index:9999;background-color:blue;color:white;font-size:12pt;\">
OPR TSEL PERIODE : $year
</div>
<table style=\"margin-top:20%;color:white;font-size:40pt;\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"middle\" align=\"center\">
<span id=\"divoptsel\">444.247</span><sup style=\"font-size:12pt;\">SMS</sup>
</td>
</tr>
<tr>
<td style=\"font-size:12pt;\" align=\"center\">
<div style=\"margin-top:-5px;\">
<i><span id=\"spoptselpersen\">".$this->CREATE_IMAGE("up.png")." 30%</span> from last year</i>
</div>
</td>
</tr>
<tr>
<td style=\"font-size:12pt;\" align=\"center\">
<div>
<i><span id=\"spoptsellastyear\">123.908</span> from last year ( 2015 )</i>
</div>
</td>
</tr>
</table>
</td>
<td style=\"background-color:#4CAF50\" valign=\"top\">
<div style=\"float:right;padding:5px;position:relative;z-index:9999;background-color:blue;color:white;font-size:12pt;\">
OPR NON TSEL PERIODE : $year
</div>
<table style=\"margin-top:20%;color:white;font-size:40pt;\" width=\"100%\" border=\"0\" cellpadding=\"0\">
<tr>
<td valign=\"middle\" align=\"center\">
<span id=\"spopnontsel\">190.401</span><sup style=\"font-size:12pt;\">SMS</sup>
</td>
</tr>
<tr>
<td style=\"font-size:12pt;\" align=\"center\">
<div style=\"margin-top:-5px;\">
<i><span id=\"spopnontselpersen\">".$this->CREATE_IMAGE("down.png")." 25%</span> from last year</i>
</div>
</td>
</tr>
<tr>
<td style=\"font-size:12pt;\" align=\"center\">
<div>
<i><span id=\"spopnontsellastyear\">223.458</span> from last year ( 2015 )</i>
</div>
</td>
</tr>
</table>
</td>
</tr>";
// === LAYOUT TRAFIC
echo "<tr>
<td style=\"background-color:#BBDEFB;height:250px;text-align:right;\" colspan=\"2\" valign=\"top\">
<div style=\"float:right;padding:5px;position:relative;z-index:9999;background-color:blue;color:white;font-size:12pt;\">
TRAFIC SMS PERIODE : $year
</div>
<div id=\"divtrendhits\" style=\"width:100%;height:250px;border:0px solid #A4BED4;\">
</div>
</td>
</tr>";
echo " </table>
</td>
</tr>
</table>";
echo $this->FN_CREATEFOOTER();
}
public function fn_treemenu()
{
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<tree id=\"0\" radio=\"1\">";
if($_SESSION['treemenuid'])
{
$id_menu_groupproject=$_REQUEST['id_menu_groupproject'];
$qrymnu1="select id,menuid,menutext,menuimg from ".DB_APORTIL.".tbl_treemenu
where id in(".$_SESSION['treemenuid'].") and menutype='H' and menuactivated=1 and isdeleted=0 and id_menu_groupproject='$id_menu_groupproject'
order by menuorder asc";
//echo $qrymnu1;
$rs1=$this->selectquery($qrymnu1);
if($rs1)
{
//$i=1;
if($this->REC_ROWS_COUNT($rs1)>0)
{
while($rw1=$this->data_row_object($rs1))
{
//$mymenu.="<item id='".$rw1->menuid."' text='".$rw1->menutext."' img='".$rw1->menuimg."'>";
echo "<item id='".$rw1->menuid."' text='".$rw1->menutext."'>";
$qrymnu2="select id,menuid,menutype,menutext,menuimg from ".DB_APORTIL.".tbl_treemenu
where id in(".$_SESSION['treemenuid'].") and menuheader='".$rw1->id."' and menuactivated=1 and isdeleted=0 and id_menu_groupproject='$id_menu_groupproject'
order by menuorder asc";
$rs2=$this->selectquery($qrymnu2);
if($rs2)
{
if($this->REC_ROWS_COUNT($rs2)>0)
{
while($rw2=$this->data_row_object($rs2))
{
//$mymenu.="<item id='".$rw2->menuid."' text='".$rw2->menutext."' img='".$rw2->menuimg."'>";
if($rw2->menutype=='S'){$propheader=" img0='folderClosed.gif' img1='folderOpen.gif' img2='folderClosed.gif'";}
echo "<item id='".$rw2->menuid."' text='".$rw2->menutext."'>";
$qrymnu3="select id,menuid,menutype,menutext,menuimg from ".DB_APORTIL.".tbl_treemenu
where id in(".$_SESSION['treemenuid'].") and menuheader='".$rw2->id."' and menuactivated=1 and isdeleted=0 and id_menu_groupproject='$id_menu_groupproject'
order by menuorder asc";
$rs3=$this->selectquery($qrymnu3);
if($rs3)
{
if($this->REC_ROWS_COUNT($rs3)>0)
{
//echo "<item id=\"s\" text=\"t\"></item>";
//$k=1;
while($rw3=$this->data_row_object($rs3))
{
//if($rw2->menutype=='S'){$propheader=" img0='folderClosed.gif' img1='folderOpen.gif' img2='folderClosed.gif'";}
//$mymenu.="<item id='".$rw3->menuid."' text='".$rw3->menutext."' img='".$rw3->menuimg."'></item>";
//if($rw3->menutype=='S'){$propheader=" img0='folderClosed.gif' img1='folderOpen.gif' img2='folderClosed.gif'";}
echo "<item id='".$rw3->menuid."' text='".$rw3->menutext."'>";
$qrymnu4="select id,menuid,menutype,menutext,menuimg from ".DB_APORTIL.".tbl_treemenu
where id in(".$_SESSION['treemenuid'].") and menuheader='".$rw3->id."' and menuactivated=1 and isdeleted=0 and id_menu_groupproject='$id_menu_groupproject'
order by menuorder asc";
$rs4=$this->selectquery($qrymnu4);
if($rs4)
{
if($this->REC_ROWS_COUNT($rs4)>0)
{
while($rw4=$this->data_row_object($rs4))
{
echo "<item id='".$rw4->menuid."' text='".$rw4->menutext."'/>";
}
}
}
$this->clearrecordset($rs4);
echo "</item>";
//$k+=1;
}
}
}
$this->clearrecordset($rs3);
echo "</item>";
}
}
}
$this->clearrecordset($rs2);
// if($i==1){$mymenu.="<item id='submnuclose' text='Close' img='exit.png'></item>";}
echo "</item>";
//$i+=1;
}
}
else
{
echo "<item text=\"Konfigurasi\" id=\"trkonfigurasi\" open=\"1\" im0=\"folderClosed.gif\" im1=\"folderOpen.gif\" im2=\"folderClosed.gif\">
<item text=\"Penambahan Menu\" id=\"mc0\"></item>
<item text=\"Pencarian Menu\" id=\"mc1\"></item>
<item text=\"Penambahan User\" id=\"mc2\"></item>
<item text=\"Authentifikasi User\" id=\"mc3\"></item>
</item>";
}
}
$this->clearrecordset($rs1);
}
else if($_SESSION['nik']=='9999')
{
echo "<item text=\"Konfigurasi\" id=\"trkonfigurasi\" open=\"1\" im0=\"folderClosed.gif\" im1=\"folderOpen.gif\" im2=\"folderClosed.gif\">
<item text=\"Penambahan Menu\" id=\"mc0\"></item>
<item text=\"Pencarian Menu\" id=\"mc1\"></item>
<item text=\"Penambahan User\" id=\"mc2\"></item>
<item text=\"Authentifikasi User\" id=\"mc3\"></item>
</item>";
}
echo " </tree>";
}
public function fn_treemenuadmin()
{
header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<tree id=\"0\" radio=\"1\">";
if($_SESSION['nik']=='82010')
{
echo "<item text=\"Konfigurasi\" id=\"trkonfigurasi\" open=\"1\">
<item text=\"Penambahan Menu\" id=\"mc0\"></item>
<item text=\"Pencarian Menu\" id=\"mc1\"></item>
<item text=\"Penambahan User\" id=\"mc2\"></item>
<item text=\"Authentifikasi User\" id=\"mc3\"></item>
</item>";
}
echo " </tree>";
}
}
?>