aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_html.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-11-23 22:31:24 +0000
committerplegall <plg@piwigo.org>2004-11-23 22:31:24 +0000
commitf0fcd1eedc26c0d36b6b0556b9f53124ba9f889f (patch)
tree0502dbd43c04199ec2ba45913985fee86793491a /include/functions_html.inc.php
parent5197779bba12db45508becc910d5886d77f3675d (diff)
- global categories' options : instead of N horizontal tabs on a single
page, N options in the left menu (but the same backend) - categories.global_rank : new calculated field. It gives a global rank of the category among all others (updated during ordering) - category.php page : menu is generated faster thanks to categories.global_rank, recursivity becomes useless :-) - new function to display select box with a set of categories : display_select_cat_wrapper - cat_options : instead of using 1 multiselect for true/false items, using 1 multiselect for true, and another one for false. The form provides buttons with arrows to switch categories from one multiselect to another - deletion of obsolete function display_categories (working with the old template system) - deletion of obsolete functions get_user_plain_structure, create_user_structure, get_user_subcat_ids, update_structure, count_images : useless thanks to global_rank git-svn-id: http://piwigo.org/svn/trunk@614 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_html.inc.php86
1 files changed, 45 insertions, 41 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index ccf6c7435..f1a8610db 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -211,7 +211,7 @@ function get_cat_display_name($cat_informations,
* @return string
*/
function get_cat_display_name_cache($uppercats,
- $separator,
+ $separator,
$url = 'category.php?cat=',
$replace_space = true)
{
@@ -271,72 +271,76 @@ SELECT id,name
*
* HTML code generated uses logical list tags ul and each category is an
* item li. The paramter given is the category informations as an array,
- * used keys are : id, name, dir, nb_images, date_last, subcats (sub-array)
+ * used keys are : id, name, nb_images, date_last
*
- * @param array category
+ * @param array categories
* @return string
*/
-function get_html_menu_category($category)
+function get_html_menu_category($categories)
{
global $page, $lang;
+ $ref_level = 0;
$menu = '
+ <ul class="menu">';
+
+ foreach ($categories as $category)
+ {
+ $level = substr_count($category['global_rank'], '.');
+ if ($level > $ref_level)
+ {
+ $menu.= '
+ <ul class="menu">';
+ }
+ else if ($level < $ref_level)
+ {
+ $menu.= '
+ </ul>';
+ }
+ $ref_level = $level;
+
+ $menu.= '
<li>';
- $url = add_session_id(PHPWG_ROOT_PATH.'category.php?cat='.$category['id']);
+ $url = add_session_id(PHPWG_ROOT_PATH.'category.php?cat='.$category['id']);
- $class = '';
- if (isset($page['cat'])
- and is_numeric($page['cat'])
- and $category['id'] == $page['cat'])
- {
- $class = 'menuCategorySelected';
- }
- else
- {
- $class = 'menuCategoryNotSelected';
- }
-
- $name = $category['name'];
- if (empty($name))
- {
- $name = str_replace('_', ' ', $category['dir']);
- }
+ $class = '';
+ if (isset($page['cat'])
+ and is_numeric($page['cat'])
+ and $category['id'] == $page['cat'])
+ {
+ $class = 'menuCategorySelected';
+ }
+ else
+ {
+ $class = 'menuCategoryNotSelected';
+ }
- $menu.= '
+ $menu.= '
<a href="'.$url.'"
title="'.$lang['hint_category'].'"
class="'.$class.'">
- '.$name.'
+ '.$category['name'].'
</a>';
- if ($category['nb_images'] > 0)
- {
- $menu.= '
+ if ($category['nb_images'] > 0)
+ {
+ $menu.= '
<span class="menuInfoCat"
title="'.$category['nb_images'].'
'.$lang['images_available'].'">
['.$category['nb_images'].']
</span>
'.get_icon($category['date_last']);
+ }
+
+ $menu.= '</li>';
}
- // recursive call
- if ($category['expanded'] and count($category['subcats']) > 0)
- {
- $menu.= '
- <ul class="menu">';
- foreach ($category['subcats'] as $subcat)
- {
- $menu.= get_html_menu_category($subcat);
- }
- $menu.= '
+ $menu.= '
</ul>';
- }
-
- $menu.= '</li>';
-
+
return $menu;
}