diff options
author | z0rglub <z0rglub@piwigo.org> | 2004-08-30 22:00:46 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2004-08-30 22:00:46 +0000 |
commit | 0e2436f50a61f90da22e75085280bf9f2087699a (patch) | |
tree | bac0bec23ab9487453e212e66b5ba527b15c2e60 /include/functions_category.inc.php | |
parent | 0c482df04e1631e12db1fe99e904d6111b17adf1 (diff) |
add rating feature
git-svn-id: http://piwigo.org/svn/trunk@507 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_category.inc.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index e82df1242..9a65ef997 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -724,6 +724,44 @@ SELECT COUNT(DISTINCT(id)) AS nb_total_images $page['where'].= ' AND '.$forbidden; } } + else if ($page['cat'] == 'best_rated') + { + $page['title'] = $conf['top_number'].' '.$lang['best_rated_cat']; + + $page['where'] = ' WHERE average_rate IS NOT NULL'; + + if (isset($forbidden)) + { + $page['where'] = ' AND '.$forbidden; + } + + $conf['order_by'] = ' ORDER BY average_rate DESC, id ASC'; + + // $page['cat_nb_images'] equals $conf['top_number'] unless there + // are less rated items + $query =' +SELECT COUNT(1) AS count + FROM '.IMAGES_TABLE.' + '.$page['where'].' +;'; + $row = mysql_fetch_array(mysql_query($query)); + if ($row['count'] < $conf['top_number']) + { + $page['cat_nb_images'] = $row['count']; + } + else + { + $page['cat_nb_images'] = $conf['top_number']; + } + unset($query); + + + if (isset($page['start']) + and ($page['start']+$user['nb_image_page']>=$conf['top_number'])) + { + $page['nb_image_page'] = $conf['top_number'] - $page['start']; + } + } if (isset($query)) { |