public static function ajaxGetDashboardWidget($name) { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $objResponse = new XajaxResponse(); $xml = '<void/>'; $domain_da = $container->getCurrentDomain()->getDataAccess(); $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($domain_da, $container->getCurrentUser()->getGroup()); // Check if the widget exists in the widgets list $widget_query = $domain_da->execute('SELECT * FROM domain_dashboards_widgets WHERE name=' . $domain_da->formatText($name)); if ($widget_query->getNumberRows() > 0) { $allowed = true; $panel = $widget_query->getFields('panel'); // Do not show widgets tied to a panel when the panel is not accessible to the current user if (strlen($panel)) { $node_id = $perm->getNodeIdFromFileName($panel); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $allowed = false; } } if ($allowed) { $class = $widget_query->getFields('class'); // Check if the class exists if (class_exists($class, true)) { // Fetch the widget xml definition $widget = new $class(); $xml = $widget->getWidgetXml(); } } } // Create the widget html and send it to the dashboard $html = WuiXml::getContentFromXml('', $xml); $objResponse->addAssign('widget_' . $name, 'innerHTML', $html); return $objResponse; }
public function getWidgetsList() { $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); $domain_da = $container->getCurrentDomain()->getDataAccess(); $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($domain_da, $container->getCurrentUser()->getGroup()); // Extract the list of all the widgets $widget_query = $domain_da->execute('SELECT * FROM domain_dashboards_widgets'); while (!$widget_query->eof) { $panel = $widget_query->getFields('panel'); // Do not show widgets tied to a panel when the panel is not accessible to the current user if (strlen($panel)) { $node_id = $perm->getNodeIdFromFileName($panel); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $widget_query->moveNext(); continue; } } // Add current widget $widgets[] = array('name' => $widget_query->getFields('name'), 'file' => $widget_query->getFields('file'), 'class' => $widget_query->getFields('class'), 'panel' => $panel, 'catalog' => $widget_query->getFields('catalog'), 'title' => $widget_query->getFields('title')); $widget_query->moveNext(); } return $widgets; }
/** * Launches a panel in the domain desktop. * * If the panel name is one "main" then * no real panel is launched, a domain desktop layout file is included. * * Domain desktop layout files are stored in the folder * core/classes/innomatic/desktop/layout/domain. * * @param string $resource Panel name. */ public function executeDomain($resource) { // Check if this is the default page and if the user is allowed to access the dashboard if (substr($resource, -1, 1) == '/') { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); $node_id = $perm->getNodeIdFromFileName('dashboard'); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $resource = $resource . 'dashboard'; } } if (substr($resource, -1, 1) != '/') { // Must exit if the user called a page for which he isn't enabled // if (!isset($perm)) { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); } $desktopPanel = basename($resource); if ($this->container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->desktopApplication = $desktopPanel; $dump->sessionId = $this->session->getId(); } switch ($desktopPanel) { case 'index': break; default: $node_id = $perm->getNodeIdFromFileName($desktopPanel); if ($node_id) { if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } else { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } if (is_dir($resource . '-panel')) { $panelHome = $resource . '-panel/'; $panelName = basename($resource); $controllerClassName = ucfirst($panelName) . 'PanelController'; // Checks if view file and definition exist if (!(include_once $panelHome . $controllerClassName . '.php')) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_FILE); } if (!class_exists($controllerClassName, true)) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_CLASS); } $controller = new $controllerClassName(\Innomatic\Core\InnomaticContainer::MODE_DOMAIN, $panelName); $this->container->setPanelController($controller); } else { switch ($desktopPanel) { case 'menu': include 'innomatic/desktop/layout/domain/' . $desktopPanel . '.php'; break; default: include $resource . '.php'; } } } else { if (strlen($this->session->get('INNOMATIC_AUTH_USER'))) { \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"'); include 'innomatic/desktop/layout/domain/index.php'; } } }
protected function generateSourceBegin() { $dashboard_id = ''; $prefs_id = ''; $container = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer'); // Check if Innomatic is in setup phase if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { // Check if Innomatic is in root or domain mode if (!$container->isDomainStarted()) { // Root mode $root_db = $container->getDataAccess(); $groups_query = $root_db->execute('SELECT * FROM root_panels_groups ORDER BY name'); $num_groups = $groups_query->getNumberRows(); $tabs = array(); $tab_pages = array(); if ($num_groups > 0) { $cont_a = 0; unset($el); while (!$groups_query->eof) { $group_apps = false; $group_data = $groups_query->getFields(); if (strlen($group_data['catalog'])) { $tmp_locale = new LocaleCatalog($group_data['catalog'], $container->getLanguage()); $el[$group_data['id']]['groupname'] = $tmp_locale->getStr($group_data['name']); } else { $el[$group_data['id']]['groupname'] = $group_data['name']; } $pagesquery = $root_db->execute('SELECT * FROM root_panels WHERE groupid=' . $group_data['id'] . ' ORDER BY name'); if ($pagesquery) { $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; $cont_b = 0; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); } $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); if (strlen($pagedata['themeicontype'])) { $imageType = $pagedata['themeicontype']; } else { $imageType = 'icons'; } strlen($pagedata['themeicon']) and isset($this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]) ? $imageUrl = $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['base'] . '/' . $imageType . '/' . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['file'] : ($imageUrl = $pagedata['iconfile']); $el[$group_data['id']]['groupelements'][$cont_b]['name'] = $descstr; $el[$group_data['id']]['groupelements'][$cont_b]['image'] = $imageUrl; $el[$group_data['id']]['groupelements'][$cont_b]['action'] = $tmp_eventscall->getEventsCallString(); $el[$group_data['id']]['groupelements'][$cont_b]['themesized'] = 'true'; unset($tmp_eventscall); $cont_b++; $pagesquery->moveNext(); } } } // TODO Check if this section is for compatibility only - and remove it if ($group_data['name'] == 'innomatic') { $pagesquery = $root_db->execute('SELECT * FROM root_panels WHERE groupid=0 OR groupid IS NULL ORDER BY name'); if ($pagesquery) { $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); } $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); $el[$group_data['id']]['groupelements'][$cont_b]['name'] = $descstr; $el[$group_data['id']]['groupelements'][$cont_b]['image'] = $pagedata['iconfile']; $el[$group_data['id']]['groupelements'][$cont_b]['action'] = $tmp_eventscall->getEventsCallString(); $el[$group_data['id']]['groupelements'][$cont_b]['themesized'] = 'true'; unset($tmp_eventscall); $cont_b++; $pagesquery->moveNext(); } } } } $groups_query->moveNext(); if ($group_apps) { $cont_a++; } else { unset($el[$group_data['id']]); } } } } else { // Domain mode $tmpperm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($container->getCurrentDomain()->getDataAccess(), $container->getCurrentUser()->getGroup()); $tabs = array(); $tab_pages = array(); $groupsquery = $container->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels_groups ORDER BY name'); $numgroups = $groupsquery->getNumberRows(); if ($numgroups > 0) { $prefs_id = 0; $tools_id = 0; $dashboard_id = 0; $cont = 0; unset($el); while (!$groupsquery->eof) { $group_apps = false; $groupdata = $groupsquery->getFields(); if ($tmpperm->check($groupdata['id'], 'group') != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { switch ($groupdata['name']) { case 'tools': $tools_id = $groupdata['id']; break; case 'preferences': $prefs_id = $groupdata['id']; break; case 'dashboard': $dashboard_id = $groupdata['id']; break; } if (strlen($groupdata['catalog']) > 0) { $tmploc = new LocaleCatalog($groupdata['catalog'], $container->getCurrentUser()->getLanguage()); $descstr = $tmploc->getStr($groupdata['name']); $el[$groupdata['id']]['groupname'] = $descstr; } else { $el[$group_data['id']]['groupname'] = $groupdata['name']; } $pagesquery = $container->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels WHERE groupid = ' . $groupdata['id'] . ' AND (hidden != ' . $container->getCurrentDomain()->getDataAccess()->formatText($container->getCurrentDomain()->getDataAccess()->fmttrue) . ' OR hidden IS NULL) ORDER BY name'); $pagesnum = $pagesquery->getNumberRows(); if ($pagesnum > 0) { $group_apps = true; $contb = 0; while (!$pagesquery->eof) { $pagedata = $pagesquery->getFields(); if ($tmpperm->check($pagedata['id'], 'page') != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { if (strlen($pagedata['catalog']) > 0) { $tmploc = new LocaleCatalog($pagedata['catalog'], $container->getCurrentUser()->getLanguage()); $descstr = $tmploc->getStr($pagedata['name']); $tmp_eventscall = new \Innomatic\Wui\Dispatch\WuiEventsCall($pagedata['name']); $tmp_eventscall->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('view', 'default', '')); if (strlen($pagedata['themeicontype'])) { $imageType = $pagedata['themeicontype']; } else { $imageType = 'apps'; } (strlen($pagedata['themeicon']) and isset($this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']])) ? $imageUrl = $this->mThemeHandler->mIconsBase . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['base'] . '/' . $imageType . '/' . $this->mThemeHandler->mIconsSet[$imageType][$pagedata['themeicon']]['file'] : ($imageUrl = $pagedata['iconfile']); $el[$groupdata['id']]['groupelements'][$contb]['name'] = $descstr; $el[$groupdata['id']]['groupelements'][$contb]['image'] = $imageUrl; $el[$groupdata['id']]['groupelements'][$contb]['action'] = $tmp_eventscall->getEventsCallString(); $el[$groupdata['id']]['groupelements'][$contb]['themesized'] = 'true'; unset($tmp_eventscall); } } $pagesquery->movenext(); $contb++; } } } // $cont++; if ($group_apps) { $cont++; } else { unset($el[$groupdata['id']]); } $groupsquery->movenext(); } //if ($prefs_id != 0) {} } } $menu = ''; // Dashboard is always the first menu if (isset($el[$dashboard_id])) { $menu .= '.|' . $el[$dashboard_id]['groupname'] . "\n"; foreach ($el[$dashboard_id]['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } // Build the menu list foreach ($el as $id => $group) { // Skip dashboard and preferences menu if ($id == $prefs_id or $id == $dashboard_id) { continue; } $menu .= '.|' . $group['groupname'] . "\n"; foreach ($group['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } // Preferences is always the last menu if (isset($el[$prefs_id])) { $menu .= '.|' . $el[$prefs_id]['groupname'] . "\n"; foreach ($el[$prefs_id]['groupelements'] as $panel) { $menu .= '..|' . $panel['name'] . '|' . $panel['action'] . "\n"; } } $registry = \Innomatic\Util\Registry::instance(); if (!$registry->isGlobalObject('singleton xlayersmenu')) { $mid = new \Innomatic\Wui\Widgets\Layersmenu\XLayersMenu(); $registry->setGlobalObject('singleton xlayersmenu', $mid); } else { $mid = $registry->getGlobalObject('singleton xlayersmenu'); } // Menu parameters $mid->libdir = $container->getHome() . 'core/lib/'; $mid->libwww = $container->getBaseUrl(false) . '/shared/'; $mid->tpldir = $container->getHome() . 'core/conf/layersmenu/'; $mid->imgdir = $this->mThemeHandler->mStyleDir; $mid->imgwww = $this->mThemeHandler->mStyleBase . $this->mThemeHandler->mStyleName . '/'; $mid->setMenuStructureString($menu); $mid->setDownArrowImg(basename($this->mThemeHandler->mStyle['arrowdownshadow'])); $mid->setForwardArrowImg(basename($this->mThemeHandler->mStyle['arrowrightshadow'])); $mid->parseStructureForMenu($this->mName); $mid->newHorizontalMenu($this->mName); } // User data if ($container->isDomainStarted()) { $user_data = $container->getCurrentUser()->getUserData(); $user_name = $user_data['fname'] . ' ' . $user_data['lname']; $domain_name = $container->getCurrentDomain()->domaindata['domainname']; $logout_events_call = new \Innomatic\Wui\Dispatch\WuiEventsCall(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath() . '/'); $innomatic_menu_locale = new LocaleCatalog('innomatic::domain_menu', $container->getCurrentUser()->getLanguage()); } else { // In root mode we show generic user data $user_name = 'root'; $domain_name = 'Innomatic'; $logout_events_call = new \Innomatic\Wui\Dispatch\WuiEventsCall(\Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getRequest()->getUrlPath() . '/root'); $innomatic_menu_locale = new LocaleCatalog('innomatic::root_menu', $container->getLanguage()); } $logout_events_call->addEvent(new \Innomatic\Wui\Dispatch\WuiEvent('login', 'logout', '')); // Check the environment type and set the title and the header bar color switch ($container->getEnvironment()) { case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_DEVELOPMENT: // Development environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_development') . ')'; $env_class = 'headerbar_dev'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_INTEGRATION: // Integration environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_integration') . ')'; $env_class = 'headerbar_integration'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_STAGING: // Staging environment $domain_name .= ' (' . $innomatic_menu_locale->getStr('environment_staging') . ')'; $env_class = 'headerbar_staging'; break; case \Innomatic\Core\InnomaticContainer::ENVIRONMENT_PRODUCTION: // Production environment $env_class = 'headerbar'; break; } // HTML $charset = 'UTF-8'; // $block = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n"; // $block = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' . "\n"; $block = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; $block .= "<html>\n"; $block .= "<head>\n"; // WUI javascript $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/wui.js"></script>' . "\n"; $block .= "<script language=\"JavaScript\" type=\"text/javascript\" src=\"" . $container->getBaseUrl(false) . '/shared/' . "layersmenu.js\"></script>\n"; // WUI style $block .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->mThemeHandler->mStyle['css'] . "\">\n"; // JQuery $block .= '<link href="' . $container->getBaseUrl(false) . '/shared/jquery/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet">' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery-1.9.1.js"></script>' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery-ui-1.10.3.custom.min.js"></script>' . "\n"; $block .= '<link href="' . $container->getBaseUrl(false) . '/shared/jquery/css/jquery_validation_errors.css" rel="stylesheet">' . "\n"; $block .= '<script language="JavaScript" type="text/javascript" src="' . $container->getBaseUrl(false) . '/shared/jquery/js/jquery.validate.js"></script>' . "\n"; // Favicon $block .= '<link rel="shortcut icon" href="' . $container->getBaseUrl(false) . '/favicon.png" type="image/png"/>' . "\n"; // PNG Behavior // @todo Consider removing support for PNG behavior $block .= "<style type=\"text/css\">\nimg {\nbehavior: url(\"" . $container->getBaseUrl(false) . '/shared/' . "pngbehavior.htc\");\n}\n</style>\n"; // Page title $block .= "<title>" . \Innomatic\Wui\Wui::utf8_entities($this->mArgs['title']) . "</title>\n"; // Optional inline javascript code $block .= (isset($this->mArgs['javascript']) and strlen($this->mArgs['javascript'])) ? "<script language=\"JavaScript\">\n<!--\n" . $this->mArgs['javascript'] . "\n//-->\n</script>\n" : ''; // Content type $block .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">' . "\n"; $block .= '<meta name="MSSmartTagsPreventParsing" content="true">' . "\n"; // Optional auto refresh if ($this->mArgs['refresh']) { $block .= '<meta http-equiv="refresh" content="' . $this->mArgs['refresh'] . '">' . "\n"; } $block .= "</head>\n"; $block .= '<body bgcolor="' . $this->mThemeHandler->mColorsSet['pages']['bgcolor'] . '"'; if (isset($this->mArgs['background']) and strlen($this->mArgs['background'])) { $block .= ' style="background-image: url(\'' . $this->mArgs['background'] . '\');'; if (isset($this->mArgs['horizbackground']) and $this->mArgs['horizbackground'] == 'true') { $block .= ' background-repeat: repeat-x;'; } $block .= '"'; } $block .= ">\n"; $block .= '<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="' . $this->mArgs['valign'] . '" align="' . $this->mArgs['align'] . '" style="height: 100%;">' . "\n"; if ($this->mArgs['border'] == 'true') { if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { $menu_header = (isset($GLOBALS['gEnv']['runtime']['wui_menu']['header']) ? '' : $mid->MakeHeader()) . $mid->getMenu($this->mName); $menu_footer = $mid->MakeFooter(); } else { $menu_header = $menu_footer = ''; } $block .= "<table class=\"page\" border=\"0\" style=\"border-bottom: 0px solid " . $this->mThemeHandler->mColorsSet['pages']['border'] . ";\" width=\"100%\" cellspacing=\"0\" cellpadding=\"10\">\n" . '<thead id="page-thead" class="page"><tr class="' . $env_class . '">' . "\n" . "<td style=\"width: 100%; align: center; padding-left: 16px;\" align=\"left\">" . "<a href=\"" . $container->getBaseUrl(false) . "\"><img src=\"" . $this->mThemeHandler->mStyle['titlelogo'] . "\" align=\"left\" width=\"25\" height=\"25\" style=\"margin-right: 15px;\" border=\"0\" alt=\"Innomatic\"></a>" . "<span nowrap class=\"headerbar\" style=\"white-space: nowrap;\">" . $domain_name . '</span></td>' . '<td align="right" valign="middle" nowrap style="white-space: nowrap; padding-right: 10px;">' . '<table border="0" style="margin: 0px; padding: 0px;" cellpadding="0" cellspacing="0"><tr>'; if (!($container->getState() == \Innomatic\Core\InnomaticContainer::STATE_SETUP)) { $block .= '<td><span class="headerbar" style="white-space: nowrap;">' . $user_name . "</span></td>"; if ($container->isDomainStarted() == true) { // Tray bar items $domain_da = $container->getCurrentDomain()->getDataAccess(); $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($domain_da, $container->getCurrentUser()->getGroup()); // Extract the list of all the tray bar items $traybar_items_query = $domain_da->execute('SELECT * FROM domain_traybar_items ORDER BY name'); while (!$traybar_items_query->eof) { $panel = $traybar_items_query->getFields('panel'); // Do not show traybar items tied to a panel when the panel is not accessible to the current user if (strlen($panel)) { $node_id = $perm->getNodeIdFromFileName($panel); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $traybar_items_query->moveNext(); continue; } } $class_name = $traybar_items_query->getFields('class'); if (class_exists($class_name)) { $traybar_item = new $class_name(); $traybar_item->prepare(); $block .= '<td style="padding-left: 15px;">' . $traybar_item->getHtml() . '</td>'; } $traybar_items_query->moveNext(); } } // Logout button $block .= '<td><a href="' . $logout_events_call->getEventsCallString() . '" alt="' . $innomatic_menu_locale->getStr('logout') . '"><img width="25" height="25" align="right" style="margin-left: 15px;" src="' . $this->mThemeHandler->mStyle['logout'] . '" alt="' . $innomatic_menu_locale->getStr('logout') . '" /></a></td>'; } // Menu and toolbar $block .= "</tr></table></td></tr>" . "<tr><td colspan=\"2\" style=\"border-bottom: 1px solid #cccccc; margin: 0px; padding: 0px; width: 100%; height: 45px; background-color: " . $this->mThemeHandler->mColorsSet['titlebars']['bgcolor'] . ";\" align=\"left\" valign=\"middle\" nowrap style=\"white-space: nowrap\">" . $menu_header . '</td></tr>' . "<tr><td id=\"sub-top-menu\" class=\"table-container\" colspan=\"2\" style=\"border-bottom: 1px solid #cccccc; margin: 0px; padding: 0px; height: 45px; background-color: white;\" align=\"left\" valign=\"middle\" nowrap style=\"white-space: nowrap\">" . "<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin: 0px; padding: 4px;\"><tr><td>{[wui-titlebar-title]}{[wui-toolbars]}" . '</tr></table></td></tr><tr>' . '</thead><tbody id="page-tbody" class="page">' . "<td valign=\"top\" colspan=\"2\" style=\"\">\n"; // @todo Refactor and remove the globals $GLOBALS['gEnv']['runtime']['wui_menu']['header'] = true; $GLOBALS['gEnv']['runtime']['wui_menu']['footer'] = $menu_footer; } return $block; }
/** * Gets the innowork items summary array. * * The summary is an array containing the main structure attribute of all * Innowork item types, like class, database table, and so on. * * @param string $showMode deprecated. * @param bool $complete Deprecated. * @param bool $tags Optional array of tags, if given only the item types * with the specified tags will be returned. * @access public * @return void */ public function getSummaries($showMode = '', $complete = false, $tags = array()) { $result = false; if ($this->container->getState() == InnomaticContainer::STATE_DEBUG) { $this->container->getLoadTimer()->Mark('start - InnoworkCore::GetSummaries()'); } $env_section = $showMode; if (count($tags) == 0 and isset($this->wholeSummaries[$env_section])) { $this->mSummaries = $this->wholeSummaries[$env_section]; $result = $this->wholeSummaries[$env_section]; } else { $enabledtypes_query = $this->mrDomainDA->execute('SELECT itemtype FROM innowork_core_itemtypes_enabled ORDER BY itemtype'); if (is_object($enabledtypes_query)) { $result = array(); $tmp_perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->mrDomainDA, $this->container->getCurrentUser()->getGroup()); while (!$enabledtypes_query->eof) { switch ($showMode) { case 'app': case 'list': $extra_conditions = ' AND showmode=' . $this->mrRootDb->formatText($showMode) . ' '; break; default: $extra_conditions = ''; } $itemtype_query = $this->mrRootDb->execute('SELECT classfile,classname,catalog,icon,icontype,domainpanel,adminevent,miniicon,summaryname,showmode FROM innowork_core_itemtypes WHERE itemtype=' . $this->mrRootDb->formatText($enabledtypes_query->getFields('itemtype')) . ' ' . $extra_conditions . 'ORDER BY itemtype'); if (is_object($itemtype_query) and $itemtype_query->getNumberRows()) { $node_id = $tmp_perm->getNodeIdFromFileName($itemtype_query->getFields('domainpanel')); if ($node_id or !strlen($itemtype_query->getFields('domainpanel'))) { if (!strlen($itemtype_query->getFields('domainpanel')) or $tmp_perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { require_once $itemtype_query->getFields('classfile'); $class_name = $itemtype_query->getFields('classname'); if (class_exists($class_name)) { $tmp_class = new $class_name($this->mrRootDb, $this->mrDomainDA); // Check if there is a filter by tags if (count($tags) == 0 or count(array_intersect($tmp_class->mTypeTags, $tags)) > 0) { $tmp_locale = new LocaleCatalog($itemtype_query->getFields('catalog'), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $item_type = $enabledtypes_query->getFields('itemtype'); $result[$item_type]['type'] = $item_type; $result[$item_type]['typeplural'] = $tmp_class->getItemTypePlural(); $result[$item_type]['classname'] = $itemtype_query->getFields('classname'); $result[$item_type]['catalog'] = $itemtype_query->getFields('catalog'); $result[$item_type]['label'] = $tmp_locale->getStr($itemtype_query->getFields('summaryname')); $result[$item_type]['icon'] = $itemtype_query->getFields('icon'); $result[$item_type]['icontype'] = $itemtype_query->getFields('icontype'); $result[$item_type]['domainpanel'] = $itemtype_query->getFields('domainpanel'); // @todo adminevent is old - change to panelevent $result[$item_type]['adminevent'] = $itemtype_query->getFields('adminevent'); $result[$item_type]['panelevent'] = $itemtype_query->getFields('adminevent'); $result[$item_type]['miniicon'] = $itemtype_query->getFields('miniicon'); $result[$item_type]['showmode'] = $itemtype_query->getFields('showmode'); $result[$item_type]['table'] = $tmp_class->mTable; $result[$item_type]['keys'] = $tmp_class->mKeys; $result[$item_type]['searchresultkeys'] = $tmp_class->mSearchResultKeys; $result[$item_type]['viewablesearchresultkeys'] = $tmp_class->mViewableSearchResultKeys; $result[$item_type]['searchorderby'] = $tmp_class->mSearchOrderBy; $result[$item_type]['tags'] = $tmp_class->mTypeTags; $result[$item_type]['showdispatcher'] = $tmp_class->mShowDispatcher; $result[$item_type]['showevent'] = $tmp_class->mShowEvent; $result[$item_type]['newdispatcher'] = $tmp_class->mNewDispatcher; $result[$item_type]['newevent'] = $tmp_class->mNewEvent; $result[$item_type]['searchable'] = $tmp_class->mSearchable; $result[$item_type]['convertible'] = $tmp_class->mConvertible; $result[$item_type]['loggable'] = !$tmp_class->mNoLog; $result[$item_type]['trashable'] = !$tmp_class->mNoTrash; //if ( !is_object( $result[$item_type]['widget'] ) ) unset( $result[$item_type] ); } } } } $itemtype_query->free(); } $enabledtypes_query->moveNext(); } $this->mSummaries = $result; if (count($tags) == 0) { $this->wholeSummaries[$env_section] = $this->mSummaries; } } $enabledtypes_query->free(); } if ($this->container->getState() == InnomaticContainer::STATE_DEBUG) { $this->container->getLoadTimer()->Mark('end - InnoworkCore::GetSummaries()'); } return $result; }