@DI\Observe("open_tool_workspace_claroline_team_tool")

@param DisplayToolEvent $event
484111
public function onWorkspaceToolOpen(DisplayToolEvent $event)
    {
        $workspace = $event->getWorkspace();
        $teamParams = $this->teamManager->getWorkspaceTeamParameters($workspace);
        $canEdit = $this->authorization->isGranted(['claroline_team_tool', 'edit'], $workspace);
        $resouceTypes = $this->resourceTypeRepo->findBy(['isEnabled' => true]);
        $user = $this->tokenStorage->getToken()->getUser();
        $myTeams = 'anon.' !== $user ?
            $this->teamManager->getTeamsByUserAndWorkspace($user, $workspace) :
            [];
        $content = $this->templating->render(
            'ClarolineTeamBundle:team:tool.html.twig', [
                'workspace' => $workspace,
                'teamParams' => $teamParams,
                'canEdit' => $canEdit,
                'myTeams' => array_map(function (Team $team) {
                    return $team->getUuid();
                }, $myTeams),
                'resourceTypes' => array_map(function (ResourceType $resourceType) {
                    return $resourceType->getName();
                }, $resouceTypes),
            ]
        );
        $event->setContent($content);
        $event->stopPropagation();
    }
607965
public function onDisplayTool(OpenAdministrationToolEvent $event)
    {
        $content = $this->templating->render(
            'ClarolineCoreBundle:administration:parameters.html.twig', [
                'context' => [
                    'type' => Tool::ADMINISTRATION,
                ],
                'parameters' => $this->serializer->serialize(),
                'availableLocales' => array_keys($this->localeManager->getImplementedLocales()),
            ]
        );

        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
283824
public function onVisitNode(VisitNodeEvent $event)
    {
        // any search?
        if (!$event->getNode() instanceof SearchNode || $event->getNode()->isVisited()) {
            return $event;
        }

        $this->node = $event->getNode();
        $this->builder = $event->getBuilder();
        $this->expr = $event->isExpr();
        $this->className = $event->getClassName();

        // which mode?
        if ($this->getSearchMode() === self::SEARCHMODE_SOLR) {
            $this->handleSearchSolr();
        } else {
            $this->handleSearchMongo();
        }

        $event->setBuilder($this->builder);
        $event->setNode($this->node);
        $event->setExprNode($this->exprNode);

        return $event;
    }
766035
public function toggleVisibility(ProductToggleVisibilityEvent $event)
    {
        $product = $event->getProduct();

        $product
            ->setDispatcher($this->eventDispatcher)
            ->setVisible($product->getVisible() ? false : true)
            ->save()
            ;

        $event->setProduct($product);
    }
110431
public function onVisitNode(VisitNodeEvent $event)
    {
        if ($this->isOurNode($event->getNode())) {
            return $event;
        }

        $this->node = $event->getNode();
        $this->builder = $event->getBuilder();
        $this->className = $event->getClassName();

        if ($this->node instanceof AbstractScalarOperatorNode && $this->isTranslatableFieldNode()) {
            $alteredNode = $this->getAlteredQueryNode(
                $this->getDocumentFieldName(),
                $this->getAllPossibleTranslatableStrings()
            );

            if (!empty($alteredNode->getQueries())) {
                $event->setNode($alteredNode);
            }
        }

        return $event;
    }
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();
    }
283614
public function onDisplayWorkspaceResourceManager(DisplayToolEvent $event)
    {
        $event->setContent($this->resourceWorkspace($event->getWorkspace()->getId()));
    }
