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 static function ajaxGetDashboardWidget($name) { $objResponse = new XajaxResponse(); $xml = \Innomatic\Desktop\Dashboard\WidgetHelper::getWidgetXml($name); // Create the widget html and send it to the dashboard $html = WuiXml::getContentFromXml('', $xml); $objResponse->addAssign('widget_' . $name, 'innerHTML', $html); return $objResponse; }
public static function ajaxSaveRolesPermissions($permissions) { // Build list of checked roles/permissions $permissions = explode(',', $permissions); $checkedPermissions = array(); foreach ($permissions as $id => $permission) { $permission = str_replace('cbrole_', '', $permission); list($roleId, $permissionId) = explode('-', $permission); $checkedPermissions[$roleId][$permissionId] = true; } // Get list of all roles and permissions $rolesList = \Innomatic\Domain\User\Role::getAllRoles(); $permissionsList = \Innomatic\Domain\User\Permission::getAllPermissions(); // Check which permissions have been checked foreach ($rolesList as $roleId => $roleData) { $role = new \Innomatic\Domain\User\Role($roleId); foreach ($permissionsList as $permissionId => $permissionData) { if (isset($checkedPermissions[$roleId][$permissionId])) { $role->assignPermission($permissionId); } else { $role->unassignPermission($permissionId); } } } $html = WuiXml::getContentFromXml('', \ProfilesPanelController::getRolesPermissionsXml()); $objResponse = new XajaxResponse(); $objResponse->addAssign("roleslist", "innerHTML", $html); return $objResponse; }