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
 


Tutorial : sortables Objects 
with event

Tutoriels

>

Tutoriel Object

>

Tutorial : sortables Objects with event


Object-06: Tutoriel du composants Object du FrameWork PHP WebSite-PHP.

Tutorial : sortables Objects with event:

My Object 1
My Object 2
My Object 3
My Object 4
My Object 5
My Object 6


Retourner aux tutoriels du composants Object



Code source

Code source


Fichier: /pages/tutorials/object/object-06.php

<?php
class Object06 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : sortables Objects 
                            with event"
;
        
        
// Create drag picture
        
$pic_drag = new Picture("wsp/img/drag_arrow_16x16.png"
                            
16160Picture::ALIGN_ABSMIDDLE);
        
$pic_drag->setStyle("cursor:pointer;");
        
        
// *** Sortable area 1 ***
        
$sortable_area_1 = new Object();
        
$sortable_area_1->setId("sortable_area_1");
        
        
// Create sort event
        
$sort_event1 = new SortableEvent($this);
        
$sort_event1->onSort("onSort")->setAjaxEvent();
        
$sortable_area_1->setSortable(true$sort_event1);
        
        
// Create objects to be sort
        
$square1 = new Object($pic_drag"My Object 1");
        
$square1->setId("my_object_1_tuto_6")->forceDivTag();
        
        
$square2 = new Object($pic_drag"My Object 2");
        
$square2->setId("my_object_2_tuto_6")->forceDivTag();
        
        
$square3 = new Object($pic_drag"My Object 3");
        
$square3->setId("my_object_3_tuto_6")->forceDivTag();
        
        
$sortable_area_1->add($square1$square2$square3);
        
        
// *** Sortable area 2 ***
        
$sortable_area_2 = new Object();
        
$sortable_area_2->setId("sortable_area_2");
        
        
// Create sort event
        
$sort_event2 = new SortableEvent($this);
        
$sort_event2->onSort("onSort")->setAjaxEvent();
        
$sortable_area_2->setSortable(true$sort_event2);
        
        
// Create objects to be sort
        
$square4 = new Object($pic_drag"My Object 4");
        
$square4->setId("my_object_4_tuto_6")->forceDivTag();
        
        
$square5 = new Object($pic_drag"My Object 5");
        
$square5->setId("my_object_5_tuto_6")->forceDivTag();
        
        
$square6 = new Object($pic_drag"My Object 6");
        
$square6->setId("my_object_6_tuto_6")->forceDivTag();
        
        
$sortable_area_2->add($square4$square5$square6);
        
        
// Create render
        
$this->render = new Table(5);
        
$this->render->addRowColumns($sortable_area_1
                                        
$sortable_area_2);
    }
    
    public function 
onSort($sender$moved_object$from_object
                            
$to_object$position$old_position) {
        
alert("Move object ".$moved_object->getId().
                
" from ".$from_object->getId().
                
" to ".$to_object->getId().
                
" on the position ".$position.
                
" (old position: ".$old_position.")");
    }
}
?>


Retourner aux tutoriels du composants Object


Share

 


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