Changeset 1624 for trunk/include/functions_category.inc.php
- Timestamp:
- Dec 2, 2006, 12:31:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r1573 r1624 53 53 function get_categories_menu() 54 54 { 55 global $page,$user; 56 57 $infos = array(''); 58 59 $query = ' 60 SELECT name,id,date_last,nb_images,global_rank 61 FROM '.CATEGORIES_TABLE.' 62 WHERE 1 = 1'; // stupid but permit using AND after it ! 55 global $page, $user; 56 57 $query = ' 58 SELECT '; 59 // From CATEGORIES_TABLE 60 $query.= ' 61 name, id, nb_images, global_rank,'; 62 // From USER_CACHE_CATEGORIES_TABLE 63 $query.= ' 64 max_date_last, is_child_date_last, count_images, count_categories'; 65 66 // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE 67 $query.= ' 68 FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' 69 ON id = cat_id and user_id = '.$user['id']; 63 70 if (!$user['expand']) 64 71 { 65 72 $query.= ' 66 AND(id_uppercat is NULL';73 WHERE (id_uppercat is NULL'; 67 74 if (isset($page['category'])) 68 75 { … … 70 77 } 71 78 $query.= ')'; 72 }73 if ($user['forbidden_categories'] != '')74 {75 $query.= '76 AND id NOT IN ('.$user['forbidden_categories'].')';77 79 } 78 80 $query.= ' … … 83 85 while ($row = mysql_fetch_array($result)) 84 86 { 87 $row['is_child_date_last'] = get_boolean($row['is_child_date_last']); 85 88 array_push($cats, $row); 86 89 } … … 89 92 return get_html_menu_category($cats); 90 93 } 94 91 95 92 96 /** … … 353 357 return ($a['rank'] < $b['rank']) ? -1 : 1; 354 358 } 359 360 /** 361 * returns display text for information images of category 362 * 363 * @param array categories 364 * @return string 365 */ 366 function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_categories, $short_message = true) 367 { 368 $display_text = ''; 369 370 // Count of category is main 371 // if not picture on categorie, test on sub-categories 372 $count = ($cat_nb_images > 0 ? $cat_nb_images : $cat_count_images); 373 374 if ($count > 0) 375 { 376 $display_text.= sprintf(l10n(($count > 1 ? 'images_available' : 'image_available')), $count); 377 378 if ($cat_nb_images > 0) 379 { 380 if (! $short_message) 381 { 382 $display_text.= ' '.l10n('images_available_cpl'); 383 } 384 } 385 else 386 { 387 $display_text.= ' '.sprintf(l10n(($cat_count_categories > 1 ? 'images_available_cats' : 'images_available_cat')), $cat_count_categories); 388 } 389 } 390 391 return $display_text; 392 } 393 355 394 ?>
Note: See TracChangeset
for help on using the changeset viewer.