assign(array(
'F_ACTION' => $self_url,
'PWG_TOKEN' => get_pwg_token(),
));
// retrieve all existing categories for album creation
$query = '
SELECT id,name,uppercats,global_rank
FROM '.CATEGORIES_TABLE.'
;';
display_select_cat_wrapper(
$query, null,
'category_options'
);
if ($conf['SmartAlbums']['show_list_messages'])
{
$page['warnings'][] = l10n('Only SmartAlbums are displayed on this page');
$page['warnings'][] = sprintf(l10n('To order albums please go the main albums management page'), $base_url.'cat_list');
$page['warnings'][] = '['.l10n('Don\'t show this message again').']';
}
// +-----------------------------------------------------------------------+
// | Categories display |
// +-----------------------------------------------------------------------+
$categories_count_images = array();
if (count($categories))
{
$query = '
SELECT
category_id,
COUNT(image_id) AS total_images
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id IN ('.implode(',', array_keys($categories)).')
GROUP BY category_id
;';
$categories_count_images = simple_hash_from_query($query, 'category_id', 'total_images');
}
$template->assign('categories', array());
foreach ($categories as $category)
{
$tpl_cat =
array(
'NAME' => get_cat_display_name_from_id($category['id'], $base_url.'album-'),
'ID' => $category['id'],
'IMG_COUNT' => !empty($categories_count_images[ $category['id'] ]) ? $categories_count_images[ $category['id'] ] : 0,
'LAST_UPDATE' => format_date($category['updated'], true),
'U_JUMPTO' => make_index_url(array('category' => $category)),
'U_EDIT' => SMART_ADMIN.'-album&cat_id='.$category['id'],
'U_DELETE' => $self_url.'&delete='.$category['id'].'&pwg_token='.get_pwg_token(),
'U_SMART' => $self_url.'&smart_generate='.$category['id'],
);
$template->append('categories', $tpl_cat);
}
$template->set_filename('SmartAlbums_content', realpath(SMART_PATH . 'admin/template/cat_list.tpl'));