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
* @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;
if(file_exists("../views/".$theme."/class.".$class.".php")) {
require("../views/".$theme."/class.".$class.".php");
if(!$class) {
$class = 'Bootstrap';
$classname = "SeedDMS_Bootstrap_Style";
} else {
$classname = "SeedDMS_View_".$class;
}
$filename = "../views/".$theme."/class.".$class.".php";
if(file_exists($filename)) {
require($filename);
$view = new $classname($params, $theme);
/* Set some configuration parameters */
$view->setParam('refferer', $_SERVER['REQUEST_URI']);