factory can be called without a class

in that case only the parent class SeedDMS_Bootstrap_Style will be initiated
This commit is contained in:
Uwe Steinmann 2013-06-18 18:13:18 +02:00
parent 4ab841b09d
commit 97d98137ca

View File

@ -44,11 +44,17 @@ class UI extends UI_Default {
* @param array $params parameter passed to constructor of view class * @param array $params parameter passed to constructor of view class
* @return object an object of a class implementing the view * @return object an object of a class implementing the view
*/ */
static function factory($theme, $class, $params=array()) { /* {{{ */ static function factory($theme, $class='', $params=array()) { /* {{{ */
global $settings, $session; global $settings, $session;
if(file_exists("../views/".$theme."/class.".$class.".php")) { if(!$class) {
require("../views/".$theme."/class.".$class.".php"); $class = 'Bootstrap';
$classname = "SeedDMS_Bootstrap_Style";
} else {
$classname = "SeedDMS_View_".$class; $classname = "SeedDMS_View_".$class;
}
$filename = "../views/".$theme."/class.".$class.".php";
if(file_exists($filename)) {
require($filename);
$view = new $classname($params, $theme); $view = new $classname($params, $theme);
/* Set some configuration parameters */ /* Set some configuration parameters */
$view->setParam('refferer', $_SERVER['REQUEST_URI']); $view->setParam('refferer', $_SERVER['REQUEST_URI']);