/**
* This view will prompt for confirmation on the deletion of an item
*/
class ItemDeleteSingleView extends GalleryView {
/**
* @see GalleryView::loadTemplate
*/
function loadTemplate(&$template, &$form) {
$itemId = GalleryUtilities::getRequestVariables('itemId');
if ($form['formName'] != 'ItemDeleteSingle') {
$form['destination'] = '';
$form['formName'] = 'ItemDeleteSingle';
}
list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
if ($ret) {
return array($ret, null);
}
/* Get child counts */
list ($ret, $childCountTable) = GalleryCoreApi::fetchDescendentCounts(array($itemId));
if ($ret) {
return array($ret, null);
}
$childCount = isset($childCountTable[$itemId]) ? $childCountTable[$itemId] : 0;
$ItemDeleteSingle = array();
$ItemDeleteSingle['itemTypeNames'] = $item->itemTypeName();
$ItemDeleteSingle['childCount'] = $childCount;
$template->setVariable('ItemDeleteSingle', $ItemDeleteSingle);
$template->setVariable('controller', 'core.ItemDeleteSingle');
return array(null, array('body' => 'modules/core/templates/ItemDeleteSingle.tpl'));
}
/**
* @see GalleryView::getViewDescription
*/
function getViewDescription() {
list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
if ($ret) {
return array($ret, null);
}
list ($ret, $item) = $this->getItem();
if ($ret) {
return array($ret, null);
}
$itemTypeNames = $item->itemTypeName(true);
return array(null, $core->translate(array('text' => 'delete %s',
'arg1' => $itemTypeNames[1])));
}
}