Jump to content

AtkTreeNode

From NusaATK

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