3
* $RCSfile: ItemAddConfirmation.inc,v $
5
* Gallery - a web based photo album viewer and editor
6
* Copyright (C) 2000-2005 Bharat Mediratta
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or (at
11
* your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
24
* @version $Revision: 1.8 $ $Date: 2005/08/23 03:49:02 $
25
* @package GalleryCore
26
* @subpackage UserInterface
27
* @author Bharat Mediratta <bharat@menalto.com>
31
* This view will show the confirmation that an user has been edited successfully
33
* @package GalleryCore
34
* @subpackage UserInterface
37
class ItemAddConfirmationView extends GalleryView {
40
* @see GalleryView::loadTemplate
42
function loadTemplate(&$template, &$form) {
45
$itemId = GalleryUtilities::getRequestVariables('itemId');
46
list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
47
if ($ret->isError()) {
48
return array($ret->wrap(__FILE__, __LINE__), null);
52
* We know what kind of operation happened, but for now let's compress
53
* it down so that the template doesn't have to know.
55
$status = $template->getVariable('status');
56
if (!empty($status['addedFiles'])) {
57
$count = sizeof($status['addedFiles']);
58
for ($i = 0; $i < $count; $i++) {
59
list ($ret, $entity) =
60
GalleryCoreApi::loadEntitiesById($status['addedFiles'][$i]['id']);
61
if ($ret->isSuccess()) {
62
$status['addedFiles'][$i]['exists'] = true;
63
} else if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) {
64
$status['addedFiles'][$i]['exists'] = false;
66
return array($ret->wrap(__FILE__, __LINE__), null);
71
$status['addedFiles'] = array();
74
$ItemAddConfirmation = array();
75
$ItemAddConfirmation['count'] = $count;
76
$ItemAddConfirmation['status'] = $status;
78
$template->setVariable('ItemAddConfirmation', $ItemAddConfirmation);
79
$template->setVariable('controller', '');
80
return array(GalleryStatus::success(),
81
array('body' => 'modules/core/templates/ItemAddConfirmation.tpl'));
85
* @see GalleryView::getViewDescription()
87
function getViewDescription() {
88
list ($ret, $core) = GalleryCoreApi::loadPlugin('module', 'core');
89
if ($ret->isError()) {
90
return array($ret->wrap(__FILE__, __LINE__), null);
93
return array(GalleryStatus::success(), $core->translate('add items confirmation'));