Ignore:
Timestamp:
Mar 5, 2006, 12:31:46 AM (18 years ago)
Author:
plg
Message:

new feature: source/destination links between categories. Will we keep this
feature? Code is complicated and very few people will understand how it
works...

modification: #images.storage_category_id replaced by
#image_category.is_storage

improvement: many code refactoring to improve readibility

improvement: virtual category creation code was moved to a dedicated
function in order to be called from admin/cat_list.php and
admin/cat_modify.php (create a new destination category)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/rating.php

    r1059 r1064  
    169169}
    170170
    171 $query = 'SELECT i.id, i.path, i.file, i.tn_ext, i.average_rate, i.storage_category_id,
    172           MAX(r.date) as recently_rated, COUNT(r.rate) as nb_rates,
    173           SUM(r.rate) as sum_rates, ROUND(STD(r.rate),2) as std_rates
    174 FROM '.RATE_TABLE.' AS r LEFT JOIN '.IMAGES_TABLE.' AS i
    175 ON r.element_id=i.id
    176 WHERE 1=1 ' . $display_filter . '
    177 GROUP BY r.element_id
    178 ORDER BY ' . $available_order_by[$order_by_index][1] .'
    179 LIMIT '.$start.','.$elements_per_page .
    180 ';';
     171$query = '
     172SELECT i.id,
     173       i.path,
     174       i.file,
     175       i.tn_ext,
     176       i.average_rate,
     177       MAX(r.date)          AS recently_rated,
     178       COUNT(r.rate)        AS nb_rates,
     179       SUM(r.rate)          AS sum_rates,
     180       ROUND(STD(r.rate),2) AS std_rates,
     181       ic.category_id       AS storage_category_id
     182  FROM '.RATE_TABLE.' AS r
     183    LEFT JOIN '.IMAGES_TABLE.' AS i ON r.element_id = i.id
     184    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.image_id = i.id
     185  WHERE 1 = 1 ' . $display_filter . '
     186    AND ic.is_storage = \'true\'
     187  GROUP BY r.element_id
     188  ORDER BY ' . $available_order_by[$order_by_index][1] .'
     189  LIMIT '.$start.','.$elements_per_page.'
     190;';
    181191
    182192$images = array();
     
    189199foreach ($images as $image)
    190200{
    191   $thumbnail_src = get_thumbnail_src(
    192     $image['path'], $image['tn_ext']
    193     );
    194 
    195   $image_url = PHPWG_ROOT_PATH.'picture.php?'.
    196                 'cat=' . $image['storage_category_id'].
    197                 '&image_id=' . $image['id'];
     201  $thumbnail_src = get_thumbnail_src($image['path'], $image['tn_ext']);
     202
     203  $image_url =
     204    PHPWG_ROOT_PATH.'picture.php?'.
     205    'cat=' . $image['storage_category_id'].
     206    '&image_id=' . $image['id']
     207    ;
    198208
    199209  $query = 'SELECT *
Note: See TracChangeset for help on using the changeset viewer.