//default:
$this->loggedin=false;
$this->customerid=null;
-
+
//check cookie
if(isset($_COOKIE[COOKIE_WEBSESSION])){
$res = $db->select("websession", "*", "sessionid=".$db->escapeString($_COOKIE[COOKIE_WEBSESSION]));
if ($customer->exists()) {
$this->customerid = $customer->getID();
$this->loggedin = true;
- } else
+ } else {
$this->destroySession();
+ }
}
}
}
public function createSession($customerId)
{
global $db;
+ global $WebSessionTimeout;
$this->destroySession();
}
/** destroys the current session */
- private function destroySession()
+ public function destroySession()
{
global $db;
if($this->loggedin){
$db->deleteRows("websession", "sessionid=".$db->escapeString($this->sessionid));
}
+
setcookie(COOKIE_WEBSESSION, "", 1);
}
$error = ErrorManager::singleton();
+ // delete last web session
+ $session = new WebSession();
+ $session->destroySession();
+
$localParser = new Parser("orderlogin.html");
$localParser->setVar("fieldEMAIL", "ms_email");
$parser->setVAR("PAGE", $localParser->parseFile("customerregistration.html"));
}
+function createOrderOverview()
+{
+ global $parser;
+
+ $error = ErrorManager::singleton();
+ $lang = LanguageManager::singleton();
+
+ $p = new Parser("orderoverview.html");
+
+ // check if loggedin
+ $session = new WebSession();
+ if (!$session->isAuthorized()) {
+ Header("Location: index.php");
+ exit();
+ }
+
+ // set costumer data
+ $customer = $session->getCustomer();
+ $p->setVars($customer->getParserData());
+
+ // set cart overview
+ $cart = new Cart($_COOKIE[COOKIE_CART]);
+
+ $tablerows = "";
+ $totalsum = 0;
+ $hiddenfields = "";
+
+ // get tickets from cart
+ foreach ($cart->getTickets() as $ticket)
+ {
+ $cartRowTmpl = $p->getVar("ROW");
+ $event = $ticket->eventObject();
+
+ // set event details
+ $p->setVars($event->getParserData());
+
+ // set amount
+ $p->setVar("AMOUNT", $ticket->getAmount());
+
+ // set row sum
+ $rowsum = $ticket->getAmount()*$event->getDefaultPrice();
+ $p->setVar("ROWSUM", $lang->getPrice($rowsum));
+
+ $totalsum += $rowsum;
+
+ $tablerows .= $p->parse($cartRowTmpl);
+ }
+
+ // if no tickets in cart set EMPTYROWS and disable order button
+ if (count($cart->getTickets()) == 0) {
+ $tablerows = $p->getVar("EMPTYROWS");
+ $p->setVar("attribDISABLED", "disabled=\"disabled\"");
+ } else {
+ $p->setVar("attribDISABLED", "");
+ }
+
+ $p->setVar("TABLEROWS", $tablerows);
+ $p->setVar("TOTALSUM", $lang->getPrice($totalsum));
+
+ // set buttons
+
+ // create page
+ $parser->setVAR("PAGE", $p->parseFile("orderoverview.html"));
+}
+
?>
\ No newline at end of file
$customer = new Customer();
$customer->getByMail($_POST["ms_email"]);
if ($customer->authenticate($_POST["ms_password"])) {
- // create web session
+ // create web session for user
$session = new Websession();
$session->createSession($customer->getID());
+
// go to order overview
- Header("Location: index.php?mode=userdata");
+ Header("Location: index.php?mode=orderOverview");
exit();
} else {
$error->add(i18n("eMail or Password wrong"));
+ return;
}
// if radio button is not checked
$customer->setContact($_POST["ms_custContact"]);
}
+ // create web session for user
$session = new Websession();
$session->createSession($customer->getID());
// redirect to overview page
+ Header("Location: index.php?mode=orderOverview");
+ exit();
}
}
registerUser();
createCustomerRegistration();
break;
+ case "orderOverview":
+ createOrderOverview();
+ break;
default:
createEventList();
break;
--- /dev/null
+<h1>Bestellung - Übersicht</h1>
+<div id="ms_overview">
+<div id="address">
+<h2>Nutzerdaten:</h2>
+<fieldset class="ms_Form">
+<div class="ms_FormRow">
+<label for="ms_text_email">E-Mail-Adresse:</label>
+<span id="ms_text_email">@CUST_EMAIL@</span>
+</div>
+<div class="ms_FormRow">
+<label for="ms_text_name">Name:</label>
+<span id="ms_text_name">@CUST_NAME@</span>
+</div>
+<div class="ms_FormRow">
+<label for="ms_text_address">Adresse:</label>
+<span id="ms_text_address">@CUST_ADDRESS@</span>
+</div>
+<div class="ms_FormRow">
+<label for="ms_text_shippingAddress">Lieferadresse:</label>
+<span id="ms_textfield_shippingAddress"> </span>
+</div>
+<div class="ms_FormRow">
+<label for="ms_text_phone">Tel-Nr:</label>
+<span id="ms_text_phone">@CUST_CONTACT@</span>
+</div>
+<div class="ms_FormRow">
+<label for="ms_text_comment">Hinweis:</label>
+<span id="ms_text_comment"></span>
+</div>
+</fieldset>
+</div>
+<div id="tickets">
+<h2>Karten:</h2>
+<table class="ms_Table">
+<tr>
+<th>Veranstaltung</th>
+<th>Datum</th>
+<th>Uhrzeit</th>
+<th>Kartenpreis</th>
+<th>Anzahl</th>
+<th>Summe</th>
+</tr>
+@TABLEROWS@
+
+#set:ROW:
+<tr>
+<td><a href="@LINK@">@EVENTNAME@</a></td>
+<td>@DATE@</td>
+<td class="ms_AlignRight">@TIME@</td>
+<td class="ms_AlignRight">@PRICE@ €</td>
+<td class="ms_AlignRight">@AMOUNT@</td>
+<td class="ms_AlignRight">@ROWSUM@ €</td>
+</tr>
+#endset
+
+#set:EMPTYROWS:
+<tr><td colspan="6">Sie haben keine Veranstaltungen im Warenkorb.</td></tr>
+#endset
+
+<tr>
+<td colspan="5" class="ms_AlignRight"><b>Summe:</b></td>
+<td class="ms_AlignRight">@TOTALSUM@ €</td>
+</tr>
+</table>
+</div>
+
+<form action="@FULLURL@" method="POST">
+<div class="ms_ButtonArea">
+<input type="submit" id="ms_button_order" name="ms_order" @attribDISABLED@ value="Jetzt bestellen!" />
+</div>
+</form>
+</div>
\ No newline at end of file