698955
public function onDisplayDesktop(DisplayToolEvent $event)
    {
        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:resources.html.twig', [
                'context' => [
                    'type' => Widget::CONTEXT_DESKTOP,
                ],
                'root' => null,
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
525505
public function onProductShow(ResourceControllerEvent $event): void
    {
        $product = $event->getSubject();
        if (!$product instanceof ProductInterface) {
            return;
        }

        $currentRequest = $this->requestStack->getCurrentRequest();
        if ($currentRequest instanceof Request) {
            $currentRequest->attributes->set('nglayouts_sylius_product', $product);
            // We set context here instead in a ContextProvider, since sylius.product.show
            // event happens too late, after onKernelRequest event has already been executed
            $this->context->set('sylius_product_id', (int) $product->getId());
        }
    }
314642
public function onOpenLearningObjectivesTool(OpenAdministrationToolEvent $event)
    {
        $competenciesTool = $this->toolManager->getAdminToolByName('competencies');

        if (is_null($competenciesTool) || !$this->authorization->isGranted('OPEN', $competenciesTool)) {
            throw new AccessDeniedException();
        }
        $this->competencyManager->ensureHasScale();
        $content = $this->templating->render('HeVinciCompetencyBundle:objective:layout.html.twig');
        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
70025
public function open(OpenResourceEvent $event)
    {
        $text = $event->getResource();
        $content = $this->templating->render(
            'ClarolineCoreBundle:text:index.html.twig',
            [
                'text' => $text,
                '_resource' => $text,
            ]
        );

        $event->setResponse(new Response($content));
        $event->stopPropagation();
    }
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();
    }
933469
public function onDisplayWorkspace(DisplayToolEvent $event)
    {
        $orderedTabs = [];
        $workspace = $event->getWorkspace();

        $tabs = $this->finder->search(HomeTab::class, [
            'filters' => ['workspace' => $workspace->getUuid()],
        ]);

        // but why ? finder should never give you an empty row
        $tabs = array_filter($tabs['data'], function ($data) {
            return $data !== [];
        });

        foreach ($tabs as $tab) {
            $orderedTabs[$tab['position']] = $tab;
        }
        ksort($orderedTabs);

        $content = $this->templating->render(
            'ClarolineCoreBundle:tool:home.html.twig', [
                'workspace' => $workspace,
                'editable' => $this->authorization->isGranted(['home', 'edit'], $workspace),
                'context' => [
                    'type' => Widget::CONTEXT_WORKSPACE,
                    'data' => $this->serializer->serialize($workspace),
                ],
                'tabs' => array_values($orderedTabs),
            ]
        );

        $event->setContent($content);
        $event->stopPropagation();
    }
352185
public function onPrepareWorkspaceConstructWorkspaceInstance(WorkspaceEvent $event, $eventName, EventDispatcherInterface $eventDispatcher)
    {
        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Creating Workspace.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_IN_PROGRESS)));

        $workspace = new Workspace($event->getHost());
        $workspace->setReleasesDirectory($this->releasesDirectory);
        $workspace->setDataDirectory($this->dataDirectory);
        $workspace->setCacheDirectory($this->cacheDirectory);
        $workspace->setOtherDirectories($this->otherDirectories);

        $event->setWorkspace($workspace);

        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Created Workspace.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_COMPLETED, 'output.resetLine' => true)));
    }
883374
public function onToolOpen(DisplayToolEvent $event)
    {
        // Get media center user from database
        $loggedUser = $this->container->get('security.token_storage')->getToken()->getUser();
        try {
            $mediacenter = $this->getMediacenterManager()->getMediacenter();
            $mediacenterUserManager = $this->getMediacenterUserManager();
            $token = $mediacenterUserManager->getMediacenterUserToken($loggedUser, $mediacenter);
            $mediacener_portal = $mediacenter->getUrl().'?userName='.$loggedUser->getUsername().'&token='.$token;
            $content = new RedirectResponse($mediacener_portal);
        } catch (NoMediacenterException $nme) {
            $content = $this->templating->render('IcapInwicastBundle:MediaCenter:error.html.twig');
        }

        // Return view to event (Claroline specification)
        $event->setContent($content);
        $event->stopPropagation();
    }
761546
public function onDesktopOpen(DisplayToolEvent $event)
    {
        $content = $this->templating->render(
            'ClarolineDashboardBundle:tool:dashboards.html.twig',
            []
        );
        $event->setContent($content);
    }
129987
public function openWorkspaceToolConfig(Workspace $workspace, Tool $tool)
    {
        $this->checkAccess($workspace);
        $event = $this->eventDispatcher->dispatch(
            strtolower('configure_workspace_tool_' . $tool->getName()),
            'ConfigureWorkspaceTool',
            array($tool, $workspace)
        );

        return new Response($event->getContent());
    }