139 lines
2.6 KiB
PHP
139 lines
2.6 KiB
PHP
<?php
|
|
|
|
require_once('viewClass_abstract.php');
|
|
|
|
class viewClass extends viewClass_abstract
|
|
{
|
|
private $_config = array();
|
|
private $_prefix = '';
|
|
private $_pathTpl = '';
|
|
private $_template = '';
|
|
private $_siteId = 0;
|
|
private $_editable = false;
|
|
private $_webkey = 0;
|
|
private $_website = array();
|
|
private $_navpath = array();
|
|
private $_data = array();
|
|
private $_param = null;
|
|
private $_specialSite = false;
|
|
private $_formdata = array();
|
|
private $_error = array();
|
|
private $_lang = array();
|
|
|
|
public function setConfig($config)
|
|
{
|
|
$this->_config = $config;
|
|
if (isset ($this->_config['portal']['website']))
|
|
{
|
|
$this->setWebsite($this->_config['portal']['website']);
|
|
}
|
|
}
|
|
|
|
private function setWebsite($website)
|
|
{
|
|
$return_array = array();
|
|
$tmp_array = array_flip($website['navId']);
|
|
foreach ($tmp_array as $key => $value)
|
|
{
|
|
foreach ($website as $tmp_key => $tmp_value)
|
|
{
|
|
$return_array[$key][$tmp_key] = $website[$tmp_key][$value];
|
|
}
|
|
}
|
|
$this->_website = $return_array;
|
|
}
|
|
|
|
public function setPrefix($prefix)
|
|
{
|
|
$this->_prefix = $prefix;
|
|
}
|
|
|
|
public function setPathTpl($pathTpl)
|
|
{
|
|
if (is_dir($pathTpl . '/' . $this->_prefix))
|
|
{
|
|
$this->_pathTpl = $pathTpl . $this->_prefix . '/';
|
|
}
|
|
else
|
|
{
|
|
echo '<pre>';
|
|
var_dump($this->_pathTpl = $pathTpl . $this->_prefix . '/');
|
|
echo '</pre>';
|
|
//throw new Exception('Template Path does not exist');
|
|
}
|
|
}
|
|
|
|
public function setTemplate($template)
|
|
{
|
|
if (file_exists($this->_pathTpl . 'tpl_' . $template . '.php'))
|
|
{
|
|
$this->_template = $this->_pathTpl . 'tpl_' . $template . '.php';
|
|
}
|
|
else
|
|
{
|
|
echo '<pre>';
|
|
var_dump($this->_template = $this->_pathTpl . 'tpl_' . $template . '.php');
|
|
echo '</pre>';
|
|
//throw new Exception('Template "' . $this->_pathTpl . 'tpl_' . $template . '.php" does not exist');
|
|
}
|
|
}
|
|
|
|
public function setSiteId($siteId)
|
|
{
|
|
$this->_siteId = $siteId;
|
|
}
|
|
|
|
public function setEditable($editable)
|
|
{
|
|
$this->_editable = $editable;
|
|
}
|
|
|
|
public function setErrors($error)
|
|
{
|
|
$this->_error = $error;
|
|
}
|
|
|
|
public function setWebkey($webkey)
|
|
{
|
|
$this->_webkey = $webkey;
|
|
}
|
|
|
|
public function setNavpath($navpath)
|
|
{
|
|
$this->_navpath = $navpath;
|
|
}
|
|
|
|
public function setData($data, $param = null)
|
|
{
|
|
$this->_data = $data;
|
|
$this->_param = $param;
|
|
}
|
|
|
|
public function setSpecialSite($specialSite)
|
|
{
|
|
$this->_specialSite = $specialSite;
|
|
}
|
|
|
|
public function setFormdata($formdata)
|
|
{
|
|
$this->_formdata = $formdata;
|
|
}
|
|
|
|
public function setError($error)
|
|
{
|
|
$this->_error = $error;
|
|
}
|
|
|
|
public function setLang($lang)
|
|
{
|
|
$this->_lang = $lang;
|
|
}
|
|
|
|
public function output()
|
|
{
|
|
ob_start();
|
|
require $this->_template;
|
|
return ob_get_clean();
|
|
}
|
|
|
|
} |