/** * @param Wiki $wiki * @param Section $section * @param Contribution $contribution */ public function __construct(Dropzone $dropzone, Drop $drop, Correction $correction, $roleManager) { $this->dropzone = $dropzone; $this->role_manager = $roleManager; $this->details = array('report' => array('drop' => $drop, 'correction' => $correction, 'report_comment' => $correction->getReportComment(), 'dropzoneId' => $dropzone->getId(), 'dropId' => $drop->getId(), 'correctionId' => $correction->getId())); parent::__construct($dropzone->getResourceNode(), $this->details); }
/** * @Route( * "/report/drop/{correctionId}", * name="innova_collecticiel_report_drop", * requirements={"resourceId" = "\d+", "dropId" = "\d+", "correctionId" = "\d+"} * ) * @ParamConverter("correction", class="InnovaCollecticielBundle:Correction", options={"id" = "correctionId"}) * @ParamConverter("user", options={ * "authenticatedUser" = true, * "messageEnabled" = true, * "messageTranslationKey" = "Participate in an evaluation requires authentication. Please login.", * "messageTranslationDomain" = "innova_collecticiel" * }) * @Template() */ public function reportDropAction(Correction $correction, User $user) { $dropzone = $correction->getDropzone(); $drop = $correction->getDrop(); $em = $this->getDoctrine()->getManager(); $this->get('innova.manager.dropzone_voter')->isAllowToOpen($dropzone); try { $curent_user_correction = $em->getRepository('InnovaCollecticielBundle:Correction')->getNotFinished($dropzone, $user); } catch (NotFoundHttpException $e) { throw new AccessDeniedException(); } if ($curent_user_correction === null || $curent_user_correction->getId() !== $correction->getId()) { throw new AccessDeniedException(); } $form = $this->createForm(new CorrectionReportType(), $correction); if ($this->getRequest()->isMethod('POST')) { $form->handleRequest($this->getRequest()); if ($form->isValid()) { $drop->setReported(true); $correction->setReporter(true); $correction->setEndDate(new \DateTime()); $correction->setFinished(true); $correction->setTotalGrade(0); $em->persist($drop); $em->persist($correction); $em->flush(); $this->dispatchDropReportEvent($dropzone, $drop, $correction); $this->getRequest()->getSession()->getFlashBag()->add('success', $this->get('translator')->trans('Your report has been saved', [], 'innova_collecticiel')); $url = $this->generateUrl('innova_collecticiel_open', ['resourceId' => $dropzone->getId()]); return $this->redirect($url); } } $view = 'InnovaCollecticielBundle:Drop:reportDrop.html.twig'; if ($this->getRequest()->isXmlHttpRequest()) { $view = 'InnovaCollecticielBundle:Drop:reportDropModal.html.twig'; } return $this->render($view, ['workspace' => $dropzone->getResourceNode()->getWorkspace(), '_resource' => $dropzone, 'dropzone' => $dropzone, 'drop' => $drop, 'correction' => $correction, 'form' => $form->createView()]); }
/** * @Route( * "/{documentId}/add/comments/{userId}/{dropzoneId}/{correctionId}", * name="innova_collecticiel_add_comment", * requirements={"documentId" = "\d+", "userId" = "\d+", "dropzoneId" = "\d+", "correctionId" = "\d+"} * ) * @ParamConverter("document", class="InnovaCollecticielBundle:Document", options={"id" = "documentId"}) * @ParamConverter("user",class="ClarolineCoreBundle:User",options={"id" = "userId"}) * @ParamConverter("dropzone", class="InnovaCollecticielBundle:Dropzone", options={"id" = "dropzoneId"}) * @ParamConverter("correction", class="InnovaCollecticielBundle:Correction", options={"id" = "correctionId"}) * @Method("POST") * @Template() */ public function AddCommentsInnovaAction(Document $document, User $user, Dropzone $dropzone, Correction $correction) { $em = $this->getDoctrine()->getManager(); // Valorisation du commentaire $comment = new Comment(); $comment->setDocument($document); $comment->setUser($user); $form = $this->get('form.factory')->createBuilder(new CommentType(), $comment)->getForm(); // Récupération de la saisie du commentaire $request = $this->get('request'); if ($request->isMethod('POST')) { $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); // Insertion en base du commentaire $em->persist($comment); $em->flush(); } } // Ajouter la création du log de la création du commentaire. InnovaERV. $unitOfWork = $em->getUnitOfWork(); $unitOfWork->computeChangeSets(); $dropzoneChangeSet = $unitOfWork->getEntityChangeSet($dropzone); $event = new LogCommentCreateEvent($dropzone, $dropzoneChangeSet, $comment); $this->dispatch($event); // Redirection vers la page des commentaires. InnovaERV. return $this->redirect($this->generateUrl('innova_collecticiel_drops_detail_comment', array('resourceId' => $dropzone->getId(), 'state' => 'edit', 'correctionId' => $correction->getId(), 'documentId' => $document->getId()))); }