/**
  * @param Wiki         $wiki
  * @param Section      $section
  * @param Contribution $contribution
  */
 public function __construct(Document $document, Dropzone $dropzone, $userIds)
 {
     $this->document = $document;
     $this->dropzone = $dropzone;
     $this->type = $dropzone->getResourceNode()->getName();
     $this->userIds = $userIds;
     $this->details = array();
     // Récupération du nom et du prénom
     $this->firstName = $document->getSender()->getFirstName();
     $this->lastName = $document->getSender()->getLastName();
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
 /**
  * @param Wiki         $wiki
  * @param Section      $section
  * @param Contribution $contribution
  */
 public function __construct(Document $document, Dropzone $dropzone, $userIds)
 {
     $this->document = $document;
     // Traitement du paramètre "type" : gestion du cas spécifique du type URL.
     if ($document->getType() == 'url') {
         $this->type = $document->getUrl();
     } elseif (strlen($document->getTitle()) > 0) {
         $this->type = $document->getTitle();
     } else {
         $this->type = $document->getResourceNode()->getName();
     }
     $this->userIds = $userIds;
     $this->details = array();
     // Récupération du nom et du prénom
     $this->firstName = $document->getSender()->getFirstName();
     $this->lastName = $document->getSender()->getLastName();
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
 /**
  * @param Wiki $wiki
  * @param Section $section
  * @param Contribution $contribution
  */
 public function __construct(Document $document, Dropzone $dropzone, $userIds)
 {
     //        $this->resourceNodeId = $dropzone->getDrops()[0]->getUser()->getId();
     //        $dropId = $document->getDrop()->getId(); //->getDropzone()->getId();
     //var_dump($dp);
     //var_dump($document);die();
     $this->document = $document;
     $this->type = $dropzone->getResourceNode()->getName();
     $this->userIds = $userIds;
     //echo "<pre>";
     //var_dump($this->userIds);
     //echo "</pre>";
     //die();
     $this->details = array();
     // Récupération du nom et du prénom
     $this->firstName = $document->getSender()->getFirstName();
     $this->lastName = $document->getSender()->getLastName();
     //var_dump($this->firstName);
     //var_dump($this->lastName);
     //var_dump($this->type);
     //die();
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
예제 #4
0
 /**
  *@Route(
  *      "/document/{documentId}",
  *      name="innova_collecticiel_validate_document",
  *      requirements={"documentId" = "\d+", "dropzoneId" = "\d+"},
  *      options={"expose"=true}
  * )
  *@ParamConverter("document", class="InnovaCollecticielBundle:Document", options={"id" = "documentId"})
  *@Template()
  */
 public function ajaxValidateDocumentAction(Document $document)
 {
     // Appel pour accés base
     $em = $this->getDoctrine()->getManager();
     // Recherche en base des données du document à mettre à jour
     $doc = $this->getDoctrine()->getRepository('InnovaCollecticielBundle:Document')->find($document->getId());
     // Mise à jour du booléen de Validation de false à true
     $doc->setvalidate(true);
     // Récupération du dropID puis du dropZone
     $dropId = $document->getDrop()->getId();
     $dropRepo = $this->getDoctrine()->getRepository('InnovaCollecticielBundle:Drop');
     $drops = $dropRepo->findBy(['id' => $dropId]);
     $dropzoneRepo = $this->getDoctrine()->getRepository('InnovaCollecticielBundle:DropZone');
     $dropzones = $dropzoneRepo->findBy(['id' => $drops[0]->getDropzone()->getId()]);
     // Mise à jour de la base de données
     $em->persist($doc);
     $em->flush();
     $dropzoneManager = $this->get('innova.manager.dropzone_manager');
     $collecticielOpenOrNot = $dropzoneManager->collecticielOpenOrNot($dropzones[0]);
     // Envoi notification. InnovaERV
     $usersIds = [];
     // Ici, on récupère le créateur du collecticiel = l'admin
     if ($document->getType() === 'url') {
         $userCreator = $document->getDrop()->getDropzone()->getResourceNode()->getCreator()->getId();
     } else {
         $userCreator = $document->getResourceNode()->getCreator()->getId();
     }
     // Ici, on récupère celui qui vient de déposer le nouveau document
     //$userAddDocument = $this->get('security.context')->getToken()->getUser()->getId();
     $userDropDocument = $document->getDrop()->getUser()->getId();
     $userSenderDocument = $document->getSender()->getId();
     if ($userCreator === $userSenderDocument) {
         // Ici avertir l'étudiant qui a travaillé sur ce collecticiel
         $usersIds[] = $userDropDocument;
     } else {
         // Ici avertir celui a qui créé le collecticiel
         $usersIds[] = $userCreator;
     }
     $event = new LogDropzoneValidateDocumentEvent($document, $dropzones[0], $usersIds);
     $this->get('event_dispatcher')->dispatch('log', $event);
     // Ajout afin d'afficher la partie du code avec "Demande transmise"
     $template = $this->get('templating')->render('InnovaCollecticielBundle:Document:documentIsValidate.html.twig', ['document' => $document, 'collecticielOpenOrNot' => $collecticielOpenOrNot, 'dropzone' => $dropzones[0]]);
     // Retour du template actualisé à l'Ajax et non plus du Json.
     return new Response($template);
 }