public function find_by_id()
 {
     $c_id = Request::get_c_id();
     $id = Request::get_id();
     $item = Notebook::repository()->find_one_by_id($c_id, $id);
     $data = (object) array();
     if ($item) {
         $data->title = $item->title;
         $data->description = $item->description;
     }
     $this->response($success, '', $data);
 }
 /**
  * Performs the edit action. 
  */
 public function edit()
 {
     if (!$this->is_allowed_to_edit()) {
         $this->forbidden();
         return;
     }
     $id = Request::get_id();
     $c_id = Request::get_c_id();
     $repo = Notebook::repository();
     $item = $repo->find_one_by_id($c_id, $id);
     $action = $this->url(self::ACTION_EDIT);
     $form = NotebookForm::create($action, $item);
     if ($form->validate()) {
         $success = $repo->save($item);
         $message = $success ? get_lang('NotebookUpdated') : get_lang('Error');
         $home = $this->url(self::ACTION_DEFAULT);
         Redirect::go($home);
     }
     $data = (object) array();
     $data->form = $form;
     $this->render('edit', $data);
 }
 /**
  * Returns an item key. I.e. not a real entity object but an 
  * object with the object keys set up.
  * 
  * @return object
  */
 public static function get_item_key()
 {
     $result = (object) array();
     $result->c_id = Request::get_c_id();
     $result->id = Request::get_id();
     return $result;
 }