Skip to content

Commit

Permalink
task:0000902: button to remove all favorites
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@3037 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Jan 2, 2009
1 parent edd0ce6 commit b225a52
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 8 deletions.
48 changes: 40 additions & 8 deletions include/section_init.inc.php
Expand Up @@ -373,7 +373,24 @@
{
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
Expand All @@ -388,14 +405,29 @@
).'
'.$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 |
Expand Down
1 change: 1 addition & 0 deletions language/en_UK/common.lang.php
Expand Up @@ -175,6 +175,7 @@
$lang['day'][6] = 'Saturday';
$lang['default_sort'] = 'Default';
$lang['del_favorites_hint'] = 'delete this image from your favorites';
$lang['del_all_favorites_hint'] = 'delete all images from your favorites';
$lang['delete'] = 'Delete';
$lang['descending'] = 'descending';
$lang['download'] = 'download';
Expand Down
1 change: 1 addition & 0 deletions language/fr_FR/common.lang.php
Expand Up @@ -175,6 +175,7 @@
$lang['day'][6] = 'Samedi';
$lang['default_sort'] = 'Par défaut';
$lang['del_favorites_hint'] = 'supprimer cette image de vos favoris';
$lang['del_all_favorites_hint'] = 'supprimer toutes les images de vos favoris';
$lang['delete'] = 'Supprimer';
$lang['descending'] = 'décroissant';
$lang['download'] = 'télécharger';
Expand Down
4 changes: 4 additions & 0 deletions template/yoga/index.tpl
Expand Up @@ -14,6 +14,10 @@
</select>
</li>
{/if}

{if isset($favorite) }
<li><a href="{$favorite.U_FAVORITE}" title="{$favorite.FAVORITE_HINT}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{$favorite.FAVORITE_HINT}"></a></li>
{/if}

{if isset($U_CADDIE) }
<li><a href="{$U_CADDIE}" title="{'add to caddie'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/caddie_add.png" class="button" alt="{'caddie'|@translate}"/></a></li>
Expand Down

0 comments on commit b225a52

Please sign in to comment.