aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
committerplegall <plg@piwigo.org>2006-04-02 22:26:19 +0000
commit42abf4c57664d2596872d437f70b95193f9a5d18 (patch)
treea1262b8601d5ac5b04b5b2e71af52c453712b9df /index.php
parent68ed2ea617ede199a0e2f15fdd4886095ae600cb (diff)
improvement: tags replace keywords. Better data model, less
limitations. Each image can be associated to as many tag as needed. Tags can contain non ASCII characters. Oriented navigation with tags by association. git-svn-id: http://piwigo.org/svn/trunk@1119 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'index.php')
-rw-r--r--index.php80
1 files changed, 80 insertions, 0 deletions
diff --git a/index.php b/index.php
index 3bb03d4bd..784832623 100644
--- a/index.php
+++ b/index.php
@@ -221,6 +221,76 @@ if (count($conf['links']) > 0)
);
}
}
+//------------------------------------------------------------------------ tags
+if ('tags' == $page['section'])
+{
+ $template->assign_block_vars('tags', array());
+
+ // display tags associated to currently tagged items, less current tags
+ $query = '
+SELECT tag_id, name, url_name, count(*) counter
+ FROM '.IMAGE_TAG_TABLE.'
+ INNER JOIN '.TAGS_TABLE.' ON tag_id = id
+ WHERE image_id IN ('.implode(',', $items).')
+ AND tag_id NOT IN ('.implode(',', $page['tag_ids']).')
+ GROUP BY tag_id
+ ORDER BY name ASC
+;';
+ $result = pwg_query($query);
+
+ $tags = array();
+
+ while($row = mysql_fetch_array($result))
+ {
+ array_push($tags, $row);
+ }
+
+ $tags = add_level_to_tags($tags);
+
+ foreach ($tags as $tag)
+ {
+ $template->assign_block_vars(
+ 'tags.tag',
+ array(
+ 'URL_ADD' => make_index_URL(
+ array(
+ 'tags' => array_merge(
+ $page['tags'],
+ array(
+ array(
+ 'id' => $tag['tag_id'],
+ 'url_name' => $tag['url_name'],
+ ),
+ )
+ )
+ )
+ ),
+
+ 'URL' => make_index_URL(
+ array(
+ 'tags' => array(
+ array(
+ 'id' => $tag['tag_id'],
+ 'url_name' => $tag['url_name'],
+ ),
+ )
+ )
+ ),
+
+ 'NAME' => $tag['name'],
+
+ 'TITLE' => l10n('See pictures linked to this tag only'),
+
+ 'TITLE_ADD' => sprintf(
+ l10n('%d pictures are also linked to current tags'),
+ $tag['counter']
+ ),
+
+ 'CLASS' => 'tagLevel'.$tag['level']
+ )
+ );
+ }
+}
//---------------------------------------------------------- special categories
// favorites categories
if ( !$user['is_the_guest'] )
@@ -332,6 +402,16 @@ else
}
}
+// tags link
+$template->assign_block_vars(
+ 'summary',
+ array(
+ 'TITLE' => l10n('See available tags'),
+ 'NAME' => l10n('Tags'),
+ 'U_SUMMARY'=> get_root_url().'tags.php',
+ )
+ );
+
// search link
$template->assign_block_vars(
'summary',