Jump to content

AtkTreeNode: Difference between revisions

From NusaATK
how to use atktreenode
m removed duplicated title
 
Line 1: Line 1:
AtkTreeNode  
'''AtkTreeNode''' should be used together with [[atkManyToOneTreeRelation]] to create a child : parent tree.
 
AtkTreeNode should be used together with [[atkManyToOneTreeRelation]] to create a child : parent tree.


[[Image:Atktreenode.png]]
[[Image:Atktreenode.png]]

Latest revision as of 02:17, 28 December 2006

AtkTreeNode should be used together with atkManyToOneTreeRelation to create a child : parent tree.

How to use

  • do import AtkTreeNode:
atkimport("atk.atktreenode"); 


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]";
   }
}
?>