seeddms-code/inc/inc.ClassViewCommon.php

79 lines
1.7 KiB
PHP
Raw Normal View History

2013-01-11 16:55:34 +00:00
<?php
/**
* Implementation of view class
*
* @category DMS
* @package SeedDMS
2013-01-11 16:55:34 +00:00
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Parent class for all view classes
*
* @category DMS
* @package SeedDMS
2013-01-11 16:55:34 +00:00
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_Common {
protected $theme;
2013-01-11 16:55:34 +00:00
protected $params;
2013-01-11 16:55:34 +00:00
function __construct($params, $theme='blue') {
$this->theme = $theme;
$this->params = $params;
}
function __invoke($get=array()) {
if(isset($get['action']) && $get['action']) {
if(method_exists($this, $get['action'])) {
$this->{$get['action']}();
} else {
echo "Missing action '".$get['action']."'";
}
} else
$this->show();
}
2013-01-11 16:55:34 +00:00
function setParams($params) {
$this->params = $params;
}
function setParam($name, $value) {
$this->params[$name] = $value;
}
2015-08-25 12:58:16 +00:00
function getParam($name) {
if(isset($this->params[$name]))
return $this->params[$name];
return null;
}
2013-06-18 16:14:14 +00:00
function unsetParam($name) {
if(isset($this->params[$name]))
unset($this->params[$name]);
}
2013-01-11 16:55:34 +00:00
function show() {
}
2016-03-08 09:37:07 +00:00
function jsTranslations($keys) {
echo "var trans = {\n";
foreach($keys as $key) {
echo " '".$key."': '".str_replace("'", "\\\'", getMLText($key))."',\n";
}
echo "};\n";
}
2013-01-11 16:55:34 +00:00
}
?>