<?php
    try{
        if(preg_match("/themes/i", $_SERVER['PHP_SELF'])){header("location: ../");die;}
        //echo $_SERVER['PHP_SELF'];
        $cl=new MY_HTML();
        echo "  <!DOCTYPE html>
                <html>
                <head>
                    <title>".PROJECTID."</title>
                    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>
                    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>
                    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"types/ftypes.css\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/skins/web/dhtmlx.css\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/skins/terrace/dhtmlx.css\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/codebase/dhtmlx.css\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/font/fontface.css\"/>
                    <link rel=\"stylesheet\" type=\"text/css\" href=\"".PATH_THEME."/css/cssdivalign.css\"/>
                    <script type=\"text/javascript\" src=\"".PATH_THEME."/codebase/dhtmlx.js\"></script>
                    <script src=\"".PATH_INCLUDE."/dtpick/datediff.js\"></script>
                    <script src=\"".PATH_THEME."/js/".$cl->HANDLE_VIEWSOURCE(123091)."jquery.js\"></script>
                    <!--<script type=\"text/javascript\" src=\"types/ftypes.js\"></script>-->
                    <style>
                        html, body {
                            width: 100%;
                            height: 100%;
                            overflow: hidden;
                            margin: 0px;
                            background-color: #EBEBEB;
                        }
                        .intro {
                            margin: 30px;
                            font-family: Tahoma;
                            font-size: 12px;
                        }
                        div.image_preview {
                            position: relative;
                            width: 100%;
                            height: 100%;
                            padding: 0px;
                            margin: 0px;
                            background-position: center center;
                            background-repeat: no-repeat;
                            overflow: hidden;
                        }
                    </style>
                    <script>
                        // === globar variable
                        var myLayout, myTree, myGrid, myDataView, myMenu, myToolbar,myTabbar;
                        var tabid=0;
                        function doOnLoad() 
                        {
                            console.log(fn_test(14));
                            //alert('f');
                            myLayout = new dhtmlXLayoutObject(document.body, \"2U\", \"dhx_skyblue\");
                            myLayout.cells(\"a\").setWidth(290);
                            myLayout.cells(\"a\").setText(\"".PROJECTNAME." Tree &nbsp;<a href='javascript:void(0)' onClick='myTree.closeAllItems(0);'>Collapse</a>&nbsp;&nbsp;<a href='javascript:void(0)' onClick='myTree.openAllItems(0);'>Expand</a>\");
                            
                            //myLayout.cells(\"a\").hideHeader();
                            //myLayout.cells(\"a\").hideHeader();
                            //showIntro();";

                            //$cl->FN_DHTMLXMENU();                                          
                            
        echo "              //alert('4');
                            myTabbar = myLayout.cells(\"b\").attachTabbar(\"Top\");
                            myTabbar.setSkin('dhx_web');
                            myTabbar.enableTabCloseButton(true);";
                            $id_menu_groupproject=explode(",",$_SESSION["menuidgroupproject"]);
//                            if(in_array("1",$id_menu_groupproject))
//                            {
                            if(strtoupper($_SESSION['nik'])=='ANC')
                            {
                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_marsal")."','obj=".$cl->enc("marsal_ancreg")."&task=".$cl->enc("default")."')";
                                echo "fn_dhtmlxaddtabbar('tabmnumarsalcsoancregistration',$url,'ANC Registration',220,true);";    

                            }
                            else
                            {
                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','obj=".$cl->enc("home_ticket")."&task=".$cl->enc("default")."')";
                                echo "fn_dhtmlxaddtabbar('tabhometicketperformance',$url,'Ticket Performance',220,true);";    

                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','obj=".$cl->enc("home_ticketdia")."&task=".$cl->enc("default")."')";
                                echo "fn_dhtmlxaddtabbar('tabhomediaperformance',$url,'DIA Performance',220,false);";    

                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','obj=".$cl->enc("home_coresau")."&task=".$cl->enc("default")."')";
                                echo "fn_dhtmlxaddtabbar('tabhomecoreperformance',$url,'Core Performance',220,false);";    
                                
                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','obj=".$cl->enc("home_kpiprfdly")."&task=".$cl->enc("default")."')";
                                //echo $url;
                                echo "fn_dhtmlxaddtabbar('tabhomenetperfdailys',$url,'Network Perf Daily',220,false);";    
                            }
                                

//                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','task=".$cl->enc("default")."')";
//                                $url="'http://localhost/project/ssotcel/includes/mdhomes/dashboard.html'";
//                                echo "fn_dhtmlxaddtabbar('tabhome',$url,'Welcomes',120,true);";    
//                            }
//                            if(in_array("2",$id_menu_groupproject))
//                            {
//                                $url="fn_dhtmlxloadobject('".$cl->enc("obj_home")."','obj=".$cl->enc("home_hcm")."&task=".$cl->enc("default")."')";
//                                echo "fn_dhtmlxaddtabbar('tabhomehcm',$url,'HCM Monitor',120,true);";    
//                            }
                            
                            
                            // === Create Toolbar
                            $cl->FN_DHTMLXTOOLBAR();
                            
                            // === Create Accordion
                            $cl->FN_DHTMLXACCORDION();
                            
                            //echo "myLayout.cells(\"a\").hide();";
                            
        echo "          }
                        
                        function fn_test(n)
                        {
                            if(n<=1){
                                return n;                                
                            }
                            else
                            {
                                return fn_test(n-1)+fn_test(n-2);
                            }
                            
                        }
                        function fn_dhtmlxaddtabbar(tabid,url,headertext,widthheader,activated)
                        {
                            //alert(url);
                            // ==== Check Tab is already Exists
                            var isTabCreated=false;
                            myTabbar.forEachCell(function(cell){
                                    var id = cell.getId();
                                    if(id==tabid){isTabCreated=true;}
                            });
                            //tabid=tabid+1;
                            //alert(tabid);
                            if(!isTabCreated)
                            {
                                myTabbar.addTab(tabid, headertext, widthheader+\"px\",\"true\",activated);
                                myTabbar.cells(tabid).progressOn();
                                myTabbar.cells(tabid).attachURL(url);
                                
                                myTabbar.attachEvent(\"onContentLoaded\",function(id){
                                    myTabbar.cells(id).progressOff();
                                });
                                myTabbar.attachEvent(\"onTabClick\",function(id,lastid){
                                   if(id!='tabhome')
                                   {";
        echo "                     
                                   }
                                });
                            }
                            else
                            {myTabbar.cells(tabid).setActive();}
                            
                        }
                        function fn_timeschedule()
                        {
                            setTimeout(function(){
                                        var d=new Date();
                                        var h=document.getElementById(\"h\");
                                            h.innerHTML=d.getHours();if(h.innerHTML.length<2){h.innerHTML='0'+d.getHours();}
                                        var m=document.getElementById(\"m\");
                                            m.innerHTML=d.getMinutes();if(m.innerHTML.length<2){m.innerHTML='0'+d.getMinutes();}
                                        var s=document.getElementById(\"s\");
                                            s.innerHTML=d.getSeconds();if(s.innerHTML.length<2){s.innerHTML='0'+d.getSeconds();}
                                        fn_timeschedule();
                                    },1000);
                        }

                    </script>
                    <!--<script src=\"".PATH_THEME."/js/tabcontent.js\" type=\"text/javascript\"></script>
                    <link href=\"".PATH_THEME."/css/tabcontent.css\" rel=\"stylesheet\" type=\"text/css\" />-->
                </head>

                <body onload=\"doOnLoad()\" style=\"width:100%; height:100%; margin:0px; overflow:hidden;\" onContextMenu=\"return false;\">
                <form ".$cl->HANDLE_VIEWSOURCE(73890)."id=\"fm\" name=\"fm\" ".$cl->HANDLE_VIEWSOURCE(12890)."method=\"POST\" ".$cl->HANDLE_VIEWSOURCE(11890)."action=\"?".$cl->dec("82e056dd60e5777acdf76c1365b61d65")."\"><input ".$cl->HANDLE_VIEWSOURCE(890)."type=\"hidden\" ".$cl->HANDLE_VIEWSOURCE(890)."id=\"uri\" name=\"uri\" /></form".$cl->HANDLE_VIEWSOURCE(890).">
                <div id=\"intro_text\" style=\"display:none;\">
                    <h1>dhtmlxFileExplorer Demo Application</h1>
                    <p>The purpose of this demo is to illustrate the possibility of building Windows File Explorer like application using dhtmlx library. The following components were used:</p>
                    <ul>
                        <li>dhtmlxLayout/dhtmlxWindows - as interface base</li>
                        <li>dhtmlxMenu</li>
                        <li>dhtmlxToolbar</li>
                        <li>dhtmlxTree - for navigation tree</li>
                        <li>dhtmlxGrid - for table view</li>
                        <li>dhtmlxDataView - for Icons and Tiles views</li>
                    </ul>
                    
                    <p>For step-by-step instructions of building this kind of application, please <a href=\"http://docs.dhtmlx.com/tutorials__building_web_interfaces__index.html\" target=\"_blank\">go here</a></p>
                    
                    <p>Current implementation demonstrates basic possibilities, which can be extended with more complex functionality, like: 
                        <ul>
                            <li>drag-n-drop</li>
                            <li>context menu</li>
                            <li>files operations (create, rename, delete, move etc.)</li>
                            <li>sorting of various types</li>
                            <li>filtering</li>
                            <li>thumbnails view</li>
                        </ul>
                    and more. All these features can be added using present possibilities of dhtmlx components.</p>
                    
                    <p>&copy; Dinamenta, UAB.</p>
                </div>";
                echo $cl->initjq();
        echo "  </body>
                </html>";    
    }
    catch(Exception $e)
    {
        echo $e->getMessage();        
    }
?>
