/** * Renderes the content of a single widget. * * @return string * @permissions view */ protected function actionGetWidgetContent() { //load the aspect and close the session afterwards class_module_system_aspect::getCurrentAspect(); $objWidgetModel = new class_module_dashboard_widget($this->getSystemid()); if ($objWidgetModel->rightView()) { $objConcreteWidget = $objWidgetModel->getConcreteAdminwidget(); if (!$objConcreteWidget->getBitBlockSessionClose()) { class_carrier::getInstance()->getObjSession()->sessionClose(); } //disable the internal changelog class_module_system_changelog::$bitChangelogEnabled = false; class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); $strReturn = json_encode($objConcreteWidget->generateWidgetOutput()); } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_UNAUTHORIZED); $strReturn = "<message><error>" . xmlSafeString($this->getLang("commons_error_permissions")) . "</error></message>"; } return $strReturn; }
/** * Creates the form to edit a widget (NOT the dashboard entry!) * * @throws class_exception * @return string "" in case of success * @permissions edit */ protected function actionEditWidget() { $strReturn = ""; $this->setArrModuleEntry("template", "/folderview.tpl"); if ($this->getParam("saveWidget") == "") { $objDashboardwidget = new class_module_dashboard_widget($this->getSystemid()); $objWidget = $objDashboardwidget->getConcreteAdminwidget(); //ask the widget to generate its form-parts and wrap our elements around $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref("dashboard", "editWidget")); $strReturn .= $objWidget->getEditForm(); $strReturn .= $this->objToolkit->formInputHidden("systemid", $this->getSystemid()); $strReturn .= $this->objToolkit->formInputHidden("saveWidget", "1"); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); } elseif ($this->getParam("saveWidget") == "1") { //the dashboard entry $objDashboardwidget = new class_module_dashboard_widget($this->getSystemid()); //the concrete widget $objConcreteWidget = $objDashboardwidget->getConcreteAdminwidget(); $objConcreteWidget->loadFieldsFromArray($this->getAllParams()); $objDashboardwidget->setStrContent($objConcreteWidget->getFieldsAsString()); if (!$objDashboardwidget->updateObjectToDb()) { throw new class_exception("Error updating widget to db!", class_exception::$level_ERROR); } $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "", "&peClose=1&blockAction=1")); } return $strReturn; }