@DI\Observe("open_tool_desktop_ujm_questions")

@param DisplayToolEvent $event
12251
public function onDisplayDesktop(DisplayToolEvent $event)
    {
        $content = $this->templating->render(
            'UJMExoBundle:tool:question_bank.html.twig', [
                'context' => [
                    'type' => Tool::DESKTOP,
                ],
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
935285
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $view = $event->getView();
        if (!$view instanceof BlockViewInterface) {
            return;
        }

        $block = $view->getBlock();
        $blockDefinition = $block->getDefinition();

        if (!$blockDefinition instanceof TwigBlockDefinitionInterface) {
            return;
        }

        $twigContent = $this->getTwigBlockContent(
            $blockDefinition,
            $block,
            $view->getParameters()
        );

        $event->addParameter('twig_content', $twigContent);
    }
1156793
public function handleForItemRendering(ParseItemEvent $event): void
    {
        $settings = $event->getRenderSettings();
        if (!$settings->get(self::FRONTEND_EDITING_ENABLED_FLAG)) {
            return;
        }

        $parsed          = $event->getResult();
        $item            = $event->getItem();
        $tableName       = $item->getMetaModel()->getTableName();
        $definition      = $this->frontendEditor->createDcGeneral($tableName)->getDataDefinition();
        $basicDefinition = $definition->getBasicDefinition();
        $editingPage     = $settings->get(self::FRONTEND_EDITING_PAGE);
        $modelId         = ModelId::fromValues($tableName, $item->get('id'))->getSerialized();

        // Add edit action
        if ($basicDefinition->isEditable()) {
            $parsed['actions']['edit'] = [
                'label' => $this->translateLabel('metamodel_edit_item', $definition->getName()),
                'href'  => $this->generateEditUrl($editingPage, $modelId),
                'class' => 'edit',
            ];
        }

        // Add copy action
        if ($basicDefinition->isCreatable()) {
            $parsed['actions']['copy'] = [
                'label' => $this->translateLabel('metamodel_copy_item', $definition->getName()),
                'href'  => $this->generateCopyUrl($editingPage, $modelId),
                'class' => 'copy',
            ];
        }

        // Add create variant action
        if (false === $item->isVariant() && $basicDefinition->isCreatable() && $item->getMetaModel()->hasVariants()) {
            $parsed['actions']['createvariant'] = [
                'label' => $this->translateLabel('metamodel_create_variant', $definition->getName()),
                'href'  => $this->generateCreateVariantUrl($editingPage, $modelId),
                'class' => 'createvariant',
            ];
        }

        // Add delete action
        if ($basicDefinition->isDeletable()) {
            $parsed['actions']['delete'] = [
                'label'     => $this->translateLabel('metamodel_delete_item', $definition->getName()),
                'href'      => $this->generateDeleteUrl($editingPage, $modelId),
                'attribute' => sprintf(
                    'onclick="if (!confirm(\'%s\')) return false;"',
                    $this->translator->trans('MSC.deleteConfirm', [$item->get('id')], 'contao_default')
                ),
                'class'     => 'delete',
            ];
        }

        $event->setResult($parsed);
    }
313043
public function onDisplayWorkspace(DisplayToolEvent $event)
    {
        $workspace = $event->getWorkspace();

        $content = $this->templating->render(
            'ClarolineCoreBundle:workspace:analytics.html.twig', [
                'workspace' => $workspace,
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
658764
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $attributes = $event->getRequest()->attributes;
        if ($attributes->get(SetIsApiRequestListener::API_FLAG_NAME) !== true) {
            return;
        }

        if (!$attributes->has('itemType')) {
            return;
        }

        $backend = $this->backendRegistry->getBackend($attributes->get('itemType'));
        $this->container->set('netgen_content_browser.current_backend', $backend);
    }
1275604
public function onDisplayDesktopContactTool(DisplayToolEvent $event)
    {
        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:contacts.html.twig', [
                'options' => $this->contactManager->getUserOptions(
                    $this->tokenStorage->getToken()->getUser()
                ),
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
34898
public function onDisplayTool(OpenAdministrationToolEvent $event)
    {
        $workspaceTools = $this->toolManager->getAvailableWorkspaceTools();

        $content = $this->templating->render(
            'ClarolineCoreBundle:administration:workspaces.html.twig',
            [
                'parameters' => $this->parametersSerializer->serialize(),
                'tools' => array_map(function (Tool $tool) {
                    return ['name' => $tool->getName()];
                }, $workspaceTools),
                'models' => $this->finder->search(
                    Workspace::class,
                    ['filters' => ['model' => true]],
                    [Options::SERIALIZE_MINIMAL]
                ),
            ]
        );

        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
761546
public function onDesktopOpen(DisplayToolEvent $event)
    {
        $content = $this->templating->render(
            'ClarolineDashboardBundle:tool:dashboards.html.twig',
            []
        );
        $event->setContent($content);
    }
85211
public function setEvent($event)
  {
    if ($event === '?' || $event === '') {
      $this->event = null;
    } else {
      $event = Util::foreignLettersToEnglishLetters($event);
      $event = Util::titleCaseIfCurrentlyAllCaps($event);
      $this->event = $event === '?' ? null : $event;
    }
  }
298403
public function onRenderView(CollectViewParametersEvent $event): void
    {
        $currentRequest = $this->requestStack->getCurrentRequest();
        if (!$currentRequest instanceof Request) {
            return;
        }

        $view = $event->getView();
        if (!$view instanceof BlockViewInterface || !$view->hasParameter('collection_identifier')) {
            return;
        }

        if (!in_array($view->getContext(), $this->enabledContexts, true)) {
            return;
        }

        $block = $view->getBlock();

        $collectionIdentifier = $view->getParameter('collection_identifier');

        $resultPager = $this->pagerFactory->getPager(
            $block->getCollection($collectionIdentifier),
            $currentRequest->query->getInt('page', 1),
            $this->getMaxPages($block)
        );

        $event->addParameter('collection', $resultPager->getCurrentPageResults());
        $event->addParameter('pager', $resultPager);
    }
189665
public function onDisplayDesktop(DisplayToolEvent $event)
    {
        $currentUser = $this->tokenStorage->getToken()->getUser();

        $allTabs = $this->finder->search(HomeTab::class, [
            'filters' => ['user' => $currentUser->getUuid()],
        ]);

        // Order tabs. We want :
        //   - Administration tabs to be at first
        //   - Tabs to be ordered by position
        // For this, we separate administration tabs and user ones, order them by position
        // and then concat all tabs with admin in first (I don't have a easier solution to achieve this)

        $adminTabs = [];
        $userTabs = [];
        foreach ($allTabs['data'] as $tab) {
            if (!empty($tab)) {
                // we use the define position for array keys for easier sort
                if (HomeTab::TYPE_ADMIN_DESKTOP === $tab['type']) {
                    $adminTabs[$tab['position']] = $tab;
                } else {
                    $userTabs[$tab['position']] = $tab;
                }
            }
        }

        // order tabs by position
        ksort($adminTabs);
        ksort($userTabs);

        // generate the final list of tabs
        $orderedTabs = array_merge(array_values($adminTabs), array_values($userTabs));

        // we rewrite tab position because an admin and a user tab may have the same position
        foreach ($orderedTabs as $index => &$tab) {
            $tab['position'] = $index;
        }

        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:home.html.twig', [
                'editable' => true,
                'context' => [
                    'type' => Widget::CONTEXT_DESKTOP,
                ],
                'tabs' => $orderedTabs,
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
23759
public function onDisplay(DisplayWidgetEvent $event)
    {
        $txtConfig = $this->simpleTextManager->getTextConfig($event->getInstance());
        if ($txtConfig) {
            $event->setContent($txtConfig->getContent());
        } else {
            $event->setContent('');
        }
        $event->stopPropagation();
    }
38274
public function onKernelRequest(GetResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            // don't do anything if it's not the master request
            return;
        }

        $request = $event->getRequest();

        $requestUri = $request->getRequestUri();

        $requestUriNew = preg_replace('/-{2,}/', '-', $requestUri);

        if ($requestUri !== $requestUriNew) {
            $event->setResponse(new RedirectResponse($requestUriNew, 301));
            $event->stopPropagation();
        }
    }
758770
public function addMessage(AddMessageEvent $event)
    {
        /** @var Message $messageAdapter */
        $messageAdapter = $this->framework->getAdapter(Message::class);

        $messageAdapter->add($event->getContent(), 'TL_' . strtoupper($event->getType()));
    }
137894
public function onDisplayTool(OpenAdministrationToolEvent $event)
    {
        $this->competencyManager->ensureHasScale();

        $content = $this->templating->render('HeVinciCompetencyBundle:administration:competencies.html.twig');

        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
1355965
public function init(MvcEvent $event): void
    {
        if (true === $this->tracyOptions->getEnabled()) {
            Debugger::enable($this->tracyOptions->getMode());

            if (null !== $this->tracyOptions->getEmail()) {
                Debugger::$email = $this->tracyOptions->getEmail();
            }

            if (null !== $this->tracyOptions->getLogDirectory()) {
                Debugger::$logDirectory = $this->tracyOptions->getLogDirectory();
            }

            if (null !== $this->tracyOptions->getLogSeverity()) {
                Debugger::$logSeverity = $this->tracyOptions->getLogSeverity();
            }

            if (null !== $this->tracyOptions->getMaxDepth()) {
                Debugger::$maxDepth = $this->tracyOptions->getMaxDepth();
            }

            if (null !== $this->tracyOptions->getMaxLength()) {
                Debugger::$maxLength = $this->tracyOptions->getMaxLength();
            }

            if (null !== $this->tracyOptions->getShowBar()) {
                Debugger::$showBar = $this->tracyOptions->getShowBar();
            }

            if (null !== $this->tracyOptions->getShowLocation()) {
                Debugger::$showLocation = $this->tracyOptions->getShowLocation();
            }

            if (null !== $this->tracyOptions->getStrict()) {
                Debugger::$strictMode = $this->tracyOptions->getStrict();
            }
        }
    }
1265373
public function getWidgets(Event $event): void
    {
        $result = array_merge(
            (array)$event->result,
            $this->getSavedSearchWidgets(),
            $this->getReportWidgets(),
            $this->getAppWidgets()
        );

        $event->result = array_filter($result);
    }