diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-18 19:34:03 +0000 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-18 19:34:03 +0000 |
| commit | 762ca225443626b69c94f6d6c833f66de69b2ce1 (patch) | |
| tree | f2c77401b6b6f018728fc37f0b6fdbb012d75654 /modules/tag/helpers | |
| parent | ad16488643017f293dda6b226024751d15cb4426 (diff) | |
This takes us the next step closer to providing bulk edit. We still
can't edit, but we are getting closer :-).
This change sets up a framework for modules to contribute edit panels
to the organize drawer. Currently implemented General (albums and
photos), Sort Order (albums only) and Manage Tags
Diffstat (limited to 'modules/tag/helpers')
| -rw-r--r-- | modules/tag/helpers/tag_event.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index 43ff6a15..a13ae99c 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -60,4 +60,37 @@ class tag_event_Core { $db->delete("items_tags", array("item_id" => "$item->id")); } + static function organize_form_creation($event_parms) { + $v = new View("tag_organize.html"); + $v->tags = array(); + + $ids = implode(", ", $event_parms->itemids); + $db = Database::instance(); + $tags = $db->query("SELECT it.tag_id, t.name, + COUNT(DISTINCT it.item_id) as item_count, + UPPER(SUBSTR(t.name, 1, 1)) as first_letter + FROM {items_tags} it, {tags} t + WHERE it.tag_id = t.id + AND it.item_id in($ids) + GROUP BY it.tag_id + ORDER BY first_letter ASC, t.name ASC"); + foreach ($tags as $tag) { + $v->tags[$tag->first_letter]["taglist"][] = + array("id" => $tag->tag_id, "tag" => $tag->name, "count" => $tag->item_count); + } + $v->tag_count = $tags->count(); + + $letters = $db->query("SELECT COUNT(DISTINCT it.item_id) as letter_count, + UPPER(SUBSTR(t.name, 1, 1)) as first_letter + FROM {items_tags} it, {tags} t + WHERE it.tag_id = t.id + AND it.item_id in($ids) + GROUP BY first_letter + ORDER BY first_letter ASC"); + foreach ($letters as $letter) { + $v->tags[$letter->first_letter]["count"] = $letter->letter_count; + } + + $event_parms->panes[] = array("label" => t("Manage Tags"), "content" => $v); + } } |
