Changeset 761


Ignore:
Timestamp:
Mar 31, 2005, 11:53:24 PM (19 years ago)
Author:
plg
Message:
  • apply category name and element name separation in calendar special category
  • change method of counting total number of viewable pictures : pictures linked to more than one category are not counted twice.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/ChangeLog

    r760 r761  
     12005-03-31 Pierrick LE GALL <pierrick at phpwebgallery dot net>
     2
     3        * apply category name and element name separation in calendar
     4        special category
     5
     6        * change method of counting total number of viewable pictures :
     7        pictures linked to more than one category are not counted twice.
     8       
    192005-03-26 Pierrick LE GALL <pierrick at phpwebgallery dot net>
    210
  • trunk/include/category_calendar.inc.php

    r744 r761  
    246246        'IMAGE_ALT'=>$row['file'],
    247247        'IMAGE_TITLE'=>$thumbnail_title,
    248         'IMAGE_NAME'=>$name,
    249248         
    250249        'U_IMG_LINK'=>add_session_id($url_link)
    251250       )
    252251     );
     252
     253    $template->assign_block_vars(
     254      'thumbnails.line.thumbnail.category_name',
     255      array(
     256        'NAME' => $name
     257        )
     258      );
    253259
    254260    // create a new line ?
     
    300306        'IMAGE_ALT'=>$row['file'],
    301307        'IMAGE_TITLE'=>$thumbnail_title,
    302         'IMAGE_NAME'=>$name,
    303308         
    304309        'U_IMG_LINK'=>add_session_id($url_link)
    305310       )
    306311     );
     312
     313    $template->assign_block_vars(
     314      'thumbnails.line.thumbnail.category_name',
     315      array(
     316        'NAME' => $name
     317        )
     318      );
    307319
    308320    // create a new line ?
     
    348360        'IMAGE_ALT'=>$row['file'],
    349361        'IMAGE_TITLE'=>$thumbnail_title,
    350         'IMAGE_NAME'=>$name,
    351362         
    352363        'U_IMG_LINK'=>add_session_id($url_link)
     
    354365       );
    355366
     367    $template->assign_block_vars(
     368      'thumbnails.line.thumbnail.category_name',
     369      array(
     370        'NAME' => $name
     371        )
     372      );
     373
    356374    // create a new line ?
    357375    if (++$row_number == $user['nb_image_line'])
     
    416434        'IMAGE_ALT'=>$row['file'],
    417435        'IMAGE_TITLE'=>$thumbnail_title,
    418         'IMAGE_NAME'=>$name,
    419436         
    420437        'U_IMG_LINK'=>add_session_id($url_link)
    421438         )
    422439       );
    423     $template->assign_block_vars('thumbnails.line.thumbnail.bullet',array());
     440
     441    $template->assign_block_vars(
     442      'thumbnails.line.thumbnail.category_name',
     443      array(
     444        'NAME' => $name
     445        )
     446      );
    424447   
    425448    // create a new line ?
  • trunk/include/functions_category.inc.php

    r715 r761  
    156156}
    157157
     158/**
     159 * returns the total number of elements viewable in the gallery by the
     160 * connected user
     161 *
     162 * @return int
     163 */
    158164function count_user_total_images()
    159165{
    160166  global $user;
    161167
    162   $query = 'SELECT SUM(nb_images) AS total';
    163   $query.= ' FROM '.CATEGORIES_TABLE;
    164   if ( count( $user['restrictions'] ) > 0 )
    165     $query.= ' WHERE id NOT IN ('.$user['forbidden_categories'].')';
    166   $query.= ';';
     168  $query = '
     169SELECT COUNT(DISTINCT(image_id)) as total
     170  FROM '.IMAGE_CATEGORY_TABLE;
     171  if (count($user['restrictions']) > 0)
     172  {
     173    $query.= '
     174  WHERE category_id NOT IN ('.$user['forbidden_categories'].')';
     175  }
     176  $query.= '
     177;';
    167178 
    168   $row = mysql_fetch_array( pwg_query( $query ) );
    169 
    170   if ( !isset( $row['total'] ) ) $row['total'] = 0;
    171   return $row['total'];
     179  $row = mysql_fetch_array(pwg_query($query));
     180
     181  return isset($row['total']) ? $row['total'] : 0;
    172182}
    173183
Note: See TracChangeset for help on using the changeset viewer.