From cfe914bb5f843e3e2a989013479f9deb949a7b30 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Fri, 4 Feb 2011 16:45:31 +0000 Subject: [PATCH] Begun work on adding a ticket to a order. --- .htaccess | 2 +- index.php | 23 +++++++++++++++++++---- pages/index.php | 6 ++---- templates/index.php | 16 ++++++++++++---- theme.php | 6 ++++++ 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/.htaccess b/.htaccess index 4a19a4d..45046be 100644 --- a/.htaccess +++ b/.htaccess @@ -3,7 +3,7 @@ RewriteCond %{HTTPS} off RewriteRule (.*) http://www.homertonball.com [L] RewriteRule index.php - [QSA,L] -RewriteRule (.*) https://www.srcf.ucam.org/hmb/secure/index.php?page=$1 [QSA,L] +RewriteRule (.*) /hmb/secure/index.php?page=$1 [QSA,L] AuthType Ucam-WebAuth Require valid-user diff --git a/index.php b/index.php index b4c5c59..1b9a232 100644 --- a/index.php +++ b/index.php @@ -9,7 +9,7 @@ class Page { public function logic($template){ - + } } @@ -29,7 +29,7 @@ class Template { class Theme { public function display($template){ - + } @@ -38,7 +38,7 @@ class Theme { class Config { private $data; - + public function __construct($data){ $this->data = $data; } @@ -145,6 +145,21 @@ class Type { return $this->left; } + public static function Get($id){ + $query = 'SELECT `id`,`name`,`price` FROM `type` WHERE id = ?'; + $stmt = Ticketing::Get()->database()->prepare($query); + $stmt->bind_param('i', $id); + $stmt->execute(); + $stmt->bind_result($id, $name, $price); + $type = null; + if($stmt->fetch()){ + $type = new Type($id, $name, $price); + } + $stmt->close(); + return $type; + + } + public static function Get_All(){ $query = 'SELECT `id`,`name`,`price` FROM `type`'; $stmt = Ticketing::Get()->database()->prepare($query); @@ -285,7 +300,7 @@ class Ticketing { return ''; } } - + private $type; public function type(){ diff --git a/pages/index.php b/pages/index.php index 2490720..1025fa7 100644 --- a/pages/index.php +++ b/pages/index.php @@ -59,13 +59,11 @@ class Page_Index extends Page { $template->types[$type->id()] = array( 'name' => $type->name(), 'price' => $type->price(), - 'tickets_left' => $type->left() + 'tickets_left' => $type->left(), + 'url' => $system->url('add', $type->id()) ); } - $template->add = $system->url('add'); - - $system->database()->commit(); } catch (Exception $e){ diff --git a/templates/index.php b/templates/index.php index 3ecd656..3ddbd69 100644 --- a/templates/index.php +++ b/templates/index.php @@ -7,17 +7,25 @@ class Template_Index extends Template {
previous) > 0){ ?> +current) > 0){ ?>
-

Current Order

- +

Current Order

+ +
+ +
+
    + types as $type){ ?> +
  • Ticket

    £

    SOLD OUT

  • + +
'; print_r($this); echo ''; } } diff --git a/theme.php b/theme.php index e38f84f..53a40d2 100644 --- a/theme.php +++ b/theme.php @@ -9,8 +9,14 @@ class Theme_Impl extends Theme { Homerton May Ball 2011 Ticketing - <?php echo $template->title(); ?> + +

Homerton May Ball 2011 Ticketing System

display(); ?>
-- 2.34.1