?
Path : /home/admin/domains/happytokorea.com/private_html/libs/ |
Current File : /home/admin/domains/happytokorea.com/private_html/libs/menuTree.php |
<?php class Tree extends MySql { var $table; var $parent_id=Array(); function db_table($tbl){ $this->table=$tbl; return $this->table; } function style(){ $output.=" <style> .dtree { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 11px; color: #666; white-space: nowrap; } .dtree img { border: 0px; vertical-align: middle; } .dtree a { color: #333; text-decoration: none; } .dtree a.node, .dtree a.nodeSel { white-space: nowrap; padding: 1px 2px 1px 2px; } .dtree a.node:hover, .dtree a.nodeSel:hover { color: #333; text-decoration: underline; } .dtree a.nodeSel { background-color: #c0d2ec; } .dtree .clip { overflow: hidden; } </style>"; return $output; } function script(){ $output.=" <script type=\"text/javascript\"> function toggleLayer(whichLayer) { var obj=document.getElementById(whichLayer); if (document.getElementById) { var style2 = document.getElementById(whichLayer).style; style2.display = style2.display? \"\":\"none\"; } else if (document.all) { var style2 = document.all[whichLayer].style; style2.display = style2.display? \"\":\"block\"; } else if (document.layers) { var style2 = document.layers[whichLayer].style; style2.display = style2.display? \"\":\"none\"; } } </script> "; return $output; } function menu($parent,$option){ if($parent!=''){ $option.="<img src=images/treeicon/empty.gif>"; } $output.="<div id=treeview style=\"text-align:left;\" class=\"dTreeNode\">"; $result=$this->Query("SELECT * FROM $this->table WHERE parent='{$parent}'"); //array_push($this->parent_id,$data['id']); while($data=mysql_fetch_array($result)){ if($this->getChild($data['id'])>0&&$data['parent']==''){ $output.="<div style=\"background-color:#ccFFCC;\"><img src=\"images/treeicon/join.gif\"><img src=\"images/treeicon/folder.gif\"><a href=\"javascript:void(0)\" onclick=\"toggleLayer('parent_".$data['id']."');\">".$data['name']."</a></div>"; $output.="<div id=\"parent_".$data['id']."\" style=\"display:none;background-image:url('images/treeicon/line.gif');background-repeat:repeat-y;\" class=\"dTreeNode\">"; }else if($this->getChild($data['id'])>0&&$data['parent']!=''){ $output.="<div style=\"background-color: #00FF00 ;\">".$option."<img src=\"images/treeicon/joinbottom.gif\"><img src=\"images/treeicon/folder.gif\"><a href=\"javascript:void(0)\" onclick=\" toggleLayer('parent_".$data['id']."');\">".$data['name']."</a></div>"; $output.="<div id=\"parent_".$data['id']."\" style=\"background-color: #00FFFF ;background-image:url('images/treeicon/line.gif');background-repeat:repeat-y;\">"; }else if($this->getChild($data['id'])==0&&$data['parent']==''){ $output.="<div style=\"\"><img src=\"images/treeicon/joinbottom.gif\"><img src=\"images/treeicon/page.gif\"><a href=\"javascript:void(0)\">".$data['name']."</a></div>"; }else if($data['parent']!=''&&$this->getChild($data['id'])==0){ $output.="<div style=\"\">".$option."<img src=\"images/treeicon/joinbottom.gif\"><img src=\"images/treeicon/page.gif\"><a href=\"javascript:void(0)\">".$data['name']."</a></div>"; } $output.=$this->menu($data['id'],$option); if($this->getChild($data['id'])>0){ $output.="</div>"; } }//end wihle $output.="</div>"; return $output; }//end functin tree function getChild($id){ $this->Query("SELECT * FROM $this->table WHERE parent='$id'"); return $this->numRows(); }//end check getChild }//end Classs ?>