![]() |
|
sfDoctrineTreePlugin - 1.0.5Doctrine nested set visual manager |
|
![]() |
17
users
Sign-in
to change your status |
Manage doctrine's nested set with a DHTML tree. See README for complete description. |
Manage doctrine's nested set with a DHTML tree.
Symfony 1.3 compatibility release.
See README for complete description.
| Name | Status | |
|---|---|---|
|
|
lead | moc.kataon <<ta>> pilihpj |
copyright (c) 2008 Jacques Philip
This software is released under the LGPL license. Please see the attached GPL and LGPL file.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | LGPL license | 1.0.5stable | 26/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | LGPL license | 1.0.5stable | 26/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | LGPL license | 1.0.5stable | 26/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | LGPL license | 1.0.5stable | 26/07/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | LGPL license | 1.0.5stable | 26/07/2010 |
Add support for symfony 1.4 in package.xml.tmpl
Add support for symfony 1.4 in package.xml.tmpl
Updated Jan 2 2010 for Symfony 1.3 compatibility
Copyright (C) 2008-2010 Jacques Philip.
Using a modified version of Drag and drop folder tree:
Copyright (C) 2006 DTHMLGoodies.com, Alf Magne Kalleland
LGPL
PHP v 5.2.0+
Prototype v 1.6+ is required
Of course sfDoctrinePlugin
Display a doctrine nested set and insert, rename and delete nodes through a context menu and ajax:

Move complete branches of the tree through drag-drop and save the history of changes in a single ajax call:

Customize the node links through a template to integrate the tree in multiple situations.
Simple link here, but could be a remote link too:
<?php echo link_to($record->get($field), "$model/edit?id=$identifier"); ?>
Tested on IE 6, 7 and 8, Firefox 2 and 3 Opera 9 on Windows.
Let me know if you find compatibility problems on other platforms.
Install plugin as usual.
For Symfony 1.2 and 1.3, enable plugins sfDoctineTreePlugin and sfProtoculousPlugin.
For Symfony 1.0, update the Prototype js files to version 1.6 minimum.
Create a nested set model according to Doctrine documentation.
You must enable the module sfDoctrineTree in your application settings.yml:
all:
.settings:
enabled_modules: [default, sfDoctrineTree]
Create a link or virtual directory called sfDoctrineTreePlugin, pointing to the web folder of the plugin.
You can override the way sfDoctrineTreePlugin renames and deletes records by including callback methods in the table class of the model.
These methods are: customizeTreeUpdateQuery and customizeTreeSelectForDeleteQuery, they take a query object as a parameter and return a query object, so you can either add to the query or replace it in the method.
For example, for a model called Category, you would add the following method to add a where clause. (For security or other) This method will be called to get the update query:
public function customizeTreeUpdateQuery($q)
{
$securityField = Utils::getSecurityField();
return $q->addWhere('security_field = ?', $securityField);
}
Similarly the callback method customizeChildToAdd gives you a chance to update properties of a record before it is inserted as a child:
public function customizeChildToAdd($child)
{
$child->security_field = Utils::getSecurityField();
return $child;
}
You can change the following setting by defining them in app.yml:
app_doctrine_tree_rename_url default: sfDoctrineTree/rename
app_doctrine_tree_delete_url default: sfDoctrineTree/delete
app_doctrine_tree_add_child_url default: sfDoctrineTree/add_child
app_doctrine_tree_save_tree_url default: sfDoctrineTree/save_tree
These setting will be applied to all trees in the application
The helper include_doctrine_tree takes several options that modify the behavior of the tree.
This gives you the ability to set different options for each tree.
All other options will be passed as HTML attributes of the nodes. (not the root)
Some of them will be interpreted by the js tree object:
sfDoctrineTreePlugin will not work with tables having composite keys.
It is the responsibility of your application to create the root(s) of the tree.
Context menus do not work with Right Click on Opera, Ctrl + Left Click is used instead.
<?php
use_helper('DoctrineTree');
// Category nested set with 1 root
// include_doctrine_tree('Category', 'name');
// Comments nested set with multiple roots
// include_doctrine_tree('Comment', 'title', 1); // 3rd argument is the root id of the nested set tree
// Comments nested set with one root, using options and custom base query
// include_doctrine_tree('Comment', 'title', 0, array('link_partial' => 'my_module/my_partial', 'max_depth' => 8, 'no_root_rename' => 'true', 'noRename' => 'true', 'noDelete' => 'true', 'noSiblings' => 'true'), CommentTable::getTreeBaseQuery);
//
?>
