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s>pj#+uތnRCT@BLeuC Tueӥz Vf- ΰkOI-$U')7bm-A%=W%Liz{ZB֖D >'?A4'0o߬\]h7Ev8dp$gOXE<0MvJ\' ]Ҫp Ű$`f4G_s,(6]q(ځj` o~,JئSA%W0t8Leƺ؍er qm~"$G ƢEoٰقF^uq|,oA4݊ >txT]T .tmCv**ǘPWO\?r[Q3S;kyel1J9/jүVv5P$ȴH`YF`rb4aˢc(Yh>r$Pox\Yo/n04K!Z@nv,'Cqfkr-Qy _ZO~ɫ*0I1)w^sR .cuaYFg|x) P$j^{DAW Ry@ Pd?9z"3ٖqnvm:Ug)1w5W$DQ٪"x$ͅpZBXru )_ёEzq MmkOXE<0Mv ;\~vAcp%Ҫ^(6WXX0u=$j$z9FcX]5:wqX&Km5]4(c7e4խct "MLC^̩ AH^N;hݏv.⾱o%(Dդi/::R$RE>ā{Oz93uꓽ;77y?Jє!6O^M3T&?{qXJyGƕ&3E㐗DqMiN9"uwT$cru$DQ٪"x<ܴ@'u0ncJi_g~9,'PhY$DQ٪"xXPTP*ݒ)yTJload_from_path = $path; $this->is_root_dir = ($root_dir_name!="")?true:false; $this->synchronize_dir = true; if ($root_dir_name != "") { $root_folder = new TreeViewFolder($root_dir_name); $this->setTreeViewItems(new TreeViewItems($root_folder)); } else { $root_folder = $this; } $this->createFolderNode($path, $root_folder, $link_file_template); $this->generateTreeViewIds(); return $this; } /** * Method createFolderNode * @access private * @param string $path * @param TreeViewFolder $treeview_folder * @param string $link_file_template * @since 1.0.59 */ private function createFolderNode($path, $treeview_folder, $link_file_template) { $treeview_items = null; $nb_file = 0; if (is_dir($path)) { $treeview_items = new TreeViewItems(); $files = scandir($path); for($i=0; $i < sizeof($files); $i++) { $file = $files[$i]; if ($file == "." || $file == ".." || $file == ".svn") { continue; } if (is_dir($path.$file)) { $treeview_sub_folder = new TreeViewFolder($file, $path.$file."/"); $treeview_sub_folder->collapse(); $treeview_items->add($treeview_sub_folder); $this->createFolderNode($path.$file."/", $treeview_sub_folder, $link_file_template); } else { $treeview_items->add(new TreeViewFile($file, $path.$file, $link_file_template)); } $nb_file++; } } if ($treeview_items != null && $nb_file > 0) { $treeview_folder->setTreeViewItems($treeview_items); } } /** * Method synchronizeWithDir * @access public * @return TreeView * @since 1.0.35 */ public function synchronizeWithDir() { $this->synchronize_dir = true; return $this; } /** * Method unSynchronizeWithDir * @access public * @return TreeView * @since 1.0.35 */ public function unSynchronizeWithDir() { $this->synchronize_dir = false; return $this; } /** * Method isSynchronizeWithDir * @access public * @return boolean * @since 1.0.35 */ public function isSynchronizeWithDir() { return $this->synchronize_dir; } /** * Method setContextMenuRoot * @access public * @param ContextMenu $context_menu_object * @return TreeView * @since 1.0.35 */ public function setContextMenuRoot($context_menu_object) { if (get_class($context_menu_object) != "ContextMenu") { throw new NewException("Error TreeView->setContextMenuRoot(): $context_menu_object is not a ContextMenu object", 0, 8, __FILE__, __LINE__); } $this->context_menu_root = $context_menu_object; $this->context_menu_root->attachContextMenuToObjectId("$(\"#".$this->id." LI .folder A\")"); return $this; } /** * Method setContextMenuFile * @access public * @param ContextMenu $context_menu_object * @return TreeView * @since 1.0.35 */ public function setContextMenuFile($context_menu_object) { if (get_class($context_menu_object) != "ContextMenu") { throw new NewException("Error TreeView->setContextMenuFile(): $context_menu_object is not a ContextMenu object", 0, 8, __FILE__, __LINE__); } $this->context_menu_file = $context_menu_object; $this->context_menu_file->attachContextMenuToObjectId("$(\"#".$this->id." LI UL LI .file A\")"); return $this; } /** * Method setContextMenuFolder * @access public * @param ContextMenu $context_menu_object * @return TreeView * @since 1.0.35 */ public function setContextMenuFolder($context_menu_object) { if (get_class($context_menu_object) != "ContextMenu") { throw new NewException("Error TreeView->setContextMenuFolder(): $context_menu_object is not a ContextMenu object", 0, 8, __FILE__, __LINE__); } $this->context_menu_folder = $context_menu_object; $this->context_menu_folder->attachContextMenuToObjectId("$(\"#".$this->id." LI UL LI .folder A\")"); return $this; } /** * Method setContextMenuOnTreeViewItem * @access public * @param ContextMenu $context_menu_object * @param TreeViewItem|TreeViewFolder|TreeViewFile|TreeView $treeview_item_object * @return TreeView * @since 1.0.35 */ public function setContextMenuOnTreeViewItem($context_menu_object, $treeview_item_object) { if (get_class($context_menu_object) != "ContextMenu") { throw new NewException("Error TreeView->setContextMenuOnTreeViewItem(): $context_menu_object is not a ContextMenu object", 0, 8, __FILE__, __LINE__); } if (get_class($treeview_item_object) != "TreeViewItem" && get_class($treeview_item_object) != "TreeViewFolder" && get_class($treeview_item_object) != "TreeViewFile" && get_class($treeview_item_object) != "TreeView") { throw new NewException("Error TreeView->setContextMenuOnTreeViewItem(): $treeview_item_object is not a TreeViewItem object", 0, 8, __FILE__, __LINE__); } if ($treeview_item_object->getParentTreeViewItem() == null) { throw new NewException("Error TreeView->setContextMenuOnTreeViewItem(): you must associate object ".get_class($treeview_item_object)." to an other TreeViewItem before setting the ContextMenu", 0, 8, __FILE__, __LINE__); } $this->generateTreeViewIds(); $this->context_menu_item[$treeview_item_object->getId()] = $context_menu_object; return $this; } /** * Method createContextMenu * @access private * @param boolean $ajax_render [default value: false] * @return string html code of TreeView ContextMenu * @since 1.0.35 */ private function createContextMenu($ajax_render=false) { $html = ""; if ($this->context_menu_root != null) { $html .= $this->context_menu_root->render($ajax_render); } if ($this->context_menu_file != null) { $html .= $this->context_menu_file->render($ajax_render); } if ($this->context_menu_folder != null) { $html .= $this->context_menu_folder->render($ajax_render); } foreach ($this->context_menu_item as $id => $context_menu_item) { if ($context_menu_item != null) { $context_menu_item->attachContextMenuToObjectId("$(\"#".$id."_id\")"); $html .= $context_menu_item->render($ajax_render); } } return $html; } /** * Method getLoadedPath * @access public * @return string * @since 1.0.35 */ public function getLoadedPath() { return $this->load_from_path; } /** * Method isRootFolder * @access public * @return boolean * @since 1.0.35 */ public function isRootFolder() { return $this->is_root_dir; } /** * Method getId * @access public * @return string * @since 1.0.35 */ public function getId() { return $this->id; } /* Intern management of TreeView */ /** * Method getTreeViewItemsObject * @access public * @return TreeViewItems * @since 1.0.35 */ public function getTreeViewItemsObject() { return $this->treeview_items; } /** * Method getChildsTreeViewItemArray * @access public * @return array * @since 1.0.35 */ public function getChildsTreeViewItemArray() { return ($this->treeview_items == null)?array():$this->treeview_items->getTreeViewItemArray(); } /** * Method searchTreeViewItemId * @access public * @param string $id * @return TreeViewItem * @since 1.0.35 */ public function searchTreeViewItemId($id) { if (substr($id, strlen($id)-3, strlen($id)) == "_id") { $id = substr($id, 0, strlen($id)-3); } $this->generateTreeViewIds(); return $this->searchNodeId($this, $id); } /** * Method searchNodeId * @access private * @param TreeViewItem $treeview_item * @param string $id * @return TreeViewItem * @since 1.0.35 */ private function searchNodeId($treeview_item, $id) { if ($treeview_item->getId() == $id) { return $treeview_item; } else if ($treeview_item->getTreeViewItemsObject() != null) { $node_treeview_items = $treeview_item->getTreeViewItemsObject()->getTreeViewItemArray(); for ($i=0; $i < sizeof($node_treeview_items); $i++) { $search_item = $this->searchNodeId($node_treeview_items[$i], $id); if ($search_item != null) { return $search_item; } } } return null; } /** * Method render * @access public * @param boolean $ajax_render [default value: false] * @return string html code of object TreeView * @since 1.0.35 */ public function render($ajax_render=false) { $html = ""; if ($this->treeview_items != null) { if (!$ajax_render) { $this->generateTreeViewIds(); $html .= $this->treeview_items->render($ajax_render, $this); $html .= $this->getJavascriptTagOpen(); } $html .= " $(document).ready(function(){\n"; $html .= " $('#".$this->id."').treeview();\n"; $html .= " });\n"; if (!$ajax_render) { $html .= $this->getJavascriptTagClose(); $html .= $this->createContextMenu(); } } return $html; } /** * Method getAjaxRender * @access public * @return string javascript code to update initial html of object TreeView (call with AJAX) * @since 1.0.35 */ public function getAjaxRender() { $html = str_replace("\n", "", str_replace("\r", "", $this->createContextMenu(true))); return $html; } } ?>