WebSite-PHP Framework PHP
Multi langues
Mode Ajax simple
Aucun HTML, aucun JavaScript
URL rewrinting
Envoi d'email
Sitemap - RSS - Web service
Télécharger le Framework WebSite-PHP maintenant
 


Loading
 


Tutoriel Menu

Tutoriels

>

Tutoriel Menu



Tutoriel 1 : Simple Menu
Fichier: /pages/tutorials/menu/menu-01.php

<?php
class Menu01 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Simple Menu";
        
        
// Menu 1
        
$menu1 = new MenuItem("Menu 1");
        
$menu_11 = new MenuItem("Menu 1.1");
        
$menu_12 = new MenuItem("Menu 1.2");
        
$menu_13 = new MenuItem("Menu 1.3");
        
$menu1->setMenuItems(
                        new 
MenuItems(
                            
$menu_11,
                            
$menu_12,
                            
$menu_13));
        
        
// Menu 2
        
$menu2 = new MenuItem("Menu 2");
        
$menu_21 = new MenuItem("Menu 2.1");
        
$menu_22 = new MenuItem("Menu 2.2");
        
$menu_23 = new MenuItem("Menu 2.3");
        
$menu2->setMenuItems(
                        new 
MenuItems(
                            
$menu_21,
                            
$menu_22,
                            
$menu_23));
        
        
// Menu 3
        
$menu3 = new MenuItem("Menu 3");
        
$menu_31 = new MenuItem("Menu 3.1");
        
$menu_32 = new MenuItem("Menu 3.2");
        
$menu_33 = new MenuItem("Menu 3.3");
        
$menu3->setMenuItems(
                        new 
MenuItems(
                            
$menu_31,
                            
$menu_32,
                            
$menu_33));
        
        
$main_menu = new Menu();
        
$main_menu->setMenuItems(
                            new 
MenuItems(
                                    
$menu1,
                                    
$menu2,
                                    
$menu3));
                                    
        
$this->render = new WSPObject($main_menu,
                        
"<br/><br/><br/><br/>",
                        
"<br/><br/><br/><br/>");
    }
}
?>


Tutoriel 2 : Menu with icons and link
Fichier: /pages/tutorials/menu/menu-02.php

<?php
class Menu02 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Menu with icons 
                                and link"
;
        
        
// Menu 1
        
$menu1 = new MenuItem("Menu 1"""
                            
"img/wsp-admin/home_16.png");
        
        
$menu_11 = new MenuItem("Menu 1.1",
                    
"http://www.meteo-europ.com");
        
$menu_12 = new MenuItem("Menu 1.2",
                    
"http://www.website-php.com");
        
$menu_13 = new MenuItem("Menu 1.3",
                    
"http://www.oracleref.com");
        
$menu1->setMenuItems(
                        new 
MenuItems(
                            
$menu_11,
                            
$menu_12,
                            
$menu_13));
        
        
// Menu 2
        
$menu2 = new MenuItem("Menu 2"""
                            
"img/wsp-admin/config_16.png");
        
$menu_21 = new MenuItem("Menu 2.1",
                    
"javascript:alert('click Menu 2.1');");
        
$menu_22 = new MenuItem("Menu 2.2",
                    
"javascript:alert('click Menu 2.2');");
        
$menu_23 = new MenuItem("Menu 2.3",
                    
"javascript:alert('click Menu 2.3');");
        
$menu2->setMenuItems(
                        new 
MenuItems(
                            
$menu_21,
                            
$menu_22,
                            
$menu_23));
        
        
// Menu 3
        
$menu3 = new MenuItem("Menu 3");
        
$menu_31 = new MenuItem("Menu 3.1");
        
$menu_32 = new MenuItem("Menu 3.2");
        
$menu_33 = new MenuItem("Menu 3.3");
        
$menu3->setMenuItems(
                        new 
MenuItems(
                            
$menu_31,
                            
$menu_32,
                            
$menu_33));
        
        
$main_menu = new Menu();
        
