favorite image icon is not taken from php but left to the theme (still in the php for the branch for theme compatibility)

git-svn-id: http://piwigo.org/svn/branches/2.1@6614 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices 2010-06-28 19:42:37 +00:00
parent 20752c742f
commit b735fef251
3 changed files with 29 additions and 46 deletions

View file

@ -796,40 +796,23 @@ SELECT COUNT(*) AS nb_fav
WHERE image_id = '.$page['image_id'].'
AND user_id = '.$user['id'].'
;';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$row = pwg_db_fetch_assoc( pwg_query($query) );
$is_favorite = $row['nb_fav'] != 0;
if ($row['nb_fav'] == 0)
{
$template->assign(
'favorite',
array(
'IS_FAVORITE' => $is_favorite,
'FAVORITE_IMG' =>
get_root_url().get_themeconf('icon_dir').'/favorite.png',
'FAVORITE_HINT' => l10n('add this image to your favorites'),
get_root_url().get_themeconf('icon_dir').(!$is_favorite ? '/favorite.png' : '/del_favorite.png' ),
'FAVORITE_HINT' => l10n( !$is_favorite ? 'add this image to your favorites' : 'delete this image from your favorites'),
'U_FAVORITE' => add_url_params(
$url_self,
array('action'=>'add_to_favorites')
array('action'=> !$is_favorite ? 'add_to_favorites' : 'remove_from_favorites' )
),
)
);
}
else
{
$template->assign(
'favorite',
array(
'FAVORITE_IMG' =>
get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
'FAVORITE_HINT' => l10n('delete this image from your favorites'),
'U_FAVORITE' => add_url_params(
$url_self,
array('action'=>'remove_from_favorites')
),
)
);
}
}
//--------------------------------------------------------- picture information
// legend

View file

@ -15,7 +15,7 @@
{/if}
{if isset($favorite) }
<li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
<li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/del_all_favorites.png" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
{/if}
{if isset($U_CADDIE) }

View file

@ -50,7 +50,7 @@
{/if}
{if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
{if isset($favorite) }
<a href="{$favorite.U_FAVORITE}" title="{$favorite.FAVORITE_HINT}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{$favorite.FAVORITE_HINT}"></a>
<a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/{if $favorite.IS_FAVORITE}del_favorite{else}favorite{/if}.png" class="button" alt="favorite" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"></a>
{/if}
{if !empty($U_SET_AS_REPRESENTATIVE) }
<a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as category representative'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/representative.png" class="button" alt="{'representative'|@translate}"></a>