Changeset 49
- Timestamp:
- 07/17/07 19:30:09 (18 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 3 modified
-
config/sql/karamelo.sql (modified) (1 diff)
-
controllers/events_controller.php (modified) (9 diffs)
-
vendors/Calendar.php (added)
-
views/events/calendar.thtml (added)
-
webroot/css/styles.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/karamelo.sql
r44 r49 864 864 ); 865 865 866 CREATE TABLE events ( 867 id serial PRIMARY KEY, 868 title varchar(100) NOT NULL, 869 description varchar(255) NOT NULL, 870 "when" timestamp(0) with time zone DEFAULT now() NOT NULL, 871 status int NOT NULL DEFAULT 0 872 ); 873 866 874 CREATE TABLE lessons ( -- lessons 867 875 id serial PRIMARY KEY, -
trunk/app/controllers/events_controller.php
r46 r49 7 7 8 8 uses('sanitize'); 9 loadModel('User'); 10 vendor('Calendar'); 9 11 10 12 class EventsController extends AppController … … 14 16 public $components = array('Portal'); 15 17 16 public function display()18 public function calendar() 17 19 { 18 $this->layout = 'ajax';20 $this->layout = 'portal'; 19 21 20 $conditions = null;22 $conditions = array("Event.status"=>1); 21 23 22 $fields = array("Subject.id", "Subject.title", "Subject.code");24 $fields = array("Event.id", "Event.title", "Event.description", "Event.when"); 23 25 24 $order = "Subject.title";26 $order = "Event.when DESC"; 25 27 26 $limit = null;28 $limit = null; 27 29 28 $this->set('data', $this-> Subject->findAll($conditions, $fields, $order, $limit));30 $this->set('data', $this->Event->findAll($conditions, $fields, $order, $limit)); 29 31 30 $ this->render('qs', 'ajax');32 $cal = new Calendar ('2007', '7'); 31 33 34 $dts['Month'] = $cal->getFullMonthName(); 35 36 $dts['Display'] = $cal->display(); 37 38 $this->set('dts', $dts); 39 40 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 32 41 } 33 42 … … 36 45 $this->layout = 'portal'; 37 46 38 $conditions = array(" Subject.code"=>$code);47 $conditions = array("Event.code"=>$code); 39 48 40 $fields = array(" Subject.id", "Subject.title", "Subject.code");49 $fields = array("Event.id", "Event.title", "Event.code"); 41 50 42 $order = " Subject.title";51 $order = "Event.title"; 43 52 44 53 $limit = 20; 45 54 46 $this->set('data', $this-> Subject->findAll($conditions, $fields, $order, $limit, null, 2));55 $this->set('data', $this->Event->findAll($conditions, $fields, $order, $limit, null, 2)); 47 56 48 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars57 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 49 58 } 50 59 51 60 public function show($subject_id) 52 61 { 53 $this->pageTitle = 'Karamelo :: Subject';62 $this->pageTitle = 'Karamelo :: Event'; 54 63 $this->layout = 'default'; //$this->Blog->field; 55 $conditions = array(" Subject.id"=>$subject_id);56 $fields = array(" Subject.id", "Subject.title", "Subject.code");57 $order = " Subject.title DESC";64 $conditions = array("Event.id"=>$subject_id); 65 $fields = array("Event.id", "Event.title", "Event.code"); 66 $order = "Event.title DESC"; 58 67 59 68 $this->set('subjects', $this->Portal->cms()); // Using Portal component … … 61 70 $this->set('randomQuote', $this->Portal->quote()); // quote footer 62 71 63 $this->set('data', $this-> Subject->findAll($conditions, $fields, $order));72 $this->set('data', $this->Event->findAll($conditions, $fields, $order)); 64 73 65 74 } … … 76 85 $order = "title DESC"; 77 86 78 $this->set('data', $this-> Subject->findAll($conditions, $fields, $order));87 $this->set('data', $this->Event->findAll($conditions, $fields, $order)); 79 88 } 80 89 … … 84 93 85 94 // adds new classroom to database 86 if (!empty($this->data[" Subject"]))95 if (!empty($this->data["Event"])) 87 96 { 88 97 $this->Sanitize = new Sanitize; 89 98 90 $this->Sanitize->cleanArray($this->data[" Subject"]); //Hopefully this is enough99 $this->Sanitize->cleanArray($this->data["Event"]); //Hopefully this is enough 91 100 92 if ($this-> Subject->save($this->data["Subject"]))101 if ($this->Event->save($this->data["Event"])) 93 102 { 94 103 $this->msgFlash('Your subject has been saved.','/admin/subjects/listing'); … … 101 110 { 102 111 103 if (empty($this->data[" Subject"]))112 if (empty($this->data["Event"])) 104 113 { 105 114 $this->layout = 'admin'; 106 115 107 $this-> Subject->id = $id;116 $this->Event->id = $id; 108 117 109 $this->data = $this-> Subject->read();118 $this->data = $this->Event->read(); 110 119 } 111 120 else … … 113 122 $this->Sanitize = new Sanitize; 114 123 115 $this->Sanitize->cleanArray($this->data[" Subject"]); //Hopefully this is enough124 $this->Sanitize->cleanArray($this->data["Event"]); //Hopefully this is enough 116 125 117 if ($this-> Subject->save($this->data['Subject']))126 if ($this->Event->save($this->data['Event'])) 118 127 { 119 128 $this->msgFlash('Your subject has been updated', '/admin/subjects/listing'); … … 125 134 { 126 135 // deletes task from database 127 $this-> Subject->del($id);128 $this->msgFlash(' Subject has been deleted','/admin/subjects/listing');136 $this->Event->del($id); 137 $this->msgFlash('Event has been deleted','/admin/subjects/listing'); 129 138 } 130 139 -
trunk/app/webroot/css/styles.css
r34 r49 396 396 } 397 397 398 398 /* overall table */ 399 #calendar table { 400 border:1px solid #fff; 401 padding: 0; 402 margin:20px; 403 } 404 405 /* the day headers across the top */ 406 #calendar th { 407 background: #565; 408 color: #fff; 409 margin: 3px; 410 padding: 2px 5px; 411 } 412 413 /* how days this month will look, make dates appear in top right */ 414 #calendar td { 415 background: #eee; 416 color: #000; 417 padding: 2px; 418 margin:0; 419 height:60px; 420 text-align:right; 421 vertical-align:top; 422 border:1px solid #fff; 423 } 424 425 /* these are the days falling outside this month */ 426 #calendar td.notInMonth { 427 background: #999; 428 } 429
