as_array(), array("comment")); break; case "json": print json_encode($comment->as_array()); break; default: $v = new View("comment.$output_format"); $v->comment = $comment; print $v; } } /** * Update existing comment. * @see Rest_Controller::_put($resource) */ public function _put($comment) { $form = comment::get_edit_form($comment); if ($form->validate()) { $comment->author = $this->input->post('author'); $comment->email = $this->input->post('email'); $comment->text = $this->input->post('text'); $comment->save(); return; } print $form; } /** * Add a new comment * @see Rest_Controller::_post($resource) */ public function _post($comment) { throw new Exception("@todo Comment_Controller::_post NOT IMPLEMENTED"); } /** * Delete existing comment. * @see Rest_Controller::_delete($resource) */ public function _delete($resource) { throw new Exception("@todo Comment_Controller::_delete NOT IMPLEMENTED"); } }