/**
  * Retrieve data in json format
  *
  **/
 function retrieve($serial_number = '', $section = '')
 {
     $out = array();
     $where = $section ? 'section=?' : '';
     $bindings = $section ? array($section) : array();
     $comment = new Comment_model();
     if ($section) {
         if ($comment->retrieve_record($serial_number, $where, $bindings)) {
             $out = $comment->rs;
         }
     } else {
         foreach ($comment->retrieve_records($serial_number, $where, $bindings) as $obj) {
             $out[] = $obj->rs;
         }
     }
     $obj = new View();
     $obj->view('json', array('msg' => $out));
 }
Beispiel #2
0
 public function publish()
 {
     $u = new Comment_model($this->template, $this->router->query_string);
     $u->publish();
     $this->template->render("publish_comment_result", "json");
 }