From 11972639df8315753123ebccdadee1f596807ad0 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 16 Sep 2014 08:03:29 +0000 Subject: Integrated new EasyGiant Library --- h-source/Library/Controller.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'h-source/Library/Controller.php') diff --git a/h-source/Library/Controller.php b/h-source/Library/Controller.php index b0eef53..bc1c229 100755 --- a/h-source/Library/Controller.php +++ b/h-source/Library/Controller.php @@ -2,7 +2,7 @@ // EasyGiant is a PHP framework for creating and managing dynamic content // -// Copyright (C) 2009 - 2011 Antonio Gallo +// Copyright (C) 2009 - 2014 Antonio Gallo (info@laboratoriolibero.com) // See COPYRIGHT.txt and LICENSE.txt. // // This file is part of EasyGiant @@ -31,6 +31,8 @@ class Controller { protected $_queryString = array(); //the array of args coming from the url + public $application = null; + public $applicationUrl = null; //the url of the application public $controller; public $action; public $currPage; //the URL of the current page @@ -57,17 +59,21 @@ class Controller { protected $scaffold = null; //the reference to the scaffold object - function __construct($model, $controller, $queryString = array()) { + function __construct($model, $controller, $queryString = array(), $application = null) + { + $this->application = $application; $this->controller = $controller; $this->modelName = $model; $this->_queryString = $queryString; - $this->theme = new Theme($controller); + $this->theme = new Theme($application, $controller); $this->baseUrl = $this->theme->baseUrl; $this->baseUrlSrc = $this->theme->baseUrlSrc; - + $this->headerObj = new HeaderObj(DOMAIN_NAME); $this->request = new Request(); + + $this->applicationUrl = isset($application) ? $application . "/" : null; } //redirect to $path after the time $time @@ -136,8 +142,8 @@ class Controller { { if (class_exists($controller)) { $model = str_replace('Controller',null,$controller).'Model'; - $application = strtolower(str_replace('Controller',null,$controller)); - $this->c[$controller] = new $controller($model,$application,array()); + $application = $this->controller; + $this->c[$controller] = new $controller($model,$application,$this->_queryString); $this->c[$controller]->theme = $this->theme; } } @@ -234,7 +240,7 @@ class Controller { } $this->viewArgs[$this->argKeys[$i]] = $this->_queryString[$i]; } - $this->viewStatus = Url::createUrl(array_values($this->viewArgs)); + $this->viewStatus = Url::createUrl($this->viewArgs); $this->updateHelpers(); //update the theme @@ -282,7 +288,7 @@ class Controller { //create the viewStatus property final public function buildStatus() { - $this->viewStatus = Url::createUrl(array_values($this->viewArgs)); + $this->viewStatus = Url::createUrl($this->viewArgs); //update the theme $this->theme->viewStatus = $this->viewStatus; $this->theme->viewArgs = $this->viewArgs; @@ -295,9 +301,9 @@ class Controller { if (!in_array($type,$typeArray)) { throw new Exception("the type '$type' is not allowed in ".__METHOD__); } - $this->scaffold = new Scaffold($type,$this->controller,$this->m[$this->modelName],$this->viewArgs,$params); + $this->scaffold = new Scaffold($type,$this->application,$this->controller,$this->m[$this->modelName],$this->viewArgs,$params); - $this->helper('Menu',$this->controller,$this->scaffold->params['panelController']); + $this->helper('Menu',$this->applicationUrl.$this->controller,$this->scaffold->params['panelController']); $this->scaffold->mainMenu = $this->h['Menu']; $this->m[$this->modelName]->popupBuild(); @@ -305,7 +311,8 @@ class Controller { if ($type === 'main') { - $here = $this->controller.'/'.$this->scaffold->params['mainAction']; + $here = $this->applicationUrl.$this->controller.'/'.$this->scaffold->params['mainAction']; + $this->helper('Pages',$here,$this->scaffold->params['pageVariable']); $this->helper('List',$this->m[$this->modelName]->identifierName,$here,$this->scaffold->params['pageVariable']); -- cgit v1.2.3