controller
By: ILLI | Date: Mar 20 2010 16:46 | Format: PHP | Expires: never | Size: 3.64 KB | Hits: 1049
- <?php
- ABSTRACT CLASS ILLI_Controller
- {
- private $_root = NULL;
- private $_layoutDir = '';
- private $_contentBuffer;
- final public function __construct(&$_root)
- {
- $this->_root =& $_root;
- }
- final public function __get($name)
- {
- return $this->$name;
- }
- final public function render()
- {
- if($this->_root->Frontend->View->headIncludeView())
- {
- if($this->_root->Frontend->View->headIncludeLayout())
- {
- $this->_layoutDir = $this->_root->Boot->System->Registry->get()->APP_DIR->LAYOUTS
- .$this->_root->Frontend->View->headLayout()
- .DIRECTORY_SEPARATOR;
- try
- {
- throw new ILLI_SequenceOutput_Exception
- ('Layout-directory '.$this->_layoutDir.' not found.');
- throw new ILLI_SequenceOutput_Exception
- ('Layout-document not found in '.$this->_layoutDir.'document.php.');
- }
- catch(ILLI_SequenceOutput_Exception $e){$e->w();}
- $this->_view()->bufferContent();
- require_once $this->_layoutDir.'document.php';
- }
- else
- {
- $this->_view()->bufferContent();
- return $this->_view()->buffer()->content;
- }
- }
- }
- {
- $result = $this->_root->Boot->Kernel->Dispatcher->createUri($nodename, $args);
- return $result;
- }
- protected function _redirect($route = '')
- {
- try
- {
- throw new ILLI_Controller_Exception
- ('invalid redirect route.');
- $this->_status('301');
- $this->_root->Boot->System->Registry->add('HEADER', 'location',
- $this->_uri($route, $args)->absolute);
- $this->_view()->headDisableLayout();
- }
- catch(ILLI_Controller_Exception $e){$e->w();}
- return $this;
- }
- protected function _view()
- {
- return $this->_root->Frontend->View;
- }
- protected function _db()
- {
- return $this->_root->Api->Database;
- }
- protected function _parameter()
- {
- $params = $this->_root->Boot->System->Registry->get()->DISPATCH->ROUTE->variables;
- $result = new ILLI_ArrayObject($params);
- else
- $result = new ILLI_ArrayObject();
- $result->setFlags(ILLI_ArrayObject::ARRAY_AS_PROPS);
- return $result;
- }
- protected function _get()
- {
- $result = new ILLI_ArrayObject($this->_root->Boot->System->Registry->get()->PARAMS->GET);
- $result->setFlags(ILLI_ArrayObject::ARRAY_AS_PROPS);
- return $result;
- }
- protected function _post()
- {
- $result = new ILLI_ArrayObject($this->_root->Boot->System->Registry->get()->PARAMS->POST);
- $result->setFlags(ILLI_ArrayObject::ARRAY_AS_PROPS);
- return $result;
- }
- protected function _form()
- {
- return $this->_root->Frontend->Form;
- }
- protected function _status($statuscode = '200')
- {
- $REGISTRY = $this->_root->Boot->System->Registry;
- $REGISTRY->remove('HEADER', 'status');
- $REGISTRY->add('HEADER', 'status', $statuscode);
- }
- }
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago