<?php
  
    class BASE_MENUCONFIG extends MY_DHTMLX  // base class  and derived class from fs_library
    {
        public function fn_page_construct()
        {

        }            
    }
    
    class MENUCONFIG_HTML extends BASE_MENUCONFIG  // derived class
    {
        public function fn_page_default()
        {
            echo $this->FN_CREATEHEADER();
            $tabid=$_REQUEST['tabid'];
            
            echo "<script>
                        // === globar variable                                     
                        var myLayout, myTree,myTabbar;

                        function initObject()
                        {
                            myLayout = new dhtmlXLayoutObject(document.body,\"2U\",\"dhx_skyblue\"); 
                            myLayout.cells(\"a\").setWidth(200);
                            myLayout.cells(\"a\").setText(\"MENU\");
                            myLayout.cells(\"b\").setText(\"KONFIGURASI MENU\");

                            myTree = myLayout.cells(\"a\").attachTree(\"0\");
                            myTree.setSkin(\"dhx_skyblue\");
                            myTree.setImagePath(\"".PATH_THEME."/codebase/imgs/dhxtree_skyblue/\");
                            myTree.enableTreeLines(true);
                            url=fn_dhtmlxloadobject('".$this->enc("obj_menuconfig")."','obj=".$this->enc("-")."&task=".$this->enc("treemenu")."');
                            myTree.loadXML(url);
                            
                            // ==== init Sub Tabbar in Layout Cells b
                            myTabbar = myLayout.cells('b').attachTabbar(\"Top\");
                            myTabbar.setSkin('dhx_skyblue');
                            myTabbar.enableTabCloseButton(true);
                            myTabbar.addTab('b', 'Selamat Datang', '150px','true',true);";
                            $url="fn_dhtmlxloadobject('".$this->enc("obj_menuconfig")."','obj=".$this->enc("-")."&task=".$this->enc("pagehome")."')";
            echo "          myTabbar.cells('b').attachURL($url);
            
                            // === Attach Event MyTree
                            myTree.attachEvent(\"onClick\",function(e){
                                switch (myTree.getSelectedItemId())
                                {
                                    case 'mc0':";
                                        $url="fn_dhtmlxloadobject('".$this->enc("obj_menuconfig")."','obj=".$this->enc("menuconfig_new")."&task=".$this->enc("default")."')";
                                        //echo "myLayout.cells(\"b\").attachURL($url);fn_dhtmlxaddtabbar('b','tabhome',$url,'Welcomes',120,true);
            echo "                      fn_dhtmlxaddtabbar('tab0',$url,'Penambahan Menu',150,true);
                                    break;
                                    case 'mc1':";
                                        $url="fn_dhtmlxloadobject('".$this->enc("obj_menuconfig")."','obj=".$this->enc("menuconfig_list")."&task=".$this->enc("default")."')";
            echo "                      fn_dhtmlxaddtabbar('tab1',$url,'Pencarian Menu',150,true);
                                    break;
                                };
                            });
                        }
                  </script>";
            echo $this->FN_CLOSEHEADER();
            echo $this->FN_CREATEBODY();
            
            echo $this->FN_CREATEFOOTER();
        }                
        
        public function fn_page_home()
        {
            echo "<div style=\"font-size:14pt;margin:20px;\"><u>INFORMASI</u></div>";    
            echo "<div style=\"font-size:14pt;margin-left:40px;\">
                       <ul>
                           <li>Penambahan menu baru untuk aplikasi Dimas.</li> 
                           <li>Perubahan dan konfigurasi menu yang diakses.</li> 
                       </ul> 
                  </div>";    
        }   
             
        public function fn_treemenu()
        {
            header("Content-type: text/xml");
            echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
                    <tree id=\"0\" radio=\"1\">
                        <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>
                    </tree>";
        }
   
        public function fn_url_home()
        {
            return "$('#uri').val('ajax=0&sec=1&option=01fc812f36899c1ee4d748105ff6db23&obj=e6e61859e95f78646b67a1cc96d270fa&task=de7eb57f52fc4d8a6fef759e7bb0844b');$('#fm').prop('target','_self');$('#fm').submit();";
        }
        
        public function fn_url_menuconfignew()
        {
            return "$('#uri').val('ajax=0&sec=1&option=01fc812f36899c1ee4d748105ff6db23&obj=e6e61859e95f78646b67a1cc96d270fa&task=de7eb57f52fc4d8a6fef759e7bb0844b');$('#fm').prop('target','_self');$('#fm').submit();";
        }

        public function fn_url_menuconfiglist()
        {
            return "$('#uri').val('ajax=0&sec=1&option=01fc812f36899c1ee4d748105ff6db23&obj=00687a17cf8b20f4141743da723d3be4&task=de7eb57f52fc4d8a6fef759e7bb0844b');$('#fm').prop('target','_self');$('#fm').submit();";
        }
        
                
        public function fn_url_search()
        {
            $urlsearch="ajaxuri('".$this->enc("obj_menuconfig")."','obj=menuconfig_list&task=searchmenu&pagingndx='+$('#txtcbopagingid').val()+'&keyword='+$('#txtsearch').val()+'&header='+$('#cbomenuheader').val(),'div_menuconfigliststatus',true,'');"; 
            $urlsearch.="txtcbopagingid.value=parseInt(txtcbopagingid.value)+1;";
            return $urlsearch;
        }


    }
?>
