/**
  * @DI\Observe("widget_hevinci_favourite_widget")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $favourites = $this->om->getRepository('HeVinciFavouriteBundle:Favourite')->findBy(array('user' => $this->tokenStorage->getToken()->getUser()));
     $content = $this->templatingEngine->render('HeVinciFavouriteBundle:widget:favourite.html.twig', array('favourites' => $favourites));
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * Listener to the widget display
  *
  * @DI\Observe("widget_exo_stat")
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $widgetInstance = $event->getInstance();
     $params = array();
     $params['_controller'] = 'CPASimUSanteExoverrideBundle:ExoverrideWidget:userStatDisplay';
     $params['widgetInstance'] = $widgetInstance->getId();
     $this->redirect($params, $event);
 }
 /**
  * @DI\Observe("widget_my_workspaces")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     if (!$this->authorization->isGranted('ROLE_USER')) {
         throw new AccessDeniedException();
     }
     $content = $this->templating->render('ClarolineCoreBundle:Widget:desktopWidgetMyWorkspaces.html.twig', array());
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_innova_path_widget")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $widgetInstance = $event->getInstance();
     $workspace = $widgetInstance->getWorkspace();
     $config = $this->pathManager->getWidgetConfig($widgetInstance);
     $content = $this->twig->render('InnovaPathBundle:Widget:list.html.twig', ['workspace' => $workspace, 'isDesktop' => $widgetInstance->isDesktop(), 'paths' => $this->pathManager->getWidgetPaths($config, $workspace)]);
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_simple_text")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $txtConfig = $this->simpleTextManager->getTextConfig($event->getInstance());
     if ($txtConfig) {
         $event->setContent($txtConfig->getContent());
     } else {
         $event->setContent('');
     }
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_core_resource_logger")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $instance = $event->getInstance();
     $params = $instance->isDesktop() ? $this->logManager->getDesktopWidgetList($instance) : $this->logManager->getWorkspaceWidgetList($instance);
     $view = $this->twig->render('ClarolineCoreBundle:Log:no_action_found.html.twig', array());
     if ($params && count($params['logs']) > 0) {
         $view = $this->twig->render('ClarolineCoreBundle:Log:view_short_list.html.twig', $params);
     }
     $event->setContent($view);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_claroline_tag_resources_widget")
  *
  * @param DisplayWidgetEvent $event
  * @throws \Claroline\CoreBundle\Listener\NoHttpRequestException
  */
 public function onResourcesTagsWidgetDisplay(DisplayWidgetEvent $event)
 {
     if (!$this->request) {
         throw new NoHttpRequestException();
     }
     $widgetInstance = $event->getInstance();
     $params = array();
     $params['_controller'] = 'ClarolineTagBundle:Tag:resourcesTagsWidget';
     $params['widgetInstance'] = $widgetInstance->getId();
     $subRequest = $this->request->duplicate(array(), null, $params);
     $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $event->setContent($response->getContent());
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_hevinci_favourite_widget")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $widgetInstance = $event->getInstance();
     $workspace = $widgetInstance->getWorkspace();
     $user = $this->tokenStorage->getToken()->getUser();
     $isAnon = $user === 'anon.';
     $favourites = [];
     if (!$isAnon) {
         $favouriteRepo = $this->om->getRepository('HeVinciFavouriteBundle:Favourite');
         $favourites = is_null($workspace) ? $favouriteRepo->findBy(['user' => $user]) : $favouriteRepo->findFavouritesByUserAndWorkspace($user, $workspace);
     }
     $content = $this->templatingEngine->render('HeVinciFavouriteBundle:widget:favourite.html.twig', ['favourites' => $favourites]);
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_claroline_forum_widget")
  *
  * @param DisplayWidgetEvent $event
  *
  * @throws \Claroline\CoreBundle\Listener\NoHttpRequestException
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     if (!$this->request) {
         throw new NoHttpRequestException();
     }
     $widgetInstance = $event->getInstance();
     $workspace = $widgetInstance->getWorkspace();
     if ($workspace == null) {
         $templatePath = 'ClarolineForumBundle:Forum:forumsDesktopWidget.html.twig';
         $widgetType = 'desktop';
     } else {
         $templatePath = 'ClarolineForumBundle:Forum:forumsWorkspaceWidget.html.twig';
         $widgetType = 'workspace';
     }
     $messages = $this->forumManager->getLastMessages($widgetInstance);
     $event->setContent($this->templatingEngine->render($templatePath, array('widgetType' => $widgetType, 'messages' => $messages)));
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_innova_path_widget")
  *
  * @param DisplayWidgetEvent $event
  * @throws \Claroline\CoreBundle\Listener\NoHttpRequestException
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     if (!$this->request) {
         throw new NoHttpRequestException();
     }
     $widgetInstance = $event->getInstance();
     $workspace = $widgetInstance->getWorkspace();
     $params = array();
     if (is_null($workspace)) {
         $params['_controller'] = 'InnovaPathBundle:Widget\\MyPaths:pathsDesktopWidget';
     } else {
         $params['_controller'] = 'InnovaPathBundle:Widget\\MyPaths:pathsWorkspaceWidget';
         $params['workspaceId'] = $workspace->getId();
     }
     $subRequest = $this->request->duplicate(array(), null, $params);
     $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $event->setContent($response->getContent());
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_inwicast_claroline_plugin")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     // Get the Media entity from event
     $widgetInstance = $event->getInstance();
     $mediaManager = $this->getMediaManager();
     $media = $mediaManager->getByWidget($widgetInstance);
     if (!empty($media)) {
         try {
             $mediacenter = $this->getMediacenterManager()->getMediacenter();
             //$loggedUser = $this->container->get("security.context")->getToken()->getUser();
             //$media = $mediaManager->getMediaInfo($media, $mediacenter, $loggedUser);
             // Get video player
             $event->setContent($this->templating->render('InwicastClarolinePluginBundle:Media:view.html.twig', array('media' => $media, 'mediacenter' => $mediacenter)));
         } catch (NoMediacenterException $nme) {
             $event->setContent($this->templating->render('InwicastClarolinePluginBundle:Mediacenter:error.html.twig'));
         }
     } else {
         $event->setContent($this->templating->render('InwicastClarolinePluginBundle:Media:noMedia.html.twig'));
     }
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_my_workspaces")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $token = $this->tokenStorage->getToken();
     $user = $token->getUser();
     $isAnon = $user === 'anon.';
     $widgetInstance = $event->getInstance();
     $mode = 0;
     $workspaces = [];
     $instanceTemplate = $widgetInstance->getTemplate();
     $template = is_null($instanceTemplate) ? 'ClarolineCoreBundle:Widget:desktopWidgetMyWorkspaces.html.twig' : $instanceTemplate;
     if (!$isAnon) {
         $workspaces = $this->workspaceManager->getFavouriteWorkspacesByUser($user);
         if (count($workspaces) > 0) {
             $mode = 1;
         } else {
             $roles = $this->utils->getRoles($token);
             $datas = $this->workspaceTagManager->getDatasForWorkspaceListByUser($user, $roles);
             $workspaces = $datas['workspaces'];
         }
     }
     $content = $this->templating->render($template, ['workspaces' => $workspaces, 'mode' => $mode, 'widgetInstance' => $widgetInstance, 'isAnon' => $isAnon]);
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_badge_usage")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $widgetInstance = $event->getInstance();
     $workspace = $widgetInstance->getWorkspace();
     $user = $this->tokenStorage->getToken()->getUser();
     $badgeWidgetConfig = $this->badgeWidgetManager->getBadgeUsageConfigForInstance($widgetInstance);
     $simple_view_widget = $badgeWidgetConfig->isSimpleView();
     $nbLastAwarded = $badgeWidgetConfig->getNumberLastAwardedBadge();
     $nbMostAwarded = $badgeWidgetConfig->getNumberMostAwardedBadge();
     $mostAwardedBadges = [];
     $availableBadges = [];
     if (!is_null($workspace)) {
         $lastAwardedBadges = $user !== 'anon.' ? $this->badgeManager->getWorkspaceLastAwardedBadgesToLoggedUser($workspace, $nbLastAwarded) : [];
         $mostAwardedBadges = $this->badgeManager->getWorkspaceMostAwardedBadges($workspace, $nbMostAwarded);
         $availableBadges = $this->badgeManager->getWorkspaceAvailableBadges($workspace);
         $widgetType = 'workspace';
     } else {
         $lastAwardedBadges = $this->badgeManager->getLoggedUserLastAwardedBadges($nbLastAwarded);
         $widgetType = 'desktop';
     }
     $content = $this->templating->render('IcapBadgeBundle:Widget:badge_usage.html.twig', ['lastAwardedBadges' => $lastAwardedBadges, 'mostAwardedBadges' => $mostAwardedBadges, 'availableBadges' => $availableBadges, 'simple_view_widget' => $simple_view_widget, 'systemName' => $this->platformName, 'widgetType' => $widgetType]);
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_claroline_rssreader")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $config = $this->rssManager->getConfig($event->getInstance());
     if ($config) {
         $event->setContent($this->getRssContent($config, $event->getInstance()->getId()));
     } else {
         $event->setContent('');
     }
     $event->stopPropagation();
 }
