|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZSimpleShopAccountHandler class 00004 // 00005 // Created on: <13-Feb-2003 09:54:35 bf> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 class eZSimpleShopAccountHandler 00032 { 00033 /*! 00034 */ 00035 function eZSimpleShopAccountHandler() 00036 { 00037 00038 } 00039 00040 /*! 00041 Will verify that the user has supplied the correct user information. 00042 Returns true if we have all the information needed about the user. 00043 */ 00044 function verifyAccountInformation() 00045 { 00046 return false; 00047 } 00048 00049 /*! 00050 Redirectes to the user registration page. 00051 */ 00052 function fetchAccountInformation( &$module ) 00053 { 00054 $module->redirectTo( '/shop/register/' ); 00055 } 00056 00057 /*! 00058 \return custom email for the given order 00059 */ 00060 function email( $order ) 00061 { 00062 $email = false; 00063 $xmlString = $order->attribute( 'data_text_1' ); 00064 if ( $xmlString != null ) 00065 { 00066 $dom = new DOMDocument( '1.0', 'utf-8' ); 00067 $success = $dom->loadXML( $xmlString ); 00068 $emailNode = $dom->getElementsByTagName( 'email' )->item( 0 ); 00069 if ( $emailNode ) 00070 { 00071 $email = $emailNode->textContent; 00072 } 00073 } 00074 00075 return $email; 00076 } 00077 00078 /*! 00079 \return custom name for the given order 00080 */ 00081 function accountName( $order ) 00082 { 00083 $accountName = ''; 00084 $xmlString = $order->attribute( 'data_text_1' ); 00085 if ( $xmlString != null ) 00086 { 00087 $dom = new DOMDocument( '1.0', 'utf-8' ); 00088 $success = $dom->loadXML( $xmlString ); 00089 $firstNameNode = $dom->getElementsByTagName( 'first-name' )->item( 0 ); 00090 $lastNameNode = $dom->getElementsByTagName( 'last-name' )->item( 0 ); 00091 $accountName = $firstNameNode->textContent . ' ' . $lastNameNode->textContent; 00092 } 00093 00094 return $accountName; 00095 } 00096 00097 /*! 00098 \return the account information for the given order 00099 */ 00100 function accountInformation( $order ) 00101 { 00102 $firstName = ''; 00103 $lastName = ''; 00104 $email = ''; 00105 $address = ''; 00106 00107 $dom = new DOMDocument( '1.0', 'utf-8' ); 00108 $xmlString = $order->attribute( 'data_text_1' ); 00109 if ( $xmlString != null ) 00110 { 00111 $dom = new DOMDocument( '1.0', 'utf-8' ); 00112 $success = $dom->loadXML( $xmlString ); 00113 00114 $firstNameNode = $dom->getElementsByTagName( 'first-name' )->item( 0 ); 00115 if ( $firstNameNode ) 00116 { 00117 $firstName = $firstNameNode->textContent; 00118 } 00119 00120 $lastNameNode = $dom->getElementsByTagName( 'last-name' )->item( 0 ); 00121 if ( $lastNameNode ) 00122 { 00123 $lastName = $lastNameNode->textContent; 00124 } 00125 00126 $emailNode = $dom->getElementsByTagName( 'email' )->item( 0 ); 00127 if ( $emailNode ) 00128 { 00129 $email = $emailNode->textContent; 00130 } 00131 00132 $addressNode = $dom->getElementsByTagName( 'address' )->item( 0 ); 00133 if ( $addressNode ) 00134 { 00135 $address = $addressNode->textContent; 00136 } 00137 } 00138 00139 return array( 'first_name' => $firstName, 00140 'last_name' => $lastName, 00141 'email' => $email, 00142 'address' => $address 00143 ); 00144 } 00145 } 00146 00147 ?>