简体   繁体   中英

Atk framework Questions

In employee node i have written like this

<?php

  class employee extends atkNode{

      function employee(){
//$this->atkNode("employee");


    $this->atkNode("employee" ,NF_ADD_LINK);


    $this->setTable("newmod1_employee");


$this->add(new atkNumberAttribute("id",AF_AUTOKEY));


$this->add(new atkAttribute("name" ,AF_OBLIGATORY|AF_SEARCHABLE),NULL,10);


$this->add(new atkListAttribute("designation",array('Manager','Junior Scientist ','PHP Programmer','Sap Programmer','Quality Analyist'),AF_OBLIGATORY),NULL,40);


$this->add(new atkDateAttribute("date",AF_OBLIGATORY),NULL,45);



$this->add(new atkAttribute("location",AF_OBLIGATORY),NULL,50);



$this->add(new atkattribute("branch",AF_OBLIGATORY),NULL,55);



//$this->add(new  atkManyToOneRelation("designation","newmod1.employee",AF_SEARCHABLE));



$this->add(new atkNumberAttribute("employeecode",AF_OBLIGATORY),NULL,60);



$this->add(new atkEmailAttribute("email",AF_OBLIGATORY),NULL,65);



  }         
  /*
  public function adminFooter(){
    return nodeSourceUrl("newmod1.employee");
  }*/

 }

In department node i have written like this

 class department extends atkNode {

//$descriptor_field="[designation]-[destination]";

function department() {

       $this->atkNode("department" ,NF_ADD_LINK);

       $this->setTable("newmod1_department");

       $this->add(new atkNumberAttribute("id",AF_AUTOKEY), NULL,10);

       $this->add(new atkAttribute("name" ,AF_READ_ONLY,AF_OBLIGATORY|AF_SEARCHABLE),NULL,20 );   

       $this->add(new atkAttribute("branch",AF_OBLIGATORY), NULL,30);   

       $this->add(new atkListAttribute("designation",array('Manager','Junior Scientist','PHP Programmer','Sap Programmer','Quality Analyist'),AF_PRIMARY|AF_SEARCHABLE|AF_FORCE_LOAD|AF_OBLIGATORY),NULL,40);



       //$this->addFilter(new atkOneToManyRelation("designation","newmod1.designation","id", AF_OBLIGATORY), "employees"); 

        $this->add(new atkattribute("Salary",AF_TOTAL ) );
    }


  /*
 public function adminFooter(){
    return nodeSourceUrl("newmod1.employee");
 }*/

}

I have created a table for this two nodes.I dont know how to use filters and validators for department node.

You need to setup an atkonetomanyrelation between your employee table and your department table

Suggest you post this query on the ATK forum at http://forum.achievo.org/viewforum.php?f=2

Wayne

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM