/** * Searches the root-node for a users' widgets. * If not given, the node is created on the fly. * Those nodes are required to ensure a proper sort-handling on the system-table * * @param string $strUserid * @param string $strAspectId * @return string * @static */ public static function getWidgetsRootNodeForUser($strUserid, $strAspectId = "") { if ($strAspectId == "") { $strAspectId = class_module_system_aspect::getCurrentAspectId(); } $strQuery = "SELECT system_id\n \t\t\t FROM " . _dbprefix_ . "dashboard,\n \t\t\t \t " . _dbprefix_ . "system\n \t\t\t WHERE dashboard_id = system_id\n \t\t\t AND system_prev_id = ?\n \t\t\t AND dashboard_user = ?\n \t\t\t AND dashboard_aspect = ?\n \t\t\t AND dashboard_class = ?\n \t ORDER BY system_sort ASC "; $arrRow = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array(class_module_system_module::getModuleByName("dashboard")->getSystemid(), $strUserid, $strAspectId, "root_node")); if (!isset($arrRow["system_id"]) || !validateSystemid($arrRow["system_id"])) { //Create a new root-node on the fly $objWidget = new class_module_dashboard_widget(); $objWidget->setStrAspect($strAspectId); $objWidget->setStrUser($strUserid); $objWidget->setStrClass("root_node"); $objWidget->updateObjectToDb(class_module_system_module::getModuleByName("dashboard")->getSystemid()); $strReturnId = $objWidget->getSystemid(); } else { $strReturnId = $arrRow["system_id"]; } return $strReturnId; }
/** * Creates the layout of a dashboard-entry. loads the widget to fetch the contents of the concrete widget. * * @param class_module_dashboard_widget $objDashboardWidget * * @return string */ protected function layoutAdminWidget($objDashboardWidget) { $strWidgetContent = ""; $objConcreteWidget = $objDashboardWidget->getConcreteAdminwidget(); $strWidgetId = $objConcreteWidget->getSystemid(); $strWidgetName = $objConcreteWidget->getWidgetName(); $strWidgetNameAdditionalContent = $objConcreteWidget->getWidgetNameAdditionalContent(); $strWidgetContent .= $this->objToolkit->getDashboardWidgetEncloser($objDashboardWidget->getSystemid(), $this->objToolkit->getAdminwidget($strWidgetId, $strWidgetName, $strWidgetNameAdditionalContent, $objDashboardWidget->rightEdit() ? class_link::getLinkAdminDialog("dashboard", "editWidget", "&systemid=" . $objDashboardWidget->getSystemid(), "", $this->getLang("editWidget"), "icon_edit", $objDashboardWidget->getConcreteAdminwidget()->getWidgetName()) : "", $objDashboardWidget->rightDelete() ? $this->objToolkit->listDeleteButton($objDashboardWidget->getConcreteAdminwidget()->getWidgetName(), $this->getLang("widgetDeleteQuestion"), "javascript:KAJONA.admin.dashboard.removeWidget(\\'" . $objDashboardWidget->getSystemid() . "\\');") : "", $objDashboardWidget->getConcreteAdminwidget()->getLayoutSection())); return $strWidgetContent; }