Campustream 1.0
A social network MQP for WPI
|
00001 <?php 00002 00003 00004 class Controller { 00005 00006 public $enable_session = false; 00007 public $template; 00008 00009 public $session = null; 00010 00011 public function __construct() { 00012 if (Hub::$activecontroller == NULL) { 00013 # Set the active controller to the first controller loaded 00014 Hub::$activecontroller = $this; 00015 } 00016 00017 if ($this->enable_session) { 00018 if (isset($_POST['access_token'])) { 00019 $this->session = Session_Controller::rebuild_using_access_token($_POST['access_token']); 00020 } else { 00021 $this->session = new Session(); 00022 } 00023 } 00024 00025 if(isset($this->template) && !empty($this->template)) { 00026 $this->template = new View( $this->template ); 00027 } 00028 00029 } 00030 00031 public function __call($method, $args) { 00032 # METHOD NOT FOUND, THROW A 404 00033 echo "Could not find $method -> $args<br>"; 00034 Hub::send404(); 00035 } 00036 00037 public function _loadView($filename, $data) { 00038 00039 extract($data); 00040 00041 ob_start(); 00042 include($GLOBALS['APPROOT'] . 'application/views/' . $filename); 00043 $rendered = ob_get_contents(); 00044 ob_end_clean(); 00045 return $rendered; 00046 } 00047 }