seeddms-code/inc/inc.ClassUI.php

102 lines
3.7 KiB
PHP
Raw Normal View History

2011-03-10 14:46:01 +00:00
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
2010-10-29 13:19:51 +00:00
// Copyright (C) 2010 Matteo Lucarelli
2011-03-10 14:46:01 +00:00
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
require_once('inc.ClassUI_Default.php');
require_once('inc.ClassViewCommon.php');
/* $theme was possibly set in inc.Authentication.php */
2011-03-10 14:46:01 +00:00
if (!isset($theme) || strlen($theme)==0) {
$theme = $settings->_theme;
}
if (strlen($theme)==0) {
$theme="blue";
}
/* 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()) { /* {{{ */
2013-01-28 10:16:13 +00:00
global $settings, $session;
if(file_exists("../views/".$theme."/class.".$class.".php")) {
require("../views/".$theme."/class.".$class.".php");
$classname = "SeedDMS_View_".$class;
$view = new $classname($params, $theme);
/* Set some configuration parameters */
2013-01-28 10:16:13 +00:00
$view->setParam('session', $session);
$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('enablelargefileupload', $settings->_enableLargeFileUpload);
$view->setParam('printdisclaimer', $settings->_printDisclaimer);
$view->setParam('footnote', $settings->_footNote);
$view->setParam('logfileenable', $settings->_logFileEnable);
2013-01-29 13:08:25 +00:00
$view->setParam('expandfoldertree', $settings->_expandFolderTree);
2013-01-28 10:16:13 +00:00
$view->setParam('enablefoldertree', $settings->_enableFolderTree);
$view->setParam('enablelanguageselector', $settings->_enableLanguageSelector);
$view->setParam('workflowmode', $settings->_workflowMode);
2013-01-29 13:08:25 +00:00
$view->setParam('partitionsize', $settings->_partitionSize);
return $view;
}
return null;
} /* }}} */
2011-03-10 14:46:01 +00:00
static function getStyles() { /* {{{ */
global $settings;
2011-03-10 14:46:01 +00:00
$themes = array();
$path = $settings->_rootDir . "views/";
2011-03-10 14:46:01 +00:00
$handle = opendir($path);
while ($entry = readdir($handle) ) {
if ($entry == ".." || $entry == ".")
continue;
else if (is_dir($path . $entry) || is_link($path . $entry))
2011-03-10 14:46:01 +00:00
array_push($themes, $entry);
}
closedir($handle);
return $themes;
} /* }}} */
2011-03-10 14:46:01 +00:00
static function exitError($pagetitle, $error) {
2011-10-26 07:31:48 +00:00
global $theme;
$tmp = 'ErrorDlg';
$view = UI::factory($theme, $tmp);
$view->exitError($pagetitle, $error);
2011-03-10 14:46:01 +00:00
}
2010-10-29 13:19:51 +00:00
}
2011-03-10 14:46:01 +00:00
?>