WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


Tutorial : Treeview with 
context menu (right click)

Tutorials

>

Tutorial Treeview

>

Tutorial : Treeview with context menu (right click)


Treeview-03: Tutorial of the composant Treeview of the PHP FrameWork WebSite-PHP.

Tutorial : Treeview with context menu (right click):



Go back to tutorial of the componant Treeview



Source code

Source code


File: /pages/tutorials/treeview/treeview-03.php

<?php
class Treeview03 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Treeview with 
                    context menu (right click)"
;
        
        
// Init treeview
        
$tree = new TreeView("tree03");
        
$root = new TreeViewFolder("root");
        
        
$folder1 = new TreeViewFolder("folder1");
        
$file1 = new TreeViewFile("file1");
        
$file2 = new TreeViewFile("file2");
        
$folder1->setTreeViewItems(
                new 
TreeViewItems($file1$file2));
                
        
$folder2 = new TreeViewFolder("folder2");
        
$file3 = new TreeViewFile("file3");
        
$file4 = new TreeViewFile("file4");
        
$folder2->setTreeViewItems(
                new 
TreeViewItems($file3$file4));
        
$folder2->collapse();
                
        
$folder3 = new TreeViewFolder("folder3");
        
$file5 = new TreeViewFile("file5");
        
$file6 = new TreeViewFile("file6");
        
$folder3->setTreeViewItems(
                new 
TreeViewItems($file5$file6));
        
$folder3->collapse();
        
        
$root->setTreeViewItems(
                new 
TreeViewItems($folder1$folder2$folder3));
                
        
$tree->setTreeViewItems(
                new 
TreeViewItems($root));
        
        
// Create context menu
        
$folder_menu = new ContextMenu("context_menu_folder_03");
        
$folder_menu->addItem("Folder"
                        
ContextMenu::CONTEXTMENU_ICON_FOLDER);
        
$file_menu = new ContextMenu("context_menu_file_03");
        
$file_menu->addItem("File"
                        
ContextMenu::CONTEXTMENU_ICON_PAGE);
                        
        
$tree->setContextMenuRoot($folder_menu);
        
$tree->setContextMenuFolder($folder_menu);
        
$tree->setContextMenuFile($file_menu);
        
        
$this->render $tree;
    }
}
?>


Go back to tutorial of the componant Treeview


Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker