fixes #777 WS categories getImages, TotalCount for correct pagination builder (fix #2)

This commit is contained in:
modus75 2017-11-12 10:30:56 +01:00
parent 164b59588c
commit 1e87cc8596

View file

@ -159,7 +159,8 @@ SELECT SQL_CALC_FOUND_ROWS i.*, GROUP_CONCAT(category_id) AS cat_ids
array(
'page' => $params['page'],
'per_page' => $params['per_page'],
'count' => $total_images
'count' => count($images),
'total_count' => $total_images
)
),
'images' => new PwgNamedArray(
@ -206,7 +207,7 @@ function ws_categories_getList($params, &$service)
$where[] = 'id_uppercat IS NULL';
}
}
else if ($params['cat_id']>0)
elseif ($params['cat_id']>0)
{
$where[] = 'uppercats '. DB_REGEX_OPERATOR .' \'(^|,)'.
(int)($params['cat_id']) .'(,|$)\'';
@ -219,7 +220,7 @@ function ws_categories_getList($params, &$service)
$join_user = $conf['guest_id'];
}
else if (is_admin())
elseif (is_admin())
{
// in this very specific case, we don't want to hide empty
// categories. Function calculate_permissions will only return
@ -302,11 +303,11 @@ SELECT
{
$image_id = $row['user_representative_picture_id'];
}
else if (!empty($row['representative_picture_id']))
elseif (!empty($row['representative_picture_id']))
{ // if a representative picture is set, it has priority
$image_id = $row['representative_picture_id'];
}
else if ($conf['allow_random_representative'])
elseif ($conf['allow_random_representative'])
{
// searching a random representant among elements in sub-categories
$image_id = get_random_image_in_category($row);