_theme; } if (strlen($theme)==0) { $theme="bootstrap"; } /* Sooner or later the parent will be removed, because all output will * be done by the new view classes. */ class UI extends UI_Default { /** * Create a view from a class in the given theme * * This method will check for a class file in the theme directory * and returns an instance of it. * * @param string $theme theme * @param string $class name of view class * @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()) { /* {{{ */ global $settings, $session, $EXT_CONF; if(!$class) { $class = 'Bootstrap'; $classname = "SeedDMS_Bootstrap_Style"; } else { $classname = "SeedDMS_View_".$class; } /* Do not check for class file anymore but include it relative * to rootDir or an extension dir if it has set the include path */ $filename = ''; foreach($EXT_CONF as $extname=>$extconf) { if(!isset($extconf['disable']) || $extconf['disable'] == false) { $filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/class.".$class.".php"; if(file_exists($filename)) { break; } $filename = ''; if(isset($extconf['views'][$class])) { $filename = $settings->_rootDir.'ext/'.$extname.'/views/'.$theme."/".$extconf['views'][$class]['file']; if(file_exists($filename)) { $classname = $extconf['views'][$class]['name']; break; } } } } if(!$filename) $filename = $settings->_rootDir."views/".$theme."/class.".$class.".php"; if(!file_exists($filename)) $filename = ''; if($filename) { require($filename); $view = new $classname($params, $theme); /* Set some configuration parameters */ $view->setParam('refferer', $_SERVER['REQUEST_URI']); $view->setParam('class', $class); $view->setParam('session', $session); $view->setParam('settings', $settings); $view->setParam('sitename', $settings->_siteName); $view->setParam('rootfolderid', $settings->_rootFolderID); $view->setParam('disableselfedit', $settings->_disableSelfEdit); $view->setParam('enableusersview', $settings->_enableUsersView); $view->setParam('enablecalendar', $settings->_enableCalendar); $view->setParam('calendardefaultview', $settings->_calendarDefaultView); $view->setParam('enablefullsearch', $settings->_enableFullSearch); $view->setParam('enablehelp', $settings->_enableHelp); $view->setParam('enablelargefileupload', $settings->_enableLargeFileUpload); $view->setParam('printdisclaimer', $settings->_printDisclaimer); $view->setParam('footnote', $settings->_footNote); $view->setParam('logfileenable', $settings->_logFileEnable); $view->setParam('expandfoldertree', $settings->_expandFolderTree); $view->setParam('enablefoldertree', $settings->_enableFolderTree); $view->setParam('enablelanguageselector', $settings->_enableLanguageSelector); $view->setParam('enableclipboard', $settings->_enableClipboard); $view->setParam('enablemenutasks', $settings->_enableMenuTasks); $view->setParam('workflowmode', $settings->_workflowMode); $view->setParam('partitionsize', $settings->_partitionSize); $view->setParam('checkoutdir', $settings->_checkOutDir); $view->setParam('showmissingtranslations', $settings->_showMissingTranslations); $view->setParam('defaultsearchmethod', $settings->_defaultSearchMethod); return $view; } return null; } /* }}} */ static function getStyles() { /* {{{ */ global $settings; $themes = array(); $path = $settings->_rootDir . "views/"; $handle = opendir($path); while ($entry = readdir($handle) ) { if ($entry == ".." || $entry == ".") continue; else if (is_dir($path . $entry) || is_link($path . $entry)) array_push($themes, $entry); } closedir($handle); return $themes; } /* }}} */ static function exitError($pagetitle, $error) { global $theme, $dms; $tmp = 'ErrorDlg'; $view = UI::factory($theme, $tmp); $view->setParam('dms', $dms); $view->exitError($pagetitle, $error); } } ?>