setDirPrefix ($this->getCurrentThemeDir () . '/'); $this->setRootDirectory (DOCROOT . 'themes/'); $tmp_name = $this->getRootDirectory () . $this->getDirPrefix () . "tmp.$name.php"; if (file_exists ($tmp_name)) { $this->setName ("tmp.$name"); } } function isTemplateExist ($name = null) { if (! isset ($name)) { $name = $this->getName (); } $filename = $this->getRootDirectory () . $this->getDirPrefix () . $name . '.php'; return file_exists ($filename); } function __set ($key, $value) { if (is_object ($value)) { if ($value instanceof Theme_API) { $value = $value->restrict (); } } parent::__set ($key, $value); } function render () { if (!$this->hasComponentDispatcher ()) { $this->setComponentDispatcher (new Theme_ComponentController ()); } $this->components = $this->getComponentDispatcher (); return parent::render (); } function setComponentDispatcher (Theme_ComponentController $component_dispatcher) { $component_dispatcher->setParentView ($this); $this->component_dispatcher = $component_dispatcher; } function getComponentDispatcher () { return $this->component_dispatcher; } function hasComponentDispatcher () { return isset ($this->component_dispatcher); } private function getCurrentThemeDir () { $switcher = new Theme_Switcher (); return $switcher->getSelectedTheme (); } }