File: D:/HostingSpaces/SBogers10/lab.komma-mediadesign.nl/wwwroot/lab/lib/controller.class.php
<?php
/**
* controller.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/19/13
*/
class Controller {
/*
* @property View
* Contains a view object.
*/
protected $View;
/*
* @property Model
* Contains a model object.
*/
protected $Model;
/*
* @property Alert
* Contains an alert object.
*/
protected $Alert;
/*
* @property Functions
* Contains an functions object.
* This object contains functions which can be used by a controller.
*/
protected $Functions;
public function __construct()
{
$this->View = new View();
$this->Functions = new Functions();
$this->Alert = new Alert();
if(Session::get('admin_string')) $this->View->setData('asideFile','v_aside.php');
}
/*
* LoadModel checks if the requested file exists.
* If so, it includes it in this template and creates a new Model;
*/
public function loadModel($name)
{
$path = DOCUMENT_ROOT . 'models/m_' . strtolower($name) . '.class.php';
if(file_exists($path))
{
include $path;
$modelName = ucfirst($name) . '_Model';
$this->Model = new $modelName;
}
}
}