<?php
/*
 * $RCSfile: Done.inc,v $
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2004 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

/**
 * @version
 * @package CheckoutEmail
 * @author Matthew Turnbull <matthew.turnbull@messagescan.net>
 */

/**
 * This view is for letting the user know the transaction was completed, and
 * emptying the shopping cart
 *
 * @package CheckoutEmail
 * @subpackage UserInterface
 */
class DoneView extends GalleryView {

    /**
     * @see GalleryView::loadTemplate
     */
    function loadTemplate(&$template, &$form) {
        global $gallery;

        /* First, empty out the shopping cart */
        $event = GalleryCoreApi::newEvent('GalleryCheckout::emptyCart');
        list ($ret) = GalleryCoreApi::postEvent($event);
        if ($ret) {
            return $ret->wrap(__FILE__, __LINE__);
        }

        list ($ret, $module) = GalleryCoreApi::loadPlugin('module','checkoutemail');
        if ($ret) {
            return array($ret->wrap(__FILE__, __LINE__), null);
        }

        $template->title($gallery->i18n('Checkout') . '::' . 
                         $gallery->i18n('Order Complete'));

        return array(null,
                array('body' => 'modules/checkoutemail/templates/Done.tpl'));
    }
}
?>
