AtkTreeNode
Appearance
AtkTreeNode should be used together with atkManyToOneTreeRelation to create a child : parent tree.
How to use
- do import AtkTreeNode:
atkimport("atk.atktreenode");
- on atkManyToOneTreeRelation do use AF_PARENT
- do not forget to call $this->atkTreeNode instead of $this->atkNode
Example
<?php
atkimport("atk.atktreenode");
userelation("atkManyToOneTreeRelation");
class categoria extends atkTreeNode
{
function categoria()
{
$this->atkTreeNode("categoria", NF_ADD_LINK);
$this->add(new atkAttribute("categoria_id", AF_AUTOINCREMENT|AF_PRIMARY|AF_HIDE_ADD|AF_HIDE_EDIT|AF_HIDE_LIST));
$this->add(new atkAttribute("categoria_nome", AF_SEARCHABLE));
$this->add(new atkManyToOneTreeRelation("categoria_pai", "diretorio.categoria",
AF_PARENT
));
$this->setOrder("categoria_nome ASC");
$this->setTable("diretorio_categoria");
}
function descriptor_def()
{
return "[categoria_nome]";
}
}
?>
