mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-05-14 05:47:29 +03:00
related to #1614 replacing selectize in photo editor for related categories
This commit is contained in:
parent
34fe0fc36f
commit
66bd06176c
9 changed files with 454 additions and 17 deletions
|
@ -474,6 +474,11 @@ SELECT id, path, representative_ext
|
|||
*/
|
||||
function ws_categories_getAdminList($params, &$service)
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
$params['additional_output'] = array_map('trim', explode(',', $params['additional_output']));
|
||||
|
||||
$query = '
|
||||
SELECT category_id, COUNT(*) AS counter
|
||||
FROM '. IMAGE_CATEGORY_TABLE .'
|
||||
|
@ -481,18 +486,36 @@ SELECT category_id, COUNT(*) AS counter
|
|||
;';
|
||||
$nb_images_of = query2array($query, 'category_id', 'counter');
|
||||
|
||||
// pwg_db_real_escape_string
|
||||
|
||||
$query = '
|
||||
SELECT id, name, comment, uppercats, global_rank, dir, status
|
||||
FROM '. CATEGORIES_TABLE .'
|
||||
SELECT SQL_CALC_FOUND_ROWS id, name, comment, uppercats, global_rank, dir, status
|
||||
FROM '. CATEGORIES_TABLE;
|
||||
|
||||
if (isset($params["search"]) and $params['search'] != "")
|
||||
{
|
||||
$query .= '
|
||||
WHERE name LIKE \'%'.pwg_db_real_escape_string($params["search"]).'%\'
|
||||
LIMIT '.$conf["linked_album_search_limit"];
|
||||
}
|
||||
|
||||
$query .= '
|
||||
;';
|
||||
$result = pwg_query($query);
|
||||
|
||||
list($counter) = pwg_db_fetch_row(pwg_query('SELECT FOUND_ROWS()'));
|
||||
|
||||
$cats = array();
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$id = $row['id'];
|
||||
$row['nb_images'] = isset($nb_images_of[$id]) ? $nb_images_of[$id] : 0;
|
||||
|
||||
$cat_display_name = get_cat_display_name_cache(
|
||||
$row['uppercats'],
|
||||
get_root_url().'admin.php?page=album-'
|
||||
);
|
||||
|
||||
$row['name'] = strip_tags(
|
||||
trigger_change(
|
||||
'render_category_name',
|
||||
|
@ -500,12 +523,7 @@ SELECT id, name, comment, uppercats, global_rank, dir, status
|
|||
'ws_categories_getAdminList'
|
||||
)
|
||||
);
|
||||
$row['fullname'] = strip_tags(
|
||||
get_cat_display_name_cache(
|
||||
$row['uppercats'],
|
||||
null
|
||||
)
|
||||
);
|
||||
$row['fullname'] = strip_tags($cat_display_name);
|
||||
$row['comment'] = strip_tags(
|
||||
trigger_change(
|
||||
'render_category_description',
|
||||
|
@ -514,16 +532,28 @@ SELECT id, name, comment, uppercats, global_rank, dir, status
|
|||
)
|
||||
);
|
||||
|
||||
if (in_array('full_name_with_admin_links', $params['additional_output']))
|
||||
{
|
||||
$row["full_name_with_admin_links"] = $cat_display_name;
|
||||
}
|
||||
|
||||
$cats[] = $row;
|
||||
}
|
||||
|
||||
$limit_reached = false;
|
||||
if ($counter > $conf["linked_album_search_limit"]) {
|
||||
$limit_reached = true;
|
||||
}
|
||||
|
||||
usort($cats, 'global_rank_compare');
|
||||
return array(
|
||||
'categories' => new PwgNamedArray(
|
||||
$cats,
|
||||
'category',
|
||||
array('id', 'nb_images', 'name', 'uppercats', 'global_rank', 'status')
|
||||
)
|
||||
array('id', 'nb_images', 'name', 'uppercats', 'global_rank', 'status', 'test')
|
||||
),
|
||||
'limit' => $conf["linked_album_search_limit"],
|
||||
'limit_reached' => $limit_reached,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue