menu categories managed as list items

git-svn-id: http://piwigo.org/svn/trunk@478 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
z0rglub
2004-08-06 09:42:07 +00:00
parent 773577bc4f
commit 0188ea673e
2 changed files with 10 additions and 62 deletions
+7 -52
View File
@@ -45,52 +45,7 @@ if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
{
check_restrictions( $page['cat'] );
}
//-------------------------------------------------------------- initialization
function display_category( $category, $indent )
{
global $user,$template,$page;
$url = PHPWG_ROOT_PATH.'category.php?cat='.$category['id'];
$style = '';
if ( isset( $page['cat'] )
and is_numeric( $page['cat'] )
and $category['id'] == $page['cat'] )
{
$style = 'font-weight:normal;color:yellow;';
}
$name = $category['name'];
if (empty($name)) $name = str_replace( '_', ' ', $category['dir'] );
$template->assign_block_vars('category', array(
'T_NAME' => $style,
'LINK_NAME' => $name,
'INDENT' => $indent,
'U_LINK' => add_session_id($url),
'BULLET_IMAGE' => $user['lien_collapsed'])
);
if ( $category['nb_images'] > 0 )
{
$template->assign_block_vars(
'category.infocat',
array(
'TOTAL_CAT'=>$category['nb_images'],
'CAT_ICON'=>get_icon($category['date_last'])
));
}
// recursive call
if ( $category['expanded'] )
{
foreach ( $category['subcats'] as $subcat ) {
display_category( $subcat, $indent.str_repeat( ' ', 2 ));
}
}
}
// detection of the start picture to display
if ( !isset( $_GET['start'] )
or !is_numeric( $_GET['start'] )
@@ -138,9 +93,7 @@ if ( isset( $_GET['num'] )
$page['plain_structure'] = get_user_plain_structure();
$page['structure'] = create_user_structure( '' );
$page['structure'] = update_structure( $page['structure'] );
//----------------------------------------------------- template initialization
//
// Start output of page
//
@@ -162,11 +115,18 @@ if ( isset( $page['cat_nb_images'] ) and $page['cat_nb_images'] > 0 )
$icon_recent = get_icon(date('Y-m-d'));
$page['menu'] = '';
foreach ($page['structure'] as $category)
{
$page['menu'].= get_html_menu_category($category);
}
$template->assign_vars(array(
'NB_PICTURE' => count_user_total_images(),
'TITLE' => $template_title,
'USERNAME' => $user['username'],
'TOP_VISITED'=>$conf['top_number'],
'MENU_CATEGORIES_CONTENT'=>$page['menu'],
'L_CATEGORIES' => $lang['categories'],
'L_HINT_CATEGORY' => $lang['hint_category'],
@@ -215,11 +175,6 @@ $template->assign_vars(array(
)
);
foreach ( $page['structure'] as $category ) {
// display category is a function relative to the template
display_category( $category, ' ');
}
// authentification mode management
if ( !$user['is_the_guest'] )
{
+3 -10
View File
@@ -7,16 +7,9 @@
<a href="{U_HOME}">{L_CATEGORIES}</a>
</div>
<div class="menu">
<!-- BEGIN category -->
{category.INDENT}
<img src="{category.BULLET_IMAGE}" style="border:none;" alt="" />
<a href="{category.U_LINK}"><span title='{L_HINT_CATEGORY}' style="{category.T_NAME}">{category.LINK_NAME}</span></a>
<!-- BEGIN infocat -->
<span class="menuInfoCat">[<span title="{category.infocat.TOTAL_CAT} {L_IMG_AVAILABLE}">{category.infocat.TOTAL_CAT}</span>]</span>
{category.infocat.CAT_ICON}
<!-- END infocat -->
<br />
<!-- END category -->
<ul class="menu">
{MENU_CATEGORIES_CONTENT}
</ul>
<div class="totalImages">[&nbsp;{NB_PICTURE}&nbsp;{L_TOTAL}&nbsp;]</div>
<br />
<ul class="menu">