$main_menu->setMenuItems(
                            new 
MenuItems(
                                    
$menu1,
                                    
$menu2,
                                    
$menu3));
                                    
        
$this->render = new WSPObject($main_menu,
                        
"<br/><br/><br/><br/>",
                        
"<br/><br/><br/><br/>");
    }
}
?>


Tutoriel 3 : Menu vertical
Fichier: /pages/tutorials/menu/menu-03.php

<?php
class Menu03 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Menu vertical";
        
        
// Menu 1
        
$menu1 = new MenuItem("Menu 1"""
                            
"img/wsp-admin/home_16.png");
        
$menu_11 = new MenuItem("Menu 1.1",
                    
"http://www.meteo-europ.com");
        
$menu1->setMenuItems(new MenuItems($menu_11));
        
        
// Menu 2
        
$menu2 = new MenuItem("Menu 2"""
                            
"img/wsp-admin/config_16.png");
        
$menu_21 = new MenuItem("Menu 2.1",
                    
"javascript:alert('click Menu 2.1');");
        
$menu_22 = new MenuItem("Menu 2.2",
                    
"javascript:alert('click Menu 2.2');");
        
$menu2->setMenuItems(new MenuItems($menu_21$menu_22));
        
        
// Menu 3
        
$menu3 = new MenuItem("Menu 3"""
                            
"img/wsp-admin/template_16.gif");
        
$menu_31 = new MenuItem("Menu 3.1");
        
$menu_32 = new MenuItem("Menu 3.2");
        
$menu_33 = new MenuItem("Menu 3.3");
        
$menu3->setMenuItems(
                        new 
MenuItems(
                            
$menu_31,
                            
$menu_32,
                            
$menu_33));
        
        
// Define vertical menu
        
$main_menu = new Menu(Menu::POSITION_VERTICAL);
        
$main_menu->setMenuItems(
                            new 
MenuItems(
                                    
$menu1,
                                    
$menu2,
                                    
$menu3));
                                    
        
$this->render = new WSPObject($main_menu,
                        
"<br/><br/><br/><br/>",
                        
"<br/><br/><br/><br/>",
                        
"<br/><br/><br/><br/>");
    }
}
?>


Tutoriel 4 : Dock menu
Fichier: /pages/tutorials/menu/menu-04.php

<?php
class Menu04 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Dock menu";
        
        
$dock = new DockMenu("dock_menu_4"DockMenu::DOCK_ALIGN_NONE);
        
$dock->setLabelsColor("#FFFFFF");
        
$dock->addDockMenuItem(new DockMenuItem("img/logo_128x128.png"__(HOME_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/doc_dock.png"__(DOCUMENTATION_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/download_dock.png"__(DOWNLOAD_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/quickstart_dock.png"__(QUICKSTART_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/tutorials_dock.png"__(TUTORIALS_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/wiki_dock.png"__(WIKI_LINK)));
        
$dock->addDockMenuItem(new DockMenuItem("img/bug_dock.png"__(ISSUE_TRACKER_LINK)));
                                    
        
$this->render $dock;
    }
}
?>


Tutoriel 5 : Context menu
Fichier: /pages/tutorials/menu/menu-05.php

<?php
class Menu05 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Context menu";
        
        
$menu_object = new WSPObject("Click right button");
        
$menu_object->setId("obj_menu_5");
        
$menu_object->setStyle("border:1px dashed gray;".
                                
"padding:5px;");
        
        
$context_menu = new ContextMenu("context_menu_5");
        
        
$context_menu->addItem("Menu 1"
                        
ContextMenu::CONTEXTMENU_ICON_LINK,
                        
$add_folder_event);
        
        
$menu_event = new ContextMenuEvent($this);
        
$menu_event->onClick("clickEvent")->setAjaxEvent();
        
$context_menu->addItem("Menu 2"
                        
ContextMenu::CONTEXTMENU_ICON_REDO,
                        
$menu_event);
        
        
$menu_object->setContextMenu($context_menu);
                                    
        
$this->render $menu_object;
    }
    
    public function 
clickEvent($sender$object) {
        
alert($object->getId());
    }
}
?>



Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Accueil Documentation Télécharger Quick start Tutoriels Wiki Issue Tracker