/**
  * @brief Constructor
  *
  * It's allowed to create an object with the ID 0 (for the root element).
  *
  * @param Database  &$database      reference to the Database-object
  * @param User      &$current_user  reference to the current user which is logged in
  * @param Log       &$log           reference to the Log-object
  * @param string    $tablename      name of the table where the elements are located
  * @param integer   $id             ID of the element we want to get
  *
  * @throws Exception        if there is no such element in the database
  * @throws Exception        if there was an error
  */
 public function __construct(&$database, &$current_user, &$log, $tablename, $id)
 {
     parent::__construct($database, $current_user, $log, $tablename, $id, true);
     if ($id == 0) {
         // this is the root node
         $this->db_data['id'] = NULL;
         $this->db_data['name'] = 'Oberste Ebene';
         $this->db_data['parent_id'] = -1;
         $this->full_path_strings = array('Oberste Ebene');
         $this->level = -1;
     }
 }
Example #2
0
 /**
  * @brief Constructor
  *
  * @param Database  &$database:     reference to the Database-object
  * @param User      &$current_user  reference to the current user which is logged in
  * @param Log       &$log:          reference to the Log-object
  * @param integer   $id:            ID of the part we want to get
  *
  * @throws Exception    if there is no such part in the database
  * @throws Exception    if there was an error
  */
 public function __construct(&$database, &$current_user, &$log, $id)
 {
     parent::__construct($database, $current_user, $log, 'parts', $id);
 }