Login   Register  
PHP Classes
elePHPant
Icontem

File: jQTree4PHP/public_html/test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Omar Yepez  >  jQTree4PHP  >  jQTree4PHP/public_html/test.php  >  Download  
File: jQTree4PHP/public_html/test.php
Role: Example script
Content type: text/plain
Description: jQTree4PHP test
Class: jQTree4PHP
Generate expansible tree menus using Jquery
Author: By
Last change:
Date: 2008-08-25 10:56
Size: 5,887 bytes
 

Contents

Class file image Download
<?php
/*
  * @autor Omar Yepez
  * */

  
include_once ('../ve/com/yepsua/src/jQTree/jQTree.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="../ve/com/yepsua/common/css/gray_template.css" rel="stylesheet" type="text/css" />


<link href="../ve/com/yepsua/common/css/jquery.treeview.css" rel="stylesheet" type="text/css" />
<link href="../ve/com/yepsua/common/css/screen.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../ve/com/yepsua/common/js/jQuery/jquery.js"></script>

<script type="text/javascript" src="../ve/com/yepsua/common/js/jQuery/plugins/jTreeView/jquery.cookie.js" ></script>
<script type="text/javascript" src="../ve/com/yepsua/common/js/jQuery/plugins/jTreeView/jquery.treeview.js" ></script>
<script language="JavaScript" type="text/javascript">

  $(document).ready(function(){

                $('body').css('display','none');
                $('body').fadeIn('slow');

                $('.file').click(function(){
                    var nombreHoja = $(this).html();
                    alert("Tocando una hoja - " + nombreHoja);
                });

                $('.filetree').treeview();
  });

</script>
</head>

<body class="bodyPage" >
<h1><strong>Basic Example</strong></h1></ br>

<?php



  $arbol 
= new jQTreeNode();
  
$arbol->setCaption("Mi &aacute;rbol");
    for(
$primeraRamaCount=0;$primeraRamaCount<3;$primeraRamaCount++){
        
$primeraRama = new jQTreeNode();

         
$primeraRama->setCaption("Rama " $primeraRamaCount);
         for(
$segundaRamaCount=0;$segundaRamaCount<2;$segundaRamaCount++){
            
$segundaRama = new jQTreeNode();
             
$segundaRama->setCaption("Sub Rama " $segundaRamaCount);
             for(
$hojaCount=0;$hojaCount<3;$hojaCount++){
            
$hoja = new jQTreeNode();
             
$hoja->setCaption("Hoja " $hojaCount);
             
$segundaRama->add($hoja);
             }
         
$primeraRama->setOnClick("alert('test " $primeraRama->getCaption() ."');");
         
$primeraRama->add($segundaRama);
         }
     
$arbol->add($primeraRama);
    }

  
$tree = new jQTree();
  
$tree->setModel($arbol);
  
$tree->setId('browser');
  
$tree->getTree();
?>
<br>
<?php



  $arbol 
= new jQTreeNode();
  
$arbol->setCaption("Mi &aacute;rbol 2");
    for(
$primeraRamaCount=0;$primeraRamaCount<3;$primeraRamaCount++){
        
$primeraRama = new jQTreeNode();

         
$primeraRama->setCaption("Pais " $primeraRamaCount);
         for(
$segundaRamaCount=0;$segundaRamaCount<2;$segundaRamaCount++){
            
$segundaRama = new jQTreeNode();
             
$segundaRama->setCaption("Eatado " $segundaRamaCount);
             for(
$hojaCount=0;$hojaCount<3;$hojaCount++){
            
$hoja = new jQTreeNode();
             
$hoja->setCaption("Ciudad " $hojaCount);
             
$segundaRama->add($hoja);
             }
         
$primeraRama->setOnClick("alert('test 2 " $primeraRama->getCaption() ."');");
         
$primeraRama->add($segundaRama);
         }
     
$arbol->add($primeraRama);
    }
  
$arbol->setOnClick("alert('you click me');");
  
$arbol->setIsClosed(false);
  
$tree = new jQTree();
  
$tree->setModel($arbol);
  
$tree->setId('browser2');
  
$tree->getTree();
?>
<br>
<?php

  $arbol 
= new jQTreeNode();
  
$arbol->setCaption("jQTree4PHP 1.0.0");
        
        
$author = new jQTreeNode();
         
$author->setCaption("Developers");
        
        
            
$authorData = new jQTreeNode();
             
$authorData->setCaption("Omar Yepez YSCEO");
                
$author->add($authorData); // add child => setting parent
            
$authorData = new jQTreeNode();
             
$authorData->setCaption("Rossana Suarez YSBM");
                
$authorData->setParent($author); // add child => setting parent
                
        
$site = new jQTreeNode();
         
$site->setCaption("Site: http://jqtree4php.sourceforge.net/");        
        
        
$php = new jQTreeNode();
         
$php->setCaption("PHP 5");

        
$jquery = new jQTreeNode();
        
$jquery->setCaption("jQuery 1.2");
            
$jqueryData = new jQTreeNode();
            
$jqueryData->setCaption("Jhon Resig");
                
$jquery->add($jqueryData); // add child => setting parent
            
$jqueryData = new jQTreeNode();
            
$jqueryData->setCaption("jquery.com");
                
$jqueryData->setParent($jquery ); // setting parent => add child 

        
$jqueryTree = new jQTreeNode();
        
$jqueryTree->setCaption("jQuery.treeview 1.4");
            
$jqueryTreeData = new jQTreeNode();
            
$jqueryTreeData->setCaption("Jörn Zaefferer");
            
$jqueryTree->add($jqueryTreeData);
            
$jqueryTreeData = new jQTreeNode();
            
$jqueryTreeData->setCaption("http://docs.jquery.com/Plugins/Treeview");
            
$jqueryTreeData->setParent($jqueryTree );
        
$sfn = new jQTreeNode();
        
$sfn->setCaption("Repository");
            
$sfnData = new jQTreeNode();
            
$sfnData->setCaption("Sourceforge");
            
$sfn->add($sfnData);
            
$sfnData = new jQTreeNode();
            
$sfnData->setCaption("http://www.sourceforge.net");
            
$sfnData->setParent($sfn);
        
        
$images = new jQTreeNode();
        
$images->setCaption("Images");
            
$imagesData = new jQTreeNode();
            
$imagesData->setCaption("famfamfam");
            
$images->add($imagesData);
            
$imagesData = new jQTreeNode();
            
$imagesData->setCaption("http://www.famfamfam.com/lab/icons/");
            
$imagesData->setParent($images);
        
        
        
$more = new jQTreeNode();
        
$more->setCaption("...?"); 
            
  
$author->setParent($arbol);
  
$arbol->add($site);
        
$needToWork = new jQTreeNode();
        
$needToWork->setCaption("Needed to work");
            
$needToWork->add($php);
            
$needToWork->add($jquery);
            
$needToWork->add($jqueryTree);
  
$needToWork->setParent($arbol);
  
$arbol->add($sfn);
  
$arbol->add($images);      
  
$arbol->add($more);   
 
  
$arbol->setOnClick("alert('jQTree4PHP easy treeview');");
  
$arbol->setIsClosed(false);
  
  
$tree = new jQTree();
  
$tree->setModel($arbol);
  
$tree->setId('browser3');
  
$tree->getTree();
?>
</body>
</html>