Campustream 1.0
A social network MQP for WPI
application/models/eventmeta.php
Go to the documentation of this file.
00001 <?
00002 
00006 class Eventmeta_Model extends ActiveRecord {
00007         public $table_name = 'eventmeta';
00008         public $columns = array('id', 'event_id', 'location', 'location_area', 'start_date', 'end_date', 'all_day');
00009         public $cache_keys = array( 'eventmeta/#' => 'id', 'eventmeta/event:#' => 'event_id' );
00010         public $has_many = array();
00011         public $has_one = array('event');
00012         public $public_columns = array('id', 'event_id', 'location', 'location_area', 'start_date', 'end_date', 'all_day');
00013         
00017         public function load_event() {
00018                 if (!$this->event) {
00019                         $event = ActiveCache::find('Newsevent_Model', $this->event_id, 43200)->sql(
00020                                 "SELECT * FROM newsevents WHERE id = {$this->event_id} LIMIT 1"
00021                         );
00022                         
00023                         if ($event->is_loaded()) {
00024                                 $this->add_relationship('event', $event);
00025                         }
00026                 }
00027         }
00028 }