summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/helpers/tag_event.php33
-rw-r--r--modules/tag/views/tag_organize.html.php25
2 files changed, 58 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);
+ }
}
diff --git a/modules/tag/views/tag_organize.html.php b/modules/tag/views/tag_organize.html.php
new file mode 100644
index 00000000..bb46b861
--- /dev/null
+++ b/modules/tag/views/tag_organize.html.php
@@ -0,0 +1,25 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<span id="gTagCount"><?= t2("There is one tag", "There are %count tags", $tag_count) ?></span>
+<span id="gAddTag">
+ <a id="gAddTagButton" href="#" class="gButtonLink"><?= t("Click to Add Tag") ?></a>
+</span>
+<? foreach ($tags as $firstLetter => $tagGroup): ?>
+<div class="gTagGroup">
+ <strong><?= $firstLetter ?></strong><span class="understate">&nbsp;(<?= $tagGroup["count"] ?>)</span>
+ <ul>
+ <? foreach ($tagGroup["taglist"] as $taglist): ?>
+ <li>
+ <span id="gTag-<?= $taglist['id'] ?>" class="gEditable tag-name"><?= $taglist["tag"] ?></span>
+ <span class="understate">(<?= $taglist["count"] ?>)</span>
+
+ <!-- a href="<?= url::site("admin/tags/form_delete/{$taglist['id']}") ?>"
+ class="gDialogLink delete-link gButtonLink" -->
+ <a href="#"
+ class="gDialogLink delete-link gButtonLink">
+ <span class="ui-icon ui-icon-trash"><?= t("Delete tag") ?></span>
+ </a>
+ </li>
+ <? endforeach ?>
+ </ul>
+</div>
+<? endforeach ?> \ No newline at end of file