| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <13-Feb-2003 10:10:35 bf> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 $http =& eZHTTPTool::instance(); 28 $module =& $Params["Module"]; 29 30 include_once ( "kernel/common/template.php" ); 31 include_once ( 'lib/ezutils/classes/ezhttptool.php' ); 32 include_once ( "kernel/classes/ezbasket.php" ); 33 include_once ( "lib/ezxml/classes/ezxml.php" ); 34 include_once ( "lib/ezutils/classes/ezmail.php" ); 35 36 $tpl =& templateInit(); 37 38 if ( $module->isCurrentAction( 'Cancel' ) ) 39 { 40 $module->redirectTo( '/shop/basket/' ); 41 return; 42 } 43 44 $tpl->setVariable( "input_error", false ); 45 if ( $module->isCurrentAction( 'Store' ) ) 46 { 47 $inputIsValid = true; 48 $firstName = $http->postVariable( "FirstName" ); 49 if ( trim( $firstName ) == "" ) 50 $inputIsValid = false; 51 $lastName = $http->postVariable( "LastName" ); 52 if ( trim( $lastName ) == "" ) 53 $inputIsValid = false; 54 $email = $http->postVariable( "EMail" ); 55 if ( ! eZMail::validate( $email ) ) 56 $inputIsValid = false; 57 $address = $http->postVariable( "Address" ); 58 if ( trim( $address ) == "" ) 59 $inputIsValid = false; 60 $tpl->setVariable( "first_name", $firstName ); 61 $tpl->setVariable( "last_name", $lastName ); 62 $tpl->setVariable( "email", $email ); 63 $tpl->setVariable( "address", $address ); 64 65 if ( $inputIsValid == true ) 66 { 67 // Check for validation 68 $basket =& eZBasket::currentBasket(); 69 $order = $basket->createOrder(); 70 71 $doc = new eZDOMDocument( 'account_information' ); 72 73 $root = $doc->createElementNode( "shop_account" ); 74 $doc->setRoot( $root ); 75 76 $firstNameNode = $doc->createElementNode( "first-name" ); 77 $firstNameNode->appendChild( $doc->createTextNode( $firstName ) ); 78 $root->appendChild( $firstNameNode ); 79 80 $lastNameNode = $doc->createElementNode( "last-name" ); 81 $lastNameNode->appendChild( $doc->createTextNode( $lastName ) ); 82 $root->appendChild( $lastNameNode ); 83 84 $emailNode = $doc->createElementNode( "email" ); 85 $emailNode->appendChild( $doc->createTextNode( $email ) ); 86 $root->appendChild( $emailNode ); 87 88 $addressNode = $doc->createElementNode( "address" ); 89 $addressNode->appendChild( $doc->createTextNode( $address ) ); 90 $root->appendChild( $addressNode ); 91 92 $order->setAttribute( 'data_text_1', $doc->toString() ); 93 $order->setAttribute( 'account_identifier', "simple" ); 94 $order->store(); 95 96 eZHTTPTool::setSessionVariable( 'MyTemporaryOrderID', $order->attribute( 'id' ) ); 97 98 $module->redirectTo( '/shop/confirmorder/' ); 99 return; 100 } 101 else 102 { 103 $tpl->setVariable( "input_error", true ); 104 } 105 } 106 107 $Result = array(); 108 $Result['content'] =& $tpl->fetch( "design:shop/register.tpl" ); 109 $Result['path'] = array( array( 'url' => false, 110 'text' => ezi18n( 'kernel/shop', 'Enter account information' ) ) ); 111 112 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |