aboutsummaryrefslogtreecommitdiffstats
path: root/admin/rating.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-03-04 23:31:46 +0000
committerplegall <plg@piwigo.org>2006-03-04 23:31:46 +0000
commitc08fa6f67ef5b149fdeb3bcc57045e629df8fff4 (patch)
tree8a0eeb15f6a4989b6691584c9cf5123361be4f1c /admin/rating.php
parentc4874071babe878fcdcda10da1cc34ba5ded6aae (diff)
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) git-svn-id: http://piwigo.org/svn/trunk@1064 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/rating.php')
-rw-r--r--admin/rating.php42
1 files changed, 26 insertions, 16 deletions
diff --git a/admin/rating.php b/admin/rating.php
index 6be2dd8ca..38f58f3ff 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -168,16 +168,26 @@ for ($i=0; $i<count($available_order_by); $i++)
);
}
-$query = 'SELECT i.id, i.path, i.file, i.tn_ext, i.average_rate, i.storage_category_id,
- MAX(r.date) as recently_rated, COUNT(r.rate) as nb_rates,
- SUM(r.rate) as sum_rates, ROUND(STD(r.rate),2) as std_rates
-FROM '.RATE_TABLE.' AS r LEFT JOIN '.IMAGES_TABLE.' AS i
-ON r.element_id=i.id
-WHERE 1=1 ' . $display_filter . '
-GROUP BY r.element_id
-ORDER BY ' . $available_order_by[$order_by_index][1] .'
-LIMIT '.$start.','.$elements_per_page .
-';';
+$query = '
+SELECT i.id,
+ i.path,
+ i.file,
+ i.tn_ext,
+ i.average_rate,
+ MAX(r.date) AS recently_rated,
+ COUNT(r.rate) AS nb_rates,
+ SUM(r.rate) AS sum_rates,
+ ROUND(STD(r.rate),2) AS std_rates,
+ ic.category_id AS storage_category_id
+ FROM '.RATE_TABLE.' AS r
+ LEFT JOIN '.IMAGES_TABLE.' AS i ON r.element_id = i.id
+ INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.image_id = i.id
+ WHERE 1 = 1 ' . $display_filter . '
+ AND ic.is_storage = \'true\'
+ GROUP BY r.element_id
+ ORDER BY ' . $available_order_by[$order_by_index][1] .'
+ LIMIT '.$start.','.$elements_per_page.'
+;';
$images = array();
$result = pwg_query($query);
@@ -188,13 +198,13 @@ while ($row = mysql_fetch_array($result))
foreach ($images as $image)
{
- $thumbnail_src = get_thumbnail_src(
- $image['path'], $image['tn_ext']
- );
+ $thumbnail_src = get_thumbnail_src($image['path'], $image['tn_ext']);
- $image_url = PHPWG_ROOT_PATH.'picture.php?'.
- 'cat=' . $image['storage_category_id'].
- '&amp;image_id=' . $image['id'];
+ $image_url =
+ PHPWG_ROOT_PATH.'picture.php?'.
+ 'cat=' . $image['storage_category_id'].
+ '&amp;image_id=' . $image['id']
+ ;
$query = 'SELECT *
FROM '.RATE_TABLE.' AS r