/** * @inheritdoc */ public function init() { Javascript::requireLibrary('froala'); return; Javascript::requireLibrary('ckeditor'); Javascript::requireLibrary('ckfinder'); if (Application::getCurrentRequest()->admin) { $this->toolbar = self::TOOLBAR_LARGE; } }
public function toHtml() { $name = $this->id; $this->setVar('css', $this->getCssString()); $this->setVar('id', $this->id); $this->setVar('placeholder', $this->placeholder); if (isset(Application::getCurrentRequest()->{$name})) { $this->setVar('value', Application::getCurrentRequest()->{$name}); } return $this->renderBySkin(); }
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) { // TODO: Refactor! if (isset(Application::getCurrentRequest()->target) && Application::getCurrentRequest()->target != '') { $name = Application::getCurrentRequest()->target; } $file = parent::handle_file_upload($uploaded_file, $name, $size, $type, $error, $index, $content_range); if (empty($file->error) && $this->kollektionId > 0) { $medium = new Medien(); $medium->me_kollektion = $this->kollektionId; $medium->me_titel = $file->name; $medium->me_dateiname = $file->name; $medium->me_erweiterung = strtolower(substr(strrchr($name, '.'), 1)); $medium->me_groesse = $file->size; $medium->me_upload_am = date('d.m.Y'); $medium->me_upload_von = Security::getUserId(); if (isset(Application::getCurrentRequest()->token) && Application::getCurrentRequest()->token != '') { $medium->me_token = Application::getCurrentRequest()->token; } $medium->save(); $file->id = $medium->id; } return $file; }
/** * Gibt den Inhalt des aktullen App-Requests aus * @return Control */ public function showNfsRequest() { $i = 0; $panel = new SimplePanelControl(null, 'debugNfsReq'); $this->addRequest($panel, Application::getCurrentRequest(), $i); return $panel; }
/** * Gibt das HTML Markup aus. Die Funktion hinter dem Wrapper wird jetzt erst aufgerufen! * @return string * @throws Exception */ public function toHtml() { // Erzeugen des neuen Requests $request = Application::getCurrentRequest()->createSubRequest(); $request->module = $this->module; $request->action = $this->action; $request->embedded = true; $request->setViaArray($this->param); $module = Modules::getModule($this->module); if ($module == null) { throw new Exception("[Wrapper] Modul {$this->module} konnte nicht geladen werden"); } $controller = $module->createController($request); if ($controller->hatBerechtigung()) { $response = $controller->execute($request); Logging::warning((string) $response->getContent()); if ($response->getContent() instanceof View) { $result = '<div id="' . $this->id . '" class="wrapper">' . $response->getContent()->render() . '</div>'; } else { $result = 'NO VIEW'; } } else { $result = '<div class="alert alert-danger">Für diese Funktion haben Sie keine ausreichende Berechtigung</div>'; } // Ergebnis in einem Panel verpacken if ($this->showInPanel) { $panel = new CaptionedPanelControl(null, 'panel-' . $this->id); $panel->setCaption($this->panelCaption); $panel->setCollapsed($this->panelCollapsed); $html = new HtmlControl($panel); $html->setInnerHtml($result); $result = $panel->toHtml(); } return $result; }
/** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param string $message * @param array|string $context */ public function error($message, array $context = array()) { $context = ''; if (Application::getCurrentRequest() !== null) { $context = print_r(Application::getCurrentRequest()->getFullArray(), true); } error_log($message . "\r\n" . $context); $this->log(LoggingProvider::LOG_ERROR, $message . "\r\n" . $context); }