예제 #1
0
 function new_answer($data)
 {
     $answer = new sub_entry();
     $answer->set_data($data);
     $answer->history = $this->history;
     $answer->history[0] =& $this;
     $answer->insert();
     return $answer;
 }
예제 #2
0
 function load_history()
 {
     $pid = $_SESSION['userid'];
     $query = 'select
           forum_relation.level, 
           forum.id,
           forum.rel_to,
           forum.author, 
           person.first_name as author_first_name, 
           person.last_name as author_last_name, 
           forum.created, 
           forum.topic, 
           forum.text, 
           rights_person.rights as rights_person, 
           pg.gid, 
           rights_group.rights as rights_group 
          from forum_relation
          left join forum on
           forum_relation.entry=forum.id 
          left join person on
           forum.author=person.id 
          left join forum_rights_person as rights_person on
           forum.id=rights_person.entry_id 
           and rights_person.person_id="' . $pid . '" 
          left join forum_rights_group as rights_group on
           rights_person.rights is null 
           and forum.id=rights_group.entry_id 
          left join pg on
           rights_group.group_id=pg.gid 
           and pg.pid="' . $pid . '" 
          where
           forum_relation.answer="' . $this->id . '" 
          order by forum_relation.level';
     $this->db->query($query);
     while ($data = mysql_fetch_array($this->db->result)) {
         $level = $data['level'];
         $id = $data['id'];
         $parent =& $this->entries[$id];
         $this->history[$level] =& $parent;
         if (!isset($parent)) {
             $parent = new sub_entry();
             $parent->set_data($data);
         }
         $parent->add_rights_row($data);
     }
     $this->admin = $this->data['author'];
     for ($i = 1; $i < count($this->history); $i++) {
         $parent =& $this->history[$i];
         $this->admin = $parent->data['author'];
         $this->add_rights($parent->rights);
     }
 }