Exemple #15
0
 /**
  * @DI\Observe("widget_formalibre_campus")
  *
  * @param DisplayToolEvent $event
  */
 public function onDisplayCampus(DisplayWidgetEvent $event)
 {
     $event->setContent($this->getDisplayCampus());
 }
 /**
  * @DI\Observe("widget_agenda_task")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onTaskDisplay(DisplayWidgetEvent $event)
 {
     if ($event->getInstance()->isDesktop()) {
         $event->setContent($this->desktopWidgetTask());
     } else {
         $event->setContent($this->workspaceWidgetTask($event->getInstance()->getWorkspace()));
     }
     $event->stopPropagation();
 }
Exemple #17
0
 public function onDisplay(DisplayWidgetEvent $event)
 {
     $event->setContent('someContent');
 }
 /**
  * @DI\Observe("widget_claroline_result")
  *
  * @param DisplayWidgetEvent $event
  */
 public function onDisplayWidget(DisplayWidgetEvent $event)
 {
     $loggedUser = $this->tokenStorage->getToken()->getUser();
     $user = $loggedUser !== 'anon.' ? $loggedUser : null;
     $workspace = $event->getInstance()->getWorkspace();
     $content = $this->manager->getWidgetContent($workspace, $user);
     $event->setContent($content);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("widget_tag_list")
  */
 public function onWidgetTagListDisplay(DisplayWidgetEvent $event)
 {
     $blog = $this->widgetManager->getTagListBlog($event->getInstance());
     /** @var \icap\BlogBundle\Entity\WidgetTagListBlog $widgetTagListBlog */
     $widgetTagListBlog = $this->widgetManager->getWidgetTagListBlogByWdgetInstance($event->getInstance());
     $tagCloud = 0;
     if ($widgetTagListBlog !== null) {
         $tagCloud = $widgetTagListBlog->getTagCloud();
     }
     $blogOptions = new BlogOptions();
     $blogOptions->setTagCloud($tagCloud);
     $content = $this->templatingEngine->render('IcapBlogBundle:widget:tags.html.twig', ['blog' => $blog, '_resource' => $blog, 'blogOptions' => $blogOptions]);
     $event->setContent($content);
     $event->stopPropagation();
 }