Begun work on adding a ticket to a order.
authorRichard Whitehouse <github@richardwhiuk.com>
Fri, 4 Feb 2011 16:45:31 +0000 (16:45 +0000)
committerRichard Whitehouse <github@richardwhiuk.com>
Fri, 4 Feb 2011 16:45:31 +0000 (16:45 +0000)
.htaccess
index.php
pages/index.php
templates/index.php
theme.php

index 4a19a4dbf314f4664d03af6afddca4226f7fb082..45046be06c80990f3a3f0921a53ef8135ae29f1f 100644 (file)
--- 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
index b4c5c5953453a806ba5c1d5e2c0510e0754882b6..1b9a232f669c8b164218e9811489bfdf93f83182 100644 (file)
--- 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(){
index 24907200ed694611439adf86a0b9203557b10de2..1025fa7f76e3db6d5b206e7e4142b0601f902fab 100644 (file)
@@ -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){
index 3ecd65672fc9161f47f7af9e80fa1baa8b3c1cb9..3ddbd69263a3fcc861e86a6c7246169e2859b44b 100644 (file)
@@ -7,17 +7,25 @@ class Template_Index extends Template {
 <div id="index">
 <?php if(count($this->previous) > 0){ ?>
 <div id="previous">
-       <h1>Previous Orders</h1>
+       <h2>Previous Orders</h1>
 
 </div>
 <?php } ?>
+<?php if(count($this->current) > 0){ ?>
 <div id="current">
-       <h1>Current Order</h1>
-
+       <h2>Current Order</h2>
+       <?php print_r($this); ?>
+</div>
+<?php } ?>
+<div id="add">
+       <ul>
+       <?php foreach($this->types as $type){ ?>
+               <li><p><?php if($type['tickets_left']){ ?><a href="<?php echo $type['url']; ?>"><?php } ?><?php echo $type['name']; ?> Ticket<?php if($type['tickets_left']){ ?></a><?php } ?></p><p>£<?php echo $type['price']; ?></p><p><?php echo $type['description']; ?></p><? if(!$type['tickets_left']){ ?><p> SOLD OUT </p><? } ?></li>
+       <?php } ?>
+       </ul>
 </div>
 </div>
 <?php
-               echo '<pre>'; print_r($this); echo '</pre>';
        }
 
 }
index e38f84f337b4915ef2936ca779ab3186c51330a1..53a40d28cd97258966e1cf1b1a35e7d71affe5e9 100644 (file)
--- a/theme.php
+++ b/theme.php
@@ -9,8 +9,14 @@ class Theme_Impl extends Theme {
 <html>
 <head>
        <title>Homerton May Ball 2011 Ticketing - <?php echo $template->title(); ?></title>
+       <style>
+               body {
+                       background: #781416;
+               }
+       </style>
 </head>
 <body>
+<h1>Homerton May Ball 2011 Ticketing System</h1>
 <div class="content">
        <?php $template->display(); ?>
 </div>