Code: Select all
<?php
# Contains action methods
# No need for initializing controller so lets just require it here
require_once('actionControllers/class.homeActionController.php');
class homeController extends homeActionController
{
# Action List of exceptions/commands that may be issued
# As specific command
var $actionRules = array('showpoll');
# Exception list of possible exceptions that may be
# Issued to a specific action. 'Action' should not be deleted,
# Just in case but it does not neccesarily exist if the
# Page does not require actions
var $exceptions = array('action', 'pollId');
# List of safe exceptions and actions only available within
# This controller
var $rulesValues = array();
var $methods = array();
var $httpRequests;
function homeController()
{
$this->getMethods();
$this->loadRuleValues();
$this->initPageLoad();
$this->loadLazyLibrary();
$this->execute();
}
function loadRuleValues() {
foreach ($this->methods as $methodType) {
foreach ($methodType as $name => $value) {
if ($this->isException($name)) {
if (!empty($this->methods['GET'][$name])) {
$this->ruleValues[$name] = $value;
}
else if (!empty($this->methods['POST'][$name])) {
$this->ruleValues[$name] = $value;
}
}
}
}
}
function getMethods() {
$this->httpRequests = Singleton::instance('httpRequest');
$this->methods['GET'] = $this->httpRequests->GET();
$this->methods['POST'] = $this->httpRequests->POST();
}
# List of commands that need to be executed
# Responsibility of these cases are determined through exceptions
# Must add catches for commands aswell as exceptions to change arguments
function execute()
{
$this->initPageLoad();
if ($this->isException('showPoll') && !empty($this->ruleValues['pollId'])) {
$this->buildPoll($this->rulesValues['pollId']);
}
else {
$this->buildPoll();
}
$this->buildNewsDisplay();
$this->buildNewsLetter();
$this->initPageComplete();
}
# GET Array is always given priority over POST
# Note: We only want to give access to the classes values that have been
# Directly mapped to this, just in case
function isException($inline = '')
{
if (empty($inline) && in_array($this->ruleValues['action'], $this->exceptions)) {
return true;
}
else if (in_array($inline, $this->exceptions)) {
return true;
}
}
# Any library files that are required by default for page to work
# Defaulted to lazy load
function loadLazyLibrary()
{
require_once('systemLib/class.pagination.php');
require_once('systemLib/class.poll.php');
}
# Some sections may only require a specific library to accomplish a
# Task, so there is no reason we need to load it so the whole class
# Has access to it
function loadSpecificLibrary($className) {
require_once('systemLib/class.'.$className.'.php');
}
}
#
?>Code: Select all
function loadRuleValues() {
}
function getMethods() {
}I want thinking something along the lines of
FrontControl --> MasterControl extends PageControl extends ActionControl.
Sure enough that is easy.. but the implementation is something I cannot figure out.. how do I dynamically extend a specific class onto the MasterControl class? My front control implements the page control through
Code: Select all
function initPageLoad()
{
if ($this->checkPermission()) {
$page = new $this->pageController;
}
}Any thoughts? Thanks.