dec($task);}}
switch($task)
{
case "default":
$this->fn_default_access();
break;
case $task:
$task="fn_".$task;
if(method_exists($this,$task)){$this->$task();}
break;
default:
$this->fn_default_access();
break;
}
}
public function fn_default_access()
{
echo $this->FN_CREATEHEADER();
// echo "";
echo "";
echo $this->FN_CLOSEHEADER();
echo $this->FN_CREATEBODY("e8f1ff");
echo "
|
|
|
|
".$this->CREATE_IMAGE("loadergrid.gif")." |
|
|
";
echo $this->FN_CREATEFOOTER();
}
public function fn_updatemenuid()
{
$id=$_REQUEST['idnik'];
$spemp=$this->fn_get_fieldsvalues("nik,employeename,msisdn","select nik,employeename,msisdn from ".DB_APORTIL.".tbl_employee where id='$id'");
$nik=$spemp[0];$fullname=$spemp[1];$msisdn=$spemp[2];
$menuid=$_REQUEST['menuid'];//echo $menutype;return true;
$tipemenu=$_REQUEST['tipemenu'];//echo $menutype;return true;
$idgroupproject="";
$qry="select distinct id_menu_groupproject from ".DB_APORTIL.".tbl_treemenu where id in($menuid) order by id_menu_groupproject asc";
$rs=$this->selectquery($qry);
if($rs)
{
while($rw=$this->data_row_object($rs))
{
$idgroupproject.=$rw->id_menu_groupproject.",";
}
$idgroupproject=substr($idgroupproject,0,strlen($idgroupproject)-1);
}
$this->clearrecordset($rs);
$qry="insert into ".DB_APORTIL.".tbl_employee_accessibility
set nik='$nik',employeename='$fullname',msisdn='$msisdn',pass='".$this->enc("1234")."',maskpass='1234',
menuidgroupproject='$idgroupproject',treemenuid='$menuid',idgroupuser='1',groupuser='ALL',isactivated=1,
iby='".$_SESSION['nik']."',idt=now()";
$qrychk="select id from ".DB_APORTIL.".tbl_employee_accessibility where nik='$nik'";
if($this->fn_row_isexists($qrychk))
{
$id=$this->fn_get_fieldvalue("id",$qrychk);
$qry="update ".DB_APORTIL.".tbl_employee_accessibility
set menuidgroupproject='$idgroupproject',".$tipemenu."menuid='$menuid',uby='".$_SESSION['nik']."',udt=now()
where id='$id'";
}
//echo "failed|$qry";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_loadmenu()
{
$id=$_REQUEST["idnik"];
$nik=$this->fn_get_fieldvalue("nik","select nik from ".DB_APORTIL.".tbl_employee where id='$id'");
$tipemenu=$_REQUEST["tipemenu"];
//$idgroupproject=$_REQUEST["idgroupproject"];
$sp=$this->fn_get_fieldsvalues("menuidgroupproject,groupuser","select menuidgroupproject,groupuser from ".DB_APORTIL.".tbl_employee_accessibility where nik='$nik'");
//echo "select menuidgroupproject,groupuser from ".DB_APORTIL.".tbl_employee_accessibility where nik='$nik'";return false;
$menuidgroupproject=$sp[0];$groupuser=$sp[1];
//include XML Header (as response will be in xml format)
header("Content-type: text/xml");
//encoding may be different in your case
echo('');
//start output of data
echo "";
//if(!$menuidgroupproject){$menuidgroupproject=0;}
$swhere="";
if($menuidgroupproject)
{
$swhere="and t.id_menu_groupproject in($menuidgroupproject)";
}
//if($idgroupproject){$swhere="and t.id_menu_groupproject='$idgroupproject'";}
//if($nik=='82010'||$groupuser=='SU'&&!$idgroupproject){$swhere="";}
$qry="select t.id,t.menutype,t.menutext,t.menudesc,0 ischecked,m.groupname
from ".DB_APORTIL.".tbl_".$tipemenu."menu t inner join ".DB_APORTIL.".tbl_menu_groupproject m on m.id=t.id_menu_groupproject
where t.isdeleted=0 and t.menuactivated=1 $swhere
order by t.id asc limit ".TBL_PAGE_LIMIT;
echo $qry;
$rs=$this->selectquery($qry);
if($rs)
{
$i=1;
while($row=$this->data_row_array($rs))
{
//create xml tag for grid's row
echo ("");
print(" | ");
print(" | ");
print(" | ");
print(" | ");
print(" | ");
print(" | ");
echo ("
");
$i+=1;
}
}
else
{
//error occurs
echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file
";
}
echo "";
}
public function fn_getnik()
{
$nik=$_REQUEST["nik"];
$getnik=$this->fn_get_fieldvalue("nik","select nik from ".DB_APORTIL.".tbl_employee_accessibility where nik='$nik' and isdeleted=0");
echo $getnik;
}
public function fn_getmenuid()
{
$id=$_REQUEST["idnik"];
$nik=$this->fn_get_fieldvalue("nik","select nik from ".DB_APORTIL.".tbl_employee where id='$id'");
$tipemenu=$_REQUEST["tipemenu"];
$menuid=$this->fn_get_fieldvalue($tipemenu."menuid","select ".$tipemenu."menuid from ".DB_APORTIL.".tbl_employee_accessibility where nik='$nik'");
echo $menuid;
}
}
?>