dec($task);}}
//echo $task." re";return false;
switch($task)
{
case "default":
$this->fn_default_new();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
// case "loadheader":
// $this->fn_loadheader();
// break;
// case "savemenu":
// $this->fn_savemenu();
// break;
// case "updateuser":
// $this->fn_savemenu(true);
// break;
//
// case "getordermenu":
// $this->fn_getordermenu();
// break;
//
// case "geticons":
// $this->fn_geticons();
// break;
default:
//if($_SESSION['nikx']!=='9999'){echo $this->under_construction();}
$this->fn_default_new();
break;
}
}
public function fn_default_new()
{
echo $this->FN_CREATEHEADER();
echo "";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo $this->FN_CREATEFOOTER();
}
public function fn_savemenu($isupdate=null)
{
$menuid=$_REQUEST['txtmenuid'];
$menutype=$_REQUEST['cbomenutype'];//echo $menutype;return true;
$menuheader=$_REQUEST['cbomenuheader'];
$menutext=$_REQUEST['txtmenutext'];
$menudesc=$_REQUEST['txtmenudesc'];
$menuimg=$_REQUEST['cbomenuimg'];
$objoption=$_REQUEST['txtobjoption'];
$objname=$_REQUEST['txtobjname'];
$task=$_REQUEST['txttask'];
$target=$_REQUEST['cbotarget'];
$menuorder=$_REQUEST['txtmenuorder'];
$menugroup=$_REQUEST['cbomenugroup'];
$tables=$_REQUEST['cbotables'];
$idmenugroupproject=$_REQUEST['cbomenugroupproject'];
$menuactivated=$_REQUEST['chkaktif'];
$kategory=$_REQUEST['cbocategory'];
$ajaxurl="ajax=0&sec=1&option=".$this->enc($objoption)."&obj=".$this->enc($objname)."&task=".$this->enc($task);
if($menutype=='H'||$menutype=='S'){$objoption="";$objname="";$task="";$ajaxurl="";$target="";}
//"$('#uri').val('ajax=1&sec=1&option=01fc812f36899c1ee4d748105ff6db23&obj=e6e61859e95f78646b67a1cc96d270fa&task=de7eb57f52fc4d8a6fef759e7bb0844b');$('#fm').submit();";
if($menutype=='D'){if(!$this->CREATE_ROOT($objoption,$objname,$task,$tables)){echo 'failed|'.$this->getErrMsg();return false;};}
//return false;
$qry="insert into ".DB_APORTIL.".tbl_".$kategory."menu
set menuid='$menuid',menutype='$menutype',menuheader='$menuheader',menutext='$menutext',menudesc='$menudesc',
menuimg='$menuimg',objoption='$objoption',objname='$objname',objtask='$task',objtarget='$target',
menuorder='$menuorder',menugroup='$menugroup',id_menu_groupproject='$idmenugroupproject',menuactivated='$menuactivated',
iby='".$_SESSION['nik']."',idt=now()";
//echo $menuheader;return false;
//echo "failed|$idmenugroupproject";
//echo "failed|Object $objoption sudah pernah ditambahkan.TERIMA KASIH";
// if($this->fn_row_isexists("select objoption from ".DB_APORTIL.".tbl_menu where objoption='$objoption' and isdeleted=0"))
// {
// echo "failed|Object $objoption sudah pernah ditambahkan.TERIMA KASIH";return false;
// }
$qrychkmenuid="select menuid from ".DB_APORTIL.".tbl_treemenu where menuid='$menuid'";
if($this->fn_row_isexists($qrychkmenuid)){echo "failed|Mohon maaf menu $menuid sudah pernah didaftarkan.TERIMA KASIH";return false;}
if($this->executequery($qry))
{
echo 'ok';
//$msg="Menu baru ".strtoupper("$nmuser")." sudah berhasil ditambahkan
";
//$msg.="Klik ".$this->CREATE_LINK($this->fn_url_home(),"disini","javascript:void(0)","_self","Penambahan Menu Baru");
//$msg.=" untuk Penambahan Menu Baru. TERIMA KASIH";
//echo $this->SHOWMESSAGE($msg);
}else{echo "failed|".$this->getErrorQuery();}
}
public function fn_getordermenu()
{
$kategory=$_POST['kategory'];
$menutype=$_POST['menutype'];
//$menutype=$_POST['menutype'];
$qry="select menuorder from ".DB_APORTIL.".tbl_".$kategory."menu where menutype='$menutype' order by id desc limit 1";
//echo $qry;return false;
$menuorder=$this->fn_get_fieldvalue("menuorder",$qry);
if($menutype=='H'){$newmenuorder=$menuorder+1;}
else
{
$idheader=$_POST['idheader'];
$qry="select menuorder from ".DB_APORTIL.".tbl_".$kategory."menu where menuheader='$idheader' order by id desc limit 1";
//echo $qry;
$menuorder=$this->fn_get_fieldvalue("menuorder",$qry);
$newmenuorder=$menuorder+1;
//$lastmenuorder=substr($menuorder,strlen($menuorder)-1,1);
//if($lastmenuorder==1){$newmenuorder=$menuorder."0";}else{$newmenuorder=$menuorder+1;}
}
echo $newmenuorder;
// $arrprop=array("style="=>"\"width:3%;height:17px;text-align:center;\"","maxlength="=>"\"3\"",
// "onKeyDown="=>"\"nextfocus('txtmenuorder','cbotarget')\"","value="=>"\"$newmenuorder\"");
// echo $this->CREATE_INPUT_OBJECT("text","txtmenuorder","cbomenugroup","",$arrprop);
}
public function fn_geticons()
{
$qry="select imgname,imgname imagename from ".DB_APORTIL.".tbl_menu_img where isdeleted=0 order by id asc";
if($this->fn_row_isexists($qry))
{
$rs=$this->selectquery($qry);
if($rs)
{
$imgjson=array();
while($rw=$this->data_row_array($rs))
{
array_push($imgjson,array("value"=>$rw[0],"text"=>$rw[1],"img"=>$rw[1]));
//echo("");
//echo("");
}
}
$this->clearrecordset($rs);
$arrresult=array("options"=>$imgjson);
print(json_encode($arrresult));
}
}
public function fn_loadheader()
{
header("Content-type:text/xml");
echo("");
echo("");
echo "";
$kategory=$_REQUEST['kategory'];
$idgroupproject=$_REQUEST['idgroupproject'];
$qry="select id,concat(id,' - ',menutext) menutext from ".DB_APORTIL.".tbl_".$kategory."menu where menutype<>'D' and menuactivated=1 and id_menu_groupproject='$idgroupproject' order by id asc";
$rs=$this->selectquery($qry);
if($rs)
{
while($rw=$this->data_row_object($rs))
{
echo "";
}
}
$this->clearrecordset($rs);
echo("");
}
public function fn_getmenugroup()
{
header("Content-type:text/xml");
echo("");
echo("");
echo "";
$qry="select groupuser grp,groupuser from ".DB_APORTIL.".tbl_usergroup where isdeleted=0 order by id asc";
$rs=$this->selectquery($qry);
if($rs)
{
while($rw=$this->data_row_object($rs))
{
echo "";
}
}
$this->clearrecordset($rs);
echo("");
}
public function fn_gettables()
{
header("Content-type:text/xml");
echo("");
echo("");
echo("");
$qry="select distinct table_name from information_schema.columns where table_schema='".DB_APORTIL."'";
if($this->fn_row_isexists($qry))
{
$rs=$this->selectquery($qry);
if($rs)
{
while($rw=$this->data_row_array($rs))
{
echo("");
}
}
$this->clearrecordset($rs);
}
echo("");
}
}
?>