mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
fixes #2414 change related tags display
Add conf to display or not the related tag options by default Add templates and css for new display
This commit is contained in:
+11
-60
@@ -143,68 +143,19 @@ function initialize_menu()
|
||||
$block = $menu->get_block('mbTags');
|
||||
if ( $block!=null and 'picture' != script_basename() )
|
||||
{
|
||||
if ('tags'==@$page['section'])
|
||||
$tags = get_available_tags();
|
||||
usort($tags, 'tags_counter_compare');
|
||||
$tags = array_slice($tags, 0, $conf['menubar_tag_cloud_items_number']);
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$tags = get_common_tags(
|
||||
$page['items'],
|
||||
$conf['menubar_tag_cloud_items_number'],
|
||||
$page['tag_ids']
|
||||
);
|
||||
$tags = add_level_to_tags($tags);
|
||||
$block->data[] = array_merge(
|
||||
$tag,
|
||||
array(
|
||||
'URL' => make_index_url( array( 'tags' => array($tag) ) ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$block->data[] = array_merge(
|
||||
$tag,
|
||||
array(
|
||||
'U_ADD' => make_index_url(
|
||||
array(
|
||||
'tags' => array_merge(
|
||||
$page['tags'],
|
||||
array($tag)
|
||||
)
|
||||
)
|
||||
),
|
||||
'URL' => make_index_url( array( 'tags' => array($tag) )
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
$template->assign( 'IS_RELATED', false);
|
||||
}
|
||||
//displays all tags available for the current user
|
||||
else if ($conf['menubar_tag_cloud_content'] == 'always_all' or ($conf['menubar_tag_cloud_content'] == 'all_or_current' and empty($page['items'])) )
|
||||
{
|
||||
$tags = get_available_tags();
|
||||
usort($tags, 'tags_counter_compare');
|
||||
$tags = array_slice($tags, 0, $conf['menubar_tag_cloud_items_number']);
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$block->data[] = array_merge(
|
||||
$tag,
|
||||
array(
|
||||
'URL' => make_index_url( array( 'tags' => array($tag) ) ),
|
||||
)
|
||||
);
|
||||
}
|
||||
$template->assign( 'IS_RELATED', false);
|
||||
}
|
||||
//displays only the tags available from the current thumbnails displayed
|
||||
else if ( !empty($page['items']) and ($conf['menubar_tag_cloud_content'] == 'current_only' or $conf['menubar_tag_cloud_content'] == 'all_or_current') )
|
||||
{
|
||||
$selection = array_slice( $page['items'], $page['start'], $page['nb_image_page'] );
|
||||
$tags = add_level_to_tags( get_common_tags($selection, $conf['content_tag_cloud_items_number']) );
|
||||
foreach ($tags as $tag)
|
||||
{
|
||||
$block->data[] =
|
||||
array_merge( $tag,
|
||||
array(
|
||||
'URL' => make_index_url( array( 'tags' => array($tag) ) ),
|
||||
)
|
||||
);
|
||||
}
|
||||
$template->assign( 'IS_RELATED', true);
|
||||
}
|
||||
if ( !empty($block->data) )
|
||||
{
|
||||
$block->template = 'menubar_tags.tpl';
|
||||
|
||||
Reference in New Issue
Block a user