*/ class Home extends tao_actions_CommonModule { /** This action renders the template used by the splash screen popup */ public function splash(): void { // The list of extensions the splash provides an explanation for. $defaultExtIds = ['items', 'tests', 'TestTaker', 'groups', 'delivery', 'results']; // Check if the user is a noob $this->setData('firstTime', TaoCe::isFirstTimeInTao()); // Load the extension data $defaultExtensions = []; $additionalExtensions = []; /** @var Perspective $perspective */ foreach (MenuService::getPerspectivesByGroup(Perspective::GROUP_DEFAULT) as $perspective) { $perspectiveId = (string) $perspective->getId(); $extensionInfo = [ 'id' => $perspectiveId, 'name' => $perspective->getName(), 'extension' => $perspective->getExtension(), 'enabled' => $this->hasAccessForAtLeastOneChild($perspective), ]; if (in_array($perspectiveId, $defaultExtIds, true)) { $extensionInfo['description'] = $perspective->getDescription(); $defaultExtensions[$perspectiveId] = $extensionInfo; } else { $additionalExtensions[$perspectiveId] = $extensionInfo; } } $this->setData('extensions', array_merge($defaultExtensions, $additionalExtensions)); $this->setData('defaultExtensions', $defaultExtensions); $this->setData('additionalExtensions', $additionalExtensions); $this->setView('splash.tpl'); } private function hasAccessForAtLeastOneChild(Perspective $perspective): bool { foreach ($perspective->getChildren() as $section) { $hasAccess = tao_models_classes_accessControl_AclProxy::hasAccess( $section->getAction(), $section->getController(), $section->getExtensionId() ); if ($hasAccess) { return true; } } return false; } }