aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Theme.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Library/Theme.php')
-rwxr-xr-xh-source/Library/Theme.php39
1 files changed, 31 insertions, 8 deletions
diff --git a/h-source/Library/Theme.php b/h-source/Library/Theme.php
index a001631..1ddec92 100755
--- a/h-source/Library/Theme.php
+++ b/h-source/Library/Theme.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
@@ -34,13 +34,21 @@ class Theme {
public $viewArgs = array();
public $viewStatus = '';
public $controller = 'controller';
+ public $application = null;
public $action = '';
public $currPage; //the URL of the current page
- function __construct($controller) {
+ function __construct($application, $controller) {
+
$this->controller = $controller;
- $this->baseUrl = MOD_REWRITE_MODULE === true ? 'http://' . DOMAIN_NAME : 'http://' . DOMAIN_NAME . '/index.php';
- $this->baseUrlSrc = 'http://' . DOMAIN_NAME;
+ $this->application = $application;
+
+ $langUrl = isset(Params::$lang) ? "/".Params::$lang : null;
+ $protocol = Params::$useHttps ? "https" : "http";
+
+ $this->baseUrl = MOD_REWRITE_MODULE === true ? "$protocol://" . DOMAIN_NAME . $langUrl : "$protocol://" . DOMAIN_NAME . '/index.php' . $langUrl;
+
+ $this->baseUrlSrc = "$protocol://" . DOMAIN_NAME;
}
@@ -71,15 +79,22 @@ class Theme {
}
}
-
public function render() {
extract($this->_data);
-
+
//find the View subfolder where to look for view files
$subfolder = isset(Params::$viewSubfolder) ? Params::$viewSubfolder . DS : null;
foreach ($this->_viewFiles as $file) {
- if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $file . '.php')) {
+ if (isset($this->application) and file_exists(ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $file . '.php'))
+ {
+ include (ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS . $subfolder. ucwords($this->controller) . DS . $file . '.php');
+ }
+ else if (isset($this->application) and file_exists(ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS . $subfolder. $file . '.php'))
+ {
+ include (ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS .$subfolder. $file . '.php');
+ }
+ else if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $file . '.php')) {
include (ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $file . '.php');
} else {
include (ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. $file . '.php');
@@ -87,7 +102,15 @@ class Theme {
}
if (isset($this->_lastView)) {
- if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $this->_lastView . '.php')) {
+ if (isset($this->application) and file_exists(ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $this->_lastView . '.php'))
+ {
+ include (ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $this->_lastView . '.php');
+ }
+ else if (isset($this->application) and file_exists(ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS . $subfolder . $this->_lastView . '.php'))
+ {
+ include (ROOT . DS . APPLICATION_PATH . DS . "Apps" . DS . ucfirst($this->application). DS . 'Views' . DS .$subfolder . $this->_lastView . '.php');
+ }
+ else if (file_exists(ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $this->_lastView . '.php')) {
include (ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. ucwords($this->controller) . DS . $this->_lastView . '.php');
} else {
include (ROOT . DS . APPLICATION_PATH . DS . 'Views' . DS .$subfolder. $this->_lastView . '.php');