* @copyright 1999-2014 Innomatic Company * @license http://www.innomatic.io/license/ New BSD License * @link http://www.innomatic.io * @since Class available since Release 5.0 */ // NOTE: This is an old-style panel code with a single file // acting as model, view and controller. use Innomatic\Core\InnomaticContainer; use Innomatic\Wui\Widgets; use Innomatic\Wui\Dispatch; use Innomatic\Locale\LocaleCatalog; use Innomatic\Domain\User; use Shared\Wui; global $wuiMainStatus, $wuiMainFrame, $innomaticLocale, $wuiTitleBar; $log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger(); $innomaticLocale = new LocaleCatalog('innomatic::domain_password', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $wui = \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui'); $wui->loadWidget('button'); $wui->loadWidget('checkbox'); $wui->loadWidget('combobox'); $wui->loadWidget('date'); $wui->loadWidget('empty'); $wui->loadWidget('file'); $wui->loadWidget('formarg'); $wui->loadWidget('form'); $wui->loadWidget('grid'); $wui->loadWidget('helpnode'); $wui->loadWidget('horizbar'); $wui->loadWidget('horizframe'); $wui->loadWidget('horizgroup'); $wui->loadWidget('image');
public function viewDefault($eventData) { $def_width = 380; $def_height = 250; $widgets = $this->getController()->getWidgetsList(); $widget_counter = 0; $columns = 3; $start_column = true; $end_column = false; $rows_per_column = floor(count($widgets) / $columns) + (count($widgets) % $columns > 0 ? 1 : 0); $wui_xml = '<horizgroup><children>'; foreach ($widgets as $widget) { $width = 0; $height = 0; $class = $widget['class']; // Check if the class exists if (class_exists($class, true)) { // Fetch the widget xml definition $widget_obj = new $class(); // Check if the widget is visible if (!$widget_obj->isVisible()) { continue; } $width = $widget_obj->getWidth() * $def_width; $height = $widget_obj->getHeight(); } else { continue; } // If this is the start of a column, add the vertical group opener if ($start_column) { $wui_xml .= '<vertgroup><children>'; $start_column = false; } // Add ajax setup call \Innomatic\Wui\Wui::instance('\\Innomatic\\Wui\\Wui')->registerAjaxSetupCall('xajax_GetDashboardWidget(\'' . $widget['name'] . '\')'); // Check width and height parameters if ($width == 0) { $width = $def_width; } if ($height == 0) { $height = $def_height; } // Widget title $widget_locale = new LocaleCatalog($widget['catalog'], $this->container->getCurrentUser()->getLanguage()); $headers = array(); $headers[0]['label'] = $widget_locale->getStr($widget['title']); // Draw the widget $wui_xml .= '<table halign="left" valign="top"><args><headers type="array">' . WuiXml::encode($headers) . '</headers></args><children><vertgroup row="0" col="0" halign="left" valign="top"><args><width>' . $width . '</width><height>' . $height . '</height><groupvalign>top</groupvalign></args><children><divframe><args><id>widget_' . $widget['name'] . '</id><width>300</width></args><children><void/></children></divframe></children></vertgroup></children></table>'; $widget_counter++; // Check if this last widget for each column if ($widget_counter % $rows_per_column == 0) { $end_column = true; } // If this is the last widget, end the column anyway if ($widget_counter == count($widgets)) { $end_column = true; } // If this the end of a column, close the vertical group if ($end_column) { $wui_xml .= '</children></vertgroup>'; $start_column = true; $end_column = false; } } $wui_xml .= '</children></horizgroup>'; $this->wuiMainframe->addChild(new WuiXml('', array('definition' => $wui_xml))); }
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; }
public function viewEditprofile($eventData) { $profQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_users_groups WHERE id=' . $eventData['profileid']); $profData = $profQuery->getFields(); $groupsQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels_groups ORDER BY name'); if ($groupsQuery->getNumberRows()) { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess(), $eventData['profileid']); $row = 0; $headers[0]['label'] = ''; $headers[1]['label'] = $this->localeCatalog->getStr('domaingroup_header'); $headers[2]['label'] = ''; $headers[3]['label'] = $this->localeCatalog->getStr('domainpanel_header'); $wuiGroupsTable = new WuiTable('groupsstable', array('headers' => $headers)); while (!$groupsQuery->eof) { $groupData = $groupsQuery->getFields(); $tempLocale = new LocaleCatalog($groupData['catalog'], \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $nodeState = $perm->Check($groupData['id'], \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_GROUP); switch ($nodeState) { case \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_FULLYENABLED: $icon = $this->wuiMainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_PARTIALLYENABLED: $icon = $this->wuiMainframe->mThemeHandler->mStyle['goldball']; $enabled = true; break; case \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED: $icon = $this->wuiMainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $wuiGroupsTable->addChild(new WuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 0); $wuiGroupsTable->addChild(new WuiLabel('grouplabel' . $row, array('label' => $tempLocale->getStr($groupData['name']))), $row, 1); $wuiGroupToolbar[$row] = new WuiHorizgroup('grouptoolbar' . $row); if ($enabled) { $disableAction[$row] = new WuiEventsCall(); $disableAction[$row]->addEvent(new WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $disableAction[$row]->addEvent(new WuiEvent('action', 'disablenode', array('ntype' => \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_GROUP, 'node' => $groupData['id'], 'gid' => $eventData['profileid']))); $wuiDisableButton[$row] = new WuiButton('disablebutton' . $row, array(label => $this->localeCatalog->getStr('disablenode_label'), 'themeimage' => 'lock', 'themeimagetype' => 'mini', 'horiz' => 'true', 'action' => $disableAction[$row]->getEventsCallString())); $wuiGroupToolbar[$row]->addChild($wuiDisableButton[$row]); } if (!$enabled or $nodeState == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_PARTIALLYENABLED) { $enableAction[$row] = new WuiEventsCall(); $enableAction[$row]->addEvent(new WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $enableAction[$row]->addEvent(new WuiEvent('action', 'enablenode', array('ntype' => \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_GROUP, 'node' => $groupData['id'], 'gid' => $eventData['profileid']))); $wuiEnableButton[$row] = new WuiButton('enablebutton' . $row, array(label => $this->localeCatalog->getStr('enablenode_label'), 'themeimage' => 'unlock', 'themeimagetype' => 'mini', 'horiz' => 'true', 'action' => $enableAction[$row]->getEventsCallString())); $wuiGroupToolbar[$row]->addChild($wuiEnableButton[$row]); } $wuiGroupsTable->addChild($wuiGroupToolbar[$row], $row, 4); $row++; $pagesQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()->execute('SELECT * FROM domain_panels WHERE groupid=' . $groupData['id'] . ' AND (hidden != ' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()->formatText(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()->fmttrue) . ' OR hidden IS NULL) ORDER BY name'); while (!$pagesQuery->eof) { $pageData = $pagesQuery->getFields(); $tempLocale = new LocaleCatalog($pageData['catalog'], \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $nodeState = $perm->Check($pageData['id'], 'page'); switch ($nodeState) { case \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_FULLYENABLED: $icon = $this->wuiMainframe->mThemeHandler->mStyle['greenball']; $enabled = true; break; case \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED: $icon = $this->wuiMainframe->mThemeHandler->mStyle['redball']; $enabled = false; break; } $wuiGroupsTable->addChild(new WuiImage('statusimage' . $row, array('imageurl' => $icon)), $row, 2); $wuiGroupsTable->addChild(new WuiLabel('methodlabel' . $row, array('label' => $tempLocale->getStr($pageData['name']))), $row, 3); $wuiPageToolbar[$row] = new WuiHorizgroup('pagetoolbar' . $row); if ($enabled) { $disableAction[$row] = new WuiEventsCall(); $disableAction[$row]->addEvent(new WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $disableAction[$row]->addEvent(new WuiEvent('action', 'disablenode', array('ntype' => \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE, 'node' => $pageData['id'], 'gid' => $eventData['profileid']))); $wuiDisableButton[$row] = new WuiButton('disablebutton' . $row, array(label => $this->localeCatalog->getStr('disablenode_label'), 'themeimage' => 'lock', 'themeimagetype' => 'mini', 'horiz' => 'true', 'action' => $disableAction[$row]->getEventsCallString())); $wuiPageToolbar[$row]->addChild($wuiDisableButton[$row]); } else { $enableAction[$row] = new WuiEventsCall(); $enableAction[$row]->addEvent(new WuiEvent('view', 'editprofile', array('profileid' => $eventData['profileid']))); $enableAction[$row]->addEvent(new WuiEvent('action', 'enablenode', array('ntype' => \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE, 'node' => $pageData['id'], 'gid' => $eventData['profileid']))); $wuiEnableButton[$row] = new WuiButton('enablebutton' . $row, array(label => $this->localeCatalog->getStr('enablenode_label'), 'themeimage' => 'unlock', 'themeimagetype' => 'mini', 'horiz' => 'true', 'action' => $enableAction[$row]->getEventsCallString())); $wuiPageToolbar[$row]->addChild($wuiEnableButton[$row]); } $wuiGroupsTable->addChild($wuiPageToolbar[$row], $row, 4); $row++; $pagesQuery->moveNext(); } $groupsQuery->moveNext(); } $this->wuiMainframe->addChild($wuiGroupsTable); } $this->wuiTitlebar->mTitle .= ' - ' . $profData['groupname'] . ' - ' . $this->localeCatalog->getStr('editprofile_title'); }
public function viewlanguage($eventData) { $actionDispatcher = new WuiDispatcher('action'); $locCountry = new LocaleCountry(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getCountry()); $countryLanguage = $locCountry->Language(); $languageLocale = new LocaleCatalog('innomatic::localization', \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage()); $selectedLanguage = $actionDispatcher->getEventData(); if (isset($selectedLanguage['language'])) { $selectedLanguage = $selectedLanguage['language']; } $wuiVGroup = new WuiVertgroup('vgroup'); $languageQuery = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT * FROM locale_languages'); while (!$languageQuery->eof) { $languages[$languageQuery->getFields('langshort')] = $languageLocale->getStr($languageQuery->getFields('langname')); $languageQuery->moveNext(); } $wuiLocaleGrid = new WuiGrid('localegrid', array('rows' => '1', 'cols' => '3')); $wuiLocaleGrid->addChild(new WuiLabel('languagelabel', array('label' => $this->localeCatalog->getStr('language_label'))), 0, 0); $wuiLocaleGrid->addChild(new WuiComboBox('language', array('disp' => 'action', 'elements' => $languages, 'default' => $selectedLanguage ? $selectedLanguage : \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentUser()->getLanguage())), 0, 1); $wuiLocaleGrid->addChild(new WuiSubmit('submit1', array('caption' => $this->localeCatalog->getStr('language_submit'))), 0, 2); $wuiVGroup->addChild($wuiLocaleGrid); $wuiVGroup->addChild(new WuiHorizBar('horizbar1')); $wuiVGroup->addChild(new WuiLabel('deflanglabel', array('label' => sprintf($this->localeCatalog->getStr('countrylanguage_label'), $languages[$countryLanguage])))); $formEventsCall = new WuiEventsCall(); $formEventsCall->addEvent(new WuiEvent('action', 'setlanguage', '')); $formEventsCall->addEvent(new WuiEvent('view', 'language', '')); $wuiForm = new WuiForm('languageform', array('action' => $formEventsCall->getEventsCallString())); $wuiForm->addChild($wuiVGroup); $this->wuiMainframe->addChild($wuiForm); $this->wuiTitlebar->mArgs['title'] .= ' - ' . $this->localeCatalog->getStr('language_title'); }