aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2009-01-02 20:57:56 +0000
committernikrou <nikrou@piwigo.org>2009-01-02 20:57:56 +0000
commitb225a52b918168cf00e0cd275f62bbca624d4833 (patch)
tree8cba02bd2d7834ca2d7efa1deb85c6bd78190542 /include/section_init.inc.php
parentedd0ce68d0db0300db8a9a9b4832f29148f803a1 (diff)
task:0000902: button to remove all favorites
git-svn-id: http://piwigo.org/svn/trunk@3037 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php48
1 files changed, 40 insertions, 8 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 0d8659113..897b2a01d 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -373,7 +373,24 @@ SELECT DISTINCT image_id
{
check_user_favorites();
- $query = '
+ $page = array_merge(
+ $page,
+ array(
+ 'title' => l10n('favorites')
+ )
+ );
+
+ if (!empty($_GET['action']) && ($_GET['action'] == 'remove_all_from_favorites'))
+ {
+ $query = '
+DELETE FROM '.FAVORITES_TABLE.'
+ WHERE user_id = '.$user['id'].'
+;';
+ pwg_query($query);
+ }
+ else
+ {
+ $query = '
SELECT image_id
FROM '.FAVORITES_TABLE.'
INNER JOIN '.IMAGES_TABLE.' ON image_id = id
@@ -388,14 +405,29 @@ SELECT image_id
).'
'.$conf['order_by'].'
;';
-
- $page = array_merge(
- $page,
- array(
- 'title' => l10n('favorites'),
- 'items' => array_from_query($query, 'image_id'),
- )
+ $page = array_merge(
+ $page,
+ array(
+ 'items' => array_from_query($query, 'image_id'),
+ )
);
+
+ if (count($page['items'])>0)
+ {
+ $template->assign(
+ 'favorite',
+ array(
+ 'FAVORITE_IMG' =>
+ get_root_url().get_themeconf('icon_dir').'/del_all_favorites.png',
+ 'FAVORITE_HINT' => l10n('del_all_favorites_hint'),
+ 'U_FAVORITE' => add_url_params(
+ 'index.php?/favorites',
+ array('action'=>'remove_all_from_favorites')
+ ),
+ )
+ );
+ }
+ }
}
// +-----------------------------------------------------------------------+
// | recent pictures section |