3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
36 require_once 'CRM/Core/Page.php';
39 * Page to decide the flow of adding an item.
41 class CRM_Auction_Page_AddItem
extends CRM_Core_Page
{
46 * This method is called after the page is created. It checks for the
47 * type of action and executes that action.
48 * Finally it calls the parent's run method.
55 // get the requested action
56 $action = CRM_Utils_Request
::retrieve('action', 'String', $this, FALSE, 'add');
58 // set breadcrumb to append to 2nd layer pages
59 $breadCrumb = array(array('title' => ts('Manage Items'),
60 'url' => CRM_Utils_System
::url(CRM_Utils_System
::currentPath(),
64 // what action to take ?
65 if ($action & CRM_Core_Action
::ADD
) {
66 $session = CRM_Core_Session
::singleton();
67 if ($session->get('userID')) {
68 // For logged in user directly go to add/update item page.
69 $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item',
73 $controller->set('donorID', $session->get('userID'));
76 // For anonymous user go via account creation wizard.
77 require_once 'CRM/Auction/Controller/Item.php';
78 $controller = new CRM_Auction_Controller_Item('New Item', $action);
80 return $controller->run();
82 elseif ($action & CRM_Core_Action
::UPDATE
) {
83 $session = CRM_Core_Session
::singleton();
84 if ($session->get('userID')) {
85 $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item',
89 $controller->set('donorID', $session->get('userID'));
90 return $controller->run();