document = $document; $this->searchable = false; $this->reference = ""; $this->title = "Untitled View"; $this->langModules = array(); $this->loadView = $loadView; } public function getTitle() { return $this->title; } public function getDocument() { return $this->document; } public function isSearchable() { return $this->searchable; } public function getReference() { return $this->reference; } protected function load(string $viewClass) : string { try { $reflectionClass = new \ReflectionClass($viewClass); if ($reflectionClass->isSubclassOf(View::class) && $reflectionClass->isInstantiable()) { $view = $reflectionClass->newInstanceArgs(array($this->getDocument())); $view->loadView(); return $view; } } catch(\ReflectionException $e) { error_log($e->getMessage()); } return ""; } private function loadLanguageModules() { $lang = $this->document->getUser()->getLanguage(); foreach($this->langModules as $langModule) { $lang->loadModule($langModule); } } // Virtual Methods public function loadView() { } public function getCode() { // Load translations $this->loadLanguageModules(); // Load Meta Data + Head (title, scripts, includes, ...) if($this->loadView) { $this->loadView(); } return ''; } // UI Functions private function createList($items, $tag) { if(count($items) === 0) return "<$tag>$tag>"; else return "<$tag>
$content
"; } public function createParagraph($title, $id, $content) { $id = replaceCssSelector($id); $iconId = urlencode("$id-icon"); return "