summaryrefslogtreecommitdiff
path: root/modules/tag/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag/controllers')
-rw-r--r--modules/tag/controllers/tags.php22
1 files changed, 6 insertions, 16 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php
index 69bc9a48..4f8cfa5b 100644
--- a/modules/tag/controllers/tags.php
+++ b/modules/tag/controllers/tags.php
@@ -42,31 +42,22 @@ class Tags_Controller extends REST_Controller {
}
public function _index() {
- // @todo: represent this in different formats
print tag::cloud(30);
}
- public function _form_add($item_id) {
- return tag::get_add_form($item_id);
- }
-
- public function _form_edit($tag) {
- throw new Exception("@todo Tag_Controller::_form_edit NOT IMPLEMENTED");
- }
-
public function _create($tag) {
rest::http_content_type(rest::JSON);
$item = ORM::factory("item", $this->input->post("item_id"));
access::required("edit", $item);
- $form = tag::get_add_form($item->id);
+ $form = tag::get_add_form($item);
if ($form->validate()) {
tag::add($item, $this->input->post("tag_name"));
print json_encode(
array("result" => "success",
"resource" => url::site("tags/{$tag->id}"),
- "form" => tag::get_add_form($item->id)->__toString()));
+ "form" => tag::get_add_form($item)->__toString()));
} else {
print json_encode(
array("result" => "error",
@@ -74,11 +65,10 @@ class Tags_Controller extends REST_Controller {
}
}
- public function _delete($tag) {
- throw new Exception("@todo Tag_Controller::_delete NOT IMPLEMENTED");
- }
+ public function _form_add($item_id) {
+ $item = ORM::factory("item", $item_id);
+ access::required("view", $item);
- public function _update($tag) {
- throw new Exception("@todo Tag_Controller::_update NOT IMPLEMENTED");
+ return tag::get_add_form($item);
}
}