/**
  * @DI\Observe("innova_media_resource_administrate_innova_media_resource")
  **/
 public function onAdministrate(CustomActionResourceEvent $event)
 {
     $mediaResource = $event->getResource();
     $route = $this->container->get('router')->generate('innova_media_resource_administrate', ['id' => $mediaResource->getId(), 'workspaceId' => $mediaResource->getWorkspace()->getId()]);
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
Example #2
0
 public function onAdministrate(CustomActionResourceEvent $event)
 {
     $path = $event->getResource();
     $route = $this->container->get('router')->generate('innova_path_editor_wizard', array('id' => $path->getId()));
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("resource_action_hevinci_favourite")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onFavoriteAction(CustomActionResourceEvent $event)
 {
     $nodeId = $event->getResource()->getResourceNode()->getId();
     $favourite = $this->om->getRepository('HeVinciFavouriteBundle:Favourite')->findBy(array('resourceNode' => $nodeId, 'user' => $this->tokenStorage->getToken()->getUser()));
     $content = $this->templatingEngine->render('HeVinciFavouriteBundle:Favourite:form.html.twig', array('isFavourite' => (bool) $favourite, 'nodeId' => $nodeId));
     $event->setResponse(new Response($content));
     $event->stopPropagation();
 }
 /**
  * @Observe("compose_activity")
  */
 public function onCompose(CustomActionResourceEvent $event)
 {
     $activity = $event->getResource();
     $event->setResponse(new RedirectResponse($this->router->generate('claro_activity_edit', array('resource' => $activity->getId()))));
     $event->stopPropagation();
 }
Example #5
0
 /**
  * @DI\Observe("manageresults_innova_path")
  *
  * @param \Claroline\CoreBundle\Event\CustomActionResourceEvent $event
  */
 public function onManageresults(CustomActionResourceEvent $event)
 {
     $path = get_class($event->getResource()) === 'Claroline\\CoreBundle\\Entity\\Resource\\ResourceShortcut' ? $this->resourceManager->getResourceFromShortcut($event->getResource()->getResourceNode()) : $event->getResource();
     $route = $this->container->get('router')->generate('innova_path_manage_results', ['id' => $path->getId()]);
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
 /**
  * @param CustomActionResourceEvent $event
  */
 public function onConfigure(CustomActionResourceEvent $event)
 {
     $route = $this->container->get('router')->generate('icap_blog_configure', array('blogId' => $event->getResource()->getId()));
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
Example #7
0
 /**
  * @DI\Observe("update_file_file")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onUpdateFile(CustomActionResourceEvent $event)
 {
     if (!$this->request) {
         throw new NoHttpRequestException();
     }
     $params = array();
     $params['_controller'] = 'ClarolineCoreBundle:File:updateFileForm';
     $params['file'] = $event->getResource()->getId();
     $subRequest = $this->request->getCurrentRequest()->duplicate(array(), null, $params);
     $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $event->setResponse($response);
 }
Example #8
0
 /**
  * @DI\Observe("resource_action_tag_action")
  */
 public function onResourceTagAction(CustomActionResourceEvent $event)
 {
     $params = array();
     $params['_controller'] = 'ClarolineTagBundle:Tag:resourceTagForm';
     $params['resourceNode'] = $event->getResource()->getResourceNode()->getId();
     $subRequest = $this->request->duplicate(array(), null, $params);
     $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("list_dropzone_icap_dropzone")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onList(CustomActionResourceEvent $event)
 {
     $resource = get_class($event->getResource()) === 'Claroline\\CoreBundle\\Entity\\Resource\\ResourceShortcut' ? $this->resourceManager->getResourceFromShortcut($event->getResource()->getResourceNode()) : $event->getResource();
     $params = [];
     $params['_controller'] = 'IcapDropzoneBundle:Drop:dropsByDefault';
     $params['resourceId'] = $resource->getId();
     $subRequest = $this->request->duplicate([], null, $params);
     $response = $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("testupload_cpasimusante_simuresource")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onTestupload(CustomActionResourceEvent $event)
 {
     //send the logic to the controller method
     $route = $this->container->get('router')->generate('cpasimusante_simuresource_testupload', array('node' => $event->getResource()->getResourceNode()->getId()));
     $response = new RedirectResponse($route);
     $event->setResponse($response);
     $event->stopPropagation();
 }
 public function onList(CustomActionResourceEvent $event)
 {
     $route = $this->container->get('router')->generate('innova_collecticiel_drops_awaiting', ['resourceId' => $event->getResource()->getId()]);
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
Example #12
0
 /**
  * @DI\Observe("change_url_menu_hevinci_url")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onChangeAction(CustomActionResourceEvent $event)
 {
     $resource = get_class($event->getResource()) === 'Claroline\\CoreBundle\\Entity\\Resource\\ResourceShortcut' ? $this->manager->getResourceFromShortcut($event->getResource()->getResourceNode()) : $event->getResource();
     $form = $this->formFactory->create(new UrlChangeType(), $resource);
     $form->handleRequest($this->request);
     $content = $this->templating->render('HeVinciUrlBundle:Url:form.html.twig', ['form' => $form->createView(), 'node' => $resource->getResourceNode()->getId()]);
     $event->setResponse(new Response($content));
     $event->stopPropagation();
 }
Example #13
0
 /**
  * @DI\Observe("configure_blog_icap_blog")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onConfigure(CustomActionResourceEvent $event)
 {
     $resource = get_class($event->getResource()) === 'Claroline\\CoreBundle\\Entity\\Resource\\ResourceShortcut' ? $this->resourceManager->getResourceFromShortcut($event->getResource()->getResourceNode()) : $event->getResource();
     $route = $this->container->get('router')->generate('icap_blog_configure', ['blogId' => $resource->getId()]);
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
 public function onList(CustomActionResourceEvent $event)
 {
     $route = $this->container->get('router')->generate('icap_dropzone_drops', array('resourceId' => $event->getResource()->getId()));
     $event->setResponse(new RedirectResponse($route));
     $event->stopPropagation();
 }
Example #15
0
 /**
  * @DI\Observe("change_url_menu_hevinci_url")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onChangeAction(CustomActionResourceEvent $event)
 {
     $form = $this->formFactory->create(new UrlChangeType(), $event->getResource());
     $form->handleRequest($this->request);
     $content = $this->templating->render('HeVinciUrlBundle:Url:form.html.twig', array('form' => $form->createView(), 'node' => $event->getResource()->getResourceNode()->getId()));
     $event->setResponse(new Response($content));
     $event->stopPropagation();
 }
 /**
  * @DI\Observe("updatesimuresourceinpage_cpasimusante_simuresource")
  *
  * @param CustomActionResourceEvent $event
  */
 public function onUpdatesimuresourceinpage(CustomActionResourceEvent $event)
 {
     $resource = $event->getResource();
     //BEGIN Send a mail to user and add a message in Claroline internal messagebox (Claroline/message-bundle)
     $subject = 'Some test subject';
     $body = 'Some dummy body';
     //get users to send the mail to
     $users = $this->container->get('cpasimusante.plugin.manager.general')->getUsersForResourceByRights($resource->getResourceNode(), 'open', false);
     //sender
     $from = $this->container->get('security.token_storage')->getToken()->getUser();
     /*
             //Add a message in message box
             $messageManager = $this->container->get('claroline.manager.message_manager');
             $message = $messageManager->create($body, $subject, $users, $from);
             $messageManager->send($message);
     
             //Send a mail - not tested with mailserver
             $mailer = $this->container->get('claroline.manager.mail_manager')->send($subject, $body, $users, $from);
             //END Send a mail to user
     
             //Add flashbag
             $this->request->getSession()->getFlashBag()->add( 'success', 'A message in a success "flashbag"'        );
             $this->request->getSession()->getFlashBag()->add( 'success', 'Another message in a success "flashbag"'  );
             $this->request->getSession()->getFlashBag()->add( 'error',   'A message in an error "flashbag"'         );
     */
     $content = $this->templating->render('CPASimUSanteSimuResourceBundle:SimuResource:updatesimuresourceinpage.html.twig', array('_resource' => $resource, 'entity' => $resource, 'users' => $users, 'from' => $from));
     $response = new Response($content);
     $event->setResponse($response);
     $event->stopPropagation();
 }