Ignore:
Timestamp:
Dec 2, 2006, 12:31:19 AM (17 years ago)
Author:
rub
Message:

Resolved Issue ID 0000299:

o Add (new) icon of parent category with children categories including new images
o Improved display text for images count
o Improved (a little) mass_* functions

More explications on the forum.
You must call directly upgrade_feep.php (http://127.0.0.1/BSF/upgrade_feed.php for example)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r1573 r1624  
    5353function get_categories_menu()
    5454{
    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 = '
     58SELECT ';
     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'];
    6370  if (!$user['expand'])
    6471  {
    6572    $query.= '
    66     AND (id_uppercat is NULL';
     73    WHERE (id_uppercat is NULL';
    6774    if (isset($page['category']))
    6875    {
     
    7077    }
    7178    $query.= ')';
    72   }
    73   if ($user['forbidden_categories'] != '')
    74   {
    75     $query.= '
    76     AND id NOT IN ('.$user['forbidden_categories'].')';
    7779  }
    7880  $query.= '
     
    8385  while ($row = mysql_fetch_array($result))
    8486  {
     87    $row['is_child_date_last'] = get_boolean($row['is_child_date_last']);
    8588    array_push($cats, $row);
    8689  }
     
    8992  return get_html_menu_category($cats);
    9093}
     94
    9195
    9296/**
     
    353357  return ($a['rank'] < $b['rank']) ? -1 : 1;
    354358}
     359
     360/**
     361 * returns display text for information images of category
     362 *
     363 * @param array categories
     364 * @return string
     365 */
     366function 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
    355394?>
Note: See TracChangeset for help on using the changeset viewer.