mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-06-03 10:19:47 -04:00
Merge pull request #97 from mikeage/organize_tag2
Add batch tagging via the organize module
This commit is contained in:
@@ -182,6 +182,28 @@ class Organize_Controller extends Controller {
|
||||
json::reply(null);
|
||||
}
|
||||
|
||||
function tag() {
|
||||
access::verify_csrf();
|
||||
$input = Input::instance();
|
||||
|
||||
foreach (explode(",", $input->post("item_ids")) as $item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
if (access::can("edit", $item)) {
|
||||
// Assuming the user can view/edit the current item, loop
|
||||
// through each tag that was submitted and apply it to
|
||||
// the current item.
|
||||
foreach (explode(",", $input->post("tag_names")) as $tag_name) {
|
||||
$tag_name = trim($tag_name);
|
||||
if ($tag_name) {
|
||||
tag::add($item, $tag_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json::reply(null);
|
||||
}
|
||||
|
||||
private function _get_tree($item, $selected) {
|
||||
$tree = array();
|
||||
$children = $item->viewable()
|
||||
|
||||
Reference in New Issue
Block a user