{
global $db;
if($this->cartid===false)return array();
- $res=$db->select("cart_ticket","*","where cartid=".$db->escapeString($this->cartid));
+ $res=$db->select("cart_ticket","*","cartid=".$db->escapeString($this->cartid));
$ret=array();
if(count($res)>0)
- foreach($res as $k=>$tc)
+ foreach($res as $k => $tc)
$ret[]=new CartTicket($tc["ctid"],$tc["cartid"],$tc["eventid"],$tc["amount"]);
return $ret;
}
private $configFile;
private $config;
- public function __construct($file = "lang.conf")
+ public function __construct($file)
{
global $template;
$p->setVar("MESSAGE", $message);
$messages .= $p->parse($errorTmpl);
}
- return $messages;
+
+ $errorArea = $p->getVar("ERRORAREA");
+ $p->setVar("ERRORMESSAGES", $messages);
+
+ return $p->parse($errorArea);
}
/** returns true if errors exist */
// set error message
if ($error->exists()) {
$p->setVar("ERROR", "true");
- $p->setVar("ERRORMESSAGE", $error->getAllFormatted());
+ $p->setVar("ERRORAREA", $error->getAllFormatted());
}
// create page
function addEventToCart()
{
global $error;
+ global $lang;
$COOKIE_NAME = "ms_cartid";
if (isset($_POST["ms_save"])) {
$event = new Event($_GET["event"]);
if (empty($_POST["ms_amount"])) {
- $error->add("Bitte geben Sie eine Kartenmenge an!");
+ $error->add($lang->getErrMsg("100"));
return;
} elseif (!is_numeric($_POST["ms_amount"])) {
- $error->add("Bitte geben Sie eine Zahl ein!");
+ $error->add($lang->getErrMsg("000"));
return;
} elseif (!$event->exists()) {
- $error->add("Veranstaltung nicht vorhanden!");
+ $error->add($lang->getErrMsg("200"));
return;
} else {
$cart = new Cart($_COOKIE[$COOKIE_NAME]);
$cart->addTickets($event->getEventId(), $_POST["ms_amount"]);
- Header("Location: index.php");
+ Header("Location: index.php?mode=cart");
}
}
}
//include display scripts
include('inc/event_listing.php');
+include('inc/cart_listing.php');
//set common basics
$mode="index";
addEventToCart();
createEventDetails();
break;
+ case "cart":
+ createCartOverview();
+ break;
default:
createEventList();
break;
--- /dev/null
+<h1>Warenkorb</h1>
+
+<div id="ms_form">
+<form action="." method="POST">
+<table class="ms_Table">
+<tr>
+<th> </th>
+<th>Veranstaltung</th>
+<th>Datum</th>
+<th>Uhrzeit</th>
+<th>Kartenpreis</th>
+<th>Anzahl</th>
+<th>Summe</th>
+</tr>
+@TABLEROWS@
+<tr>
+<td colspan="6" class="ms_AlignRight"><b>Summe:</b></td>
+<td class="ms_AlignRight">@TOTALSUM@ €</td>
+</tr>
+</table>
+
+#set:ROW:
+<tr>
+<td><a href=".">Löschen</a></td>
+<td><a href=".">@EVENTNAME@</a></td>
+<td>@DATE@</td>
+<td class="ms_AlignRight">@TIME@</td>
+<td class="ms_AlignRight">@PRICE@ €</td>
+<td class="ms_AlignRight"><input type="text" id="ms_textfield_amount" name="@fieldAMOUNT@" size="2" maxlength="2" value="@AMOUNT@"></td>
+<td class="ms_AlignRight">@ROWSUM@ €</td>
+</tr>
+#endset
+
+<div class="ms_ButtonArea">
+<input type="submit" id="ms_button_save" name="@buttonSAVE@" value="Aktualisieren" />
+<input type="submit" id="ms_button_order" name="@buttonORDER@" value="Zur Bestellung" />
+</div>
+</form>
+
+#if:ERROR==true
+@ERRORAREA@
+#endif
+
+</div>
\ No newline at end of file
#set:ERROR:
-<div>
+<li>
@MESSAGE@
+</li>
+#endset
+
+#set:ERRORAREA:
+<div class="ms_ErrorArea">
+Folgende Fehler sind aufgetreten:
+<ul>
+@ERRORMESSAGES@
+<ul>
</div>
#endset
\ No newline at end of file
</div>
<div class="ms_FormRow">
<label for="ms_text_time">Uhrzeit:</label>
-<div id="ms_text_time">@TIME@ Uhr</div>
+<div id="ms_text_time">@TIME@</div>
</div>
<div class="ms_FormRow">
<label for="ms_text_information">Information:</label>
</form>
#if:ERROR==true
-<div class="ms_ErrorArea">
-@ERRORMESSAGE@
-</div>
+@ERRORAREA@
#endif
</div>
\ No newline at end of file
ThousandSeparator = ,
# Error messages
-ERR001 = Test
\ No newline at end of file
+ERR000 = Bitte geben Sie eine Zahl ein!
+
+ERR100 = Bitte geben Sie eine Kartenmenge an!
+
+ERR200 = Veranstaltung nicht vorhanden!
\ No newline at end of file