| 1 |
joko |
1.1 |
<?php |
| 2 |
|
|
// |
| 3 |
|
|
// Id: index.php,v 1.2 2003/01/30 17:43:42 cain Exp |
| 4 |
|
|
// $Id: index.php,v 1.2 2003/01/30 17:43:42 cain Exp $ |
| 5 |
|
|
// |
| 6 |
|
|
//ini_set('include_path',realpath(dirname(__FILE__).'/../../../').':'.realpath(dirname(__FILE__).'/../../../../includes').':'.ini_get('include_path')); |
| 7 |
|
|
//ini_set('error_reporting',E_ALL); |
| 8 |
|
|
|
| 9 |
|
|
################################################## |
| 10 |
|
|
# |
| 11 |
|
|
# init template engine |
| 12 |
|
|
# |
| 13 |
|
|
// you need the template class from http://sf.net/projects/simpltpl |
| 14 |
|
|
if (!@include('HTML/Template/Xipe.php')) { |
| 15 |
|
|
print 'sorry, you need the template class PEAR::HTML_Template_Xipe<br>'. |
| 16 |
|
|
'or if i have time i put the examples <a href="http://os.visionp.de/">here online</a>'; |
| 17 |
|
|
die(); |
| 18 |
|
|
} |
| 19 |
|
|
require_once('HTML/Template/Xipe/Filter/TagLib.php'); |
| 20 |
|
|
$options = array( 'templateDir' => dirname(__FILE__) ); |
| 21 |
|
|
$tpl = new HTML_Template_Xipe($options); |
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
################################################## |
| 25 |
|
|
# |
| 26 |
|
|
# actual tree stuff, using Dynamic_DBnested |
| 27 |
|
|
# |
| 28 |
|
|
require_once('Tree/Tree.php'); |
| 29 |
|
|
$tree = Tree::setup( 'Dynamic_DBnested' , 'mysql://root@localhost/test' , array('table'=>'Tree_Nested') ); |
| 30 |
|
|
|
| 31 |
|
|
if( @$_REQUEST['action_add'] ) |
| 32 |
|
|
{ |
| 33 |
|
|
$methodCall = "tree->add( {$_REQUEST['newData']} , {$_REQUEST['parentId']} , {$_REQUEST['prevId']} )"; |
| 34 |
|
|
$result = $tree->add( $_REQUEST['newData'] , $_REQUEST['parentId'] , $_REQUEST['prevId'] ); |
| 35 |
|
|
} |
| 36 |
|
|
|
| 37 |
|
|
if( @$_REQUEST['action_remove'] ) |
| 38 |
|
|
{ |
| 39 |
|
|
$methodCall = "$tree->remove( {$_REQUEST['removeId']} )"; |
| 40 |
|
|
$result = $tree->remove( $_REQUEST['removeId'] ); |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
|
if( @$_REQUEST['action_update'] ) |
| 44 |
|
|
{ |
| 45 |
|
|
$methodCall = "tree->update( {$_REQUEST['updateId']} , {$_REQUEST['updateData']} )"; |
| 46 |
|
|
$result = $tree->update( $_REQUEST['updateId'] , $_REQUEST['updateData'] ); |
| 47 |
|
|
} |
| 48 |
|
|
|
| 49 |
|
|
if( @$_REQUEST['action_move'] ) |
| 50 |
|
|
{ |
| 51 |
|
|
$methodCall = "tree->move( {$_REQUEST['move_id']} , {$_REQUEST['move_newParentId']} , {$_REQUEST['move_newPrevId']} )"; |
| 52 |
|
|
$result = $tree->move( $_REQUEST['move_id'] , $_REQUEST['move_newParentId'] , $_REQUEST['move_newPrevId'] ); |
| 53 |
|
|
} |
| 54 |
|
|
|
| 55 |
|
|
$methodFailed = false; |
| 56 |
|
|
if( @PEAR::isError($result) ) |
| 57 |
|
|
$methodFailed = true; |
| 58 |
|
|
|
| 59 |
|
|
$fid = @$_REQUEST['fid']; |
| 60 |
|
|
if( !$fid ) |
| 61 |
|
|
$fid = $tree->getRootId(); |
| 62 |
|
|
|
| 63 |
|
|
$path = $tree->getPath( $fid ); |
| 64 |
|
|
$children = $tree->getChildren( $fid ); |
| 65 |
|
|
|
| 66 |
|
|
################################################## |
| 67 |
|
|
# |
| 68 |
|
|
# actual tree stuff to show the entire tree using Memory_DBnested |
| 69 |
|
|
# |
| 70 |
|
|
require_once('Tree/Tree.php'); |
| 71 |
|
|
$memTree = Tree::setup( 'Memory_DBnested' , 'mysql://root@localhost/test' , |
| 72 |
|
|
array('table'=>'Tree_Nested') ); |
| 73 |
|
|
|
| 74 |
|
|
$memTree->setup(); |
| 75 |
|
|
$entireTree = $memTree->getNode(); |
| 76 |
|
|
|
| 77 |
|
|
$tpl->compile('index.tpl'); |
| 78 |
|
|
include($tpl->compiledTemplate); |
| 79 |
|
|
?> |