* @license PHP License * @package WB * @subpackage content */ /** * Load classes */ WBClass::load('WBContent' , 'WBITS'); /** * Content component: ITS * * @version 1.0.0 * @package WB * @subpackage content */ class WBContent_ITS extends WBContent { /** * Backend * @var WBITS */ protected $its; /** * Current ticket * @var WBITS_Ticket */ protected $ticket; /** * Setup Namespace Config * */ protected function configureNamespace() { // setup namespace $config = WBITS::getConfig(); if (empty($this->config['namespace'])) { $this->config['namespace'] = $config['namespace']; return; } // find matching namespace if (isset($config['namespaces'][$this->config['namespace']])) { return; } // if nothing matches, use default $this->config['namespace'] = $config['namespace']; } /** * 2nd constructor * * Called after configuration was done */ protected function init() { $this->configureNamespace(); $tmplDir = $this->config['tmplDir']; if (!empty($this->config['namespace'])) { $tmplDir .= '/' . $this->config['namespace']; } $parameter = array( 'tmpl' => $this->tmpl, 'tmplDir' => $tmplDir, 'req' => $this->req, 'formConfigDir' => $this->getFormConfigDir() ); $this->its = WBClass::create('WBITS', $parameter); $this->its->useNamespace($this->config['namespace']); } /** * Load templates from file * * Wrapper function to load templates according to namespace * * @param string $tmpl * @param bool local templates */ protected function loadTemplates($tmpl, $local = true) { if (empty($this->config['namespace'])) { return parent::loadTemplates($tmpl, $local); } if ($local) { $tmpl = $this->config['namespace'] . '/' . $tmpl; } return parent::loadTemplates($tmpl, $local); } /** * location of form config * * Return sub directory where form element definitions are located * * @return string folder */ protected function getFormConfigDir() { $dir = strtolower($this->config['tmplDir']); if (empty($this->config['namespace'])) { return $dir; } $dir .= '/' . $this->config['namespace']; return $dir; } }