/**
  * @param \Innova\CollecticielBundle\Entity\Dropzone $dropzone
  * @param \Innova\CollecticielBundle\Entity\Drop     $drop
  *
  * @internal param \Innova\CollecticielBundle\Event\Log\Wiki $wiki
  * @internal param \Innova\CollecticielBundle\Event\Log\Section $section
  * @internal param \Innova\CollecticielBundle\Event\Log\Contribution $contribution
  */
 public function __construct(Dropzone $dropzone, Drop $drop)
 {
     $this->dropzone = $dropzone;
     $this->drop = $drop;
     $this->details = array('drop' => $drop, 'dropGrade' => $drop->getCalculatedGrade(), 'resultMax' => 20, 'dropzoneId' => $dropzone->getId(), 'dropId' => $drop->getId());
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
 /**
  * @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);
 }
Ejemplo n.º 3
0
 /**
  * @param Dropzone $dropzone
  * @param $actionName
  * @throws AccessDeniedException
  */
 protected function isAllow(Dropzone $dropzone, $actionName)
 {
     $collection = new ResourceCollection(array($dropzone->getResourceNode()));
     if (false === $this->container->get('security.authorization_checker')->isGranted($actionName, $collection)) {
         throw new AccessDeniedException();
     }
 }
Ejemplo n.º 4
0
 /**
  * @param Dropzone $dropzone
  */
 public function checkEditRight(Dropzone $dropzone)
 {
     $collection = new ResourceCollection(array($dropzone->getResourceNode()));
     if (false === $this->container->get('security.authorization_checker')->isGranted('EDIT', $collection)) {
         return false;
     }
     return true;
 }
 /**
  * @param Wiki $wiki
  * @param Section $section
  * @param Contribution $contribution
  */
 public function __construct(Dropzone $dropzone, $newstate, $userIds)
 {
     $this->dropzone = $dropzone;
     $this->newState = $newstate;
     $this->userIds = $userIds;
     $this->details = array('newState' => $newstate);
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
 /**
  * @param Dropzone   $dropzone
  * @param Drop       $drop
  * @param Correction $correction
  */
 public function __construct(Dropzone $dropzone, Drop $drop, Correction $correction)
 {
     $documentsDetails = array();
     foreach ($drop->getDocuments() as $document) {
         $documentsDetails[] = $document->toArray();
     }
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId(), 'documents' => $documentsDetails, 'owner' => array('id' => $drop->getUser()->getId(), 'lastName' => $drop->getUser()->getLastName(), 'firstName' => $drop->getUser()->getFirstName(), 'username' => $drop->getUser()->getUsername())), 'correction' => $correction->toArray(false));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @param Dropzone $dropzone
  * @param Drop     $drop
  * @param string   $grade
  */
 public function __construct(Dropzone $dropzone, Drop $drop, $grade)
 {
     $documentsDetails = array();
     foreach ($drop->getDocuments() as $document) {
         $documentsDetails[] = $document->toArray();
     }
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId(), 'documents' => $documentsDetails, 'owner' => array('id' => $drop->getUser()->getId(), 'lastName' => $drop->getUser()->getLastName(), 'firstName' => $drop->getUser()->getFirstName(), 'username' => $drop->getUser()->getUsername())), 'result' => $grade, 'resultMax' => 20);
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @param Dropzone $dropzone
  * @param Drop     $drop
  * @param Document $document
  */
 public function __construct(Dropzone $dropzone, Drop $drop, Document $document)
 {
     $documentsDetails = array();
     foreach ($drop->getDocuments() as $document) {
         $documentsDetails[] = $document->toArray();
     }
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId(), 'documents' => $documentsDetails), 'document' => $document->toArray());
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @param Dropzone $dropzone
  * @param Drop $drop
  * @param $roleManager
  */
 public function __construct(Dropzone $dropzone, Drop $drop, $roleManager)
 {
     $this->dropzone = $dropzone;
     $this->role_manager = $roleManager;
     $documentsDetails = array();
     foreach ($drop->getDocuments() as $document) {
         $documentsDetails[] = $document->toArray();
     }
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId(), 'documents' => $documentsDetails));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @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);
 }
 /**
  *  Calculate the grad of a copy
  *
  * @param Dropzone $dropzone
  * @param Correction $correction
  * @return float|int
  */
 public function calculateCorrectionTotalGrade(Dropzone $dropzone, Correction $correction)
 {
     $nbCriteria = count($dropzone->getPeerReviewCriteria());
     $maxGrade = $dropzone->getTotalCriteriaColumn() - 1;
     $sumGrades = 0;
     foreach ($correction->getGrades() as $grade) {
         $grade->getValue() > $maxGrade ? $sumGrades += $maxGrade : ($sumGrades += $grade->getValue());
     }
     $totalGrade = 0;
     if ($nbCriteria != 0) {
         $totalGrade = $sumGrades / $nbCriteria;
         $totalGrade = $totalGrade * 20 / $maxGrade;
     }
     return $totalGrade;
 }
 /**
  * @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);
 }
 /**
  * @ParamConverter("gradingNotation", class="InnovaCollecticielBundle:GradingNotation", options={"id" = "gradingNotationId"})
  * @ParamConverter("document", class="InnovaCollecticielBundle:Document", options={"id" = "documentId"})
  * @ParamConverter("dropzone", class="InnovaCollecticielBundle:Dropzone", options={"id" = "dropzoneId"})
  * @Template()
  */
 public function renderChoiceTextAction(GradingNotation $gradingNotation, Document $document, Dropzone $dropzone)
 {
     $choiceText = '';
     // Appel pour accés base
     $em = $this->getDoctrine()->getManager();
     // Ajout pour avoir si la notation a été transmise ou pas.
     $notationArray = $em->getRepository('InnovaCollecticielBundle:Notation')->findBy(['document' => $document->getId(), 'dropzone' => $dropzone->getId()]);
     // Nombre de notation pour le document et pour le dropzone
     $countNotation = count($notationArray);
     if ($countNotation !== 0) {
         $choiceTextArray = $em->getRepository('InnovaCollecticielBundle:ChoiceNotation')->getChoiceTextForCriteriaAndNotation($gradingNotation, $notationArray[0]);
         if (!empty($choiceTextArray)) {
             // Récupération de la valeur du texte
             $choiceText = $choiceTextArray[0]->getChoiceText();
         }
     }
     return ['value' => $choiceText];
 }
 private function getDropZoneHiddenDirectory(Dropzone $dropzone)
 {
     $em = $this->getDoctrine()->getManager();
     $hiddenDirectory = $dropzone->getHiddenDirectory();
     if ($hiddenDirectory === null) {
         $hiddenDirectory = new Directory();
         $name = $this->get('translator')->trans('Hidden folder for "%dropzoneName%"', array('%dropzoneName%' => $dropzone->getResourceNode()->getName()), 'innova_collecticiel');
         $hiddenDirectory->setName($name);
         $role = $this->getDoctrine()->getRepository('ClarolineCoreBundle:Role')->findManagerRole($dropzone->getResourceNode()->getWorkspace());
         $resourceManager = $this->get('claroline.manager.resource_manager');
         $resourceManager->create($hiddenDirectory, $resourceManager->getResourceTypeByName('directory'), $dropzone->getResourceNode()->getCreator(), $dropzone->getResourceNode()->getWorkspace(), $dropzone->getResourceNode()->getParent(), null, array('ROLE_WS_MANAGER' => array('open' => true, 'export' => true, 'create' => array(), 'role' => $role)));
         $dropzone->setHiddenDirectory($hiddenDirectory->getResourceNode());
         $em->persist($dropzone);
         $em->flush();
     }
     return $dropzone->getHiddenDirectory();
 }
 /**
  * @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);
 }
Ejemplo n.º 16
0
 /**
  * Export a Collecticiel.
  *
  * @param Workspace $workspace
  * @param array     $files
  * @param Dropzone  $dropzone
  *
  * @return array
  */
 public function export(Workspace $workspace, array &$files, Dropzone $dropzone)
 {
     $data = [];
     $uid = uniqid() . '.txt';
     $tmpPath = $this->ch->getParameter('tmp_dir') . DIRECTORY_SEPARATOR . $uid;
     file_put_contents($tmpPath, $dropzone->getInstruction());
     $files[$uid] = $tmpPath;
     $data['instruction'] = $uid;
     $data['allow_workspace_resource'] = $dropzone->getAllowWorkspaceResource();
     $data['allow_upload'] = $dropzone->getAllowUpload();
     $data['allow_url'] = $dropzone->getAllowUrl();
     $data['allow_rich_text'] = $dropzone->getAllowRichText();
     $data['manual_planning'] = $dropzone->getManualPlanning();
     $data['manual_state'] = $dropzone->getManualState();
     $startDate = $dropzone->getStartAllowDrop();
     if (!empty($startDate)) {
         $data['start_allow_drop'] = $startDate->format('Y-m-d H:i:s');
     }
     $endDate = $dropzone->getEndAllowDrop();
     if (!empty($endDate)) {
         $data['end_allow_drop'] = $endDate->format('Y-m-d H:i:s');
     }
     return $data;
 }
 /**
  * @param Wiki         $wiki
  * @param Section      $section
  * @param Contribution $contribution
  */
 public function __construct(Dropzone $dropzone, $newstate, $userIds)
 {
     $this->dropzone = $dropzone;
     $this->newState = $dropzone->getResourceNode()->getName();
     $this->userIds = $userIds;
     $this->details = array();
     $this->userId = $dropzone->getDrops()[0]->getUser()->getId();
     // Récupération du nom et du prénom
     $this->firstName = $dropzone->getDrops()[0]->getUser()->getFirstName();
     $this->lastName = $dropzone->getDrops()[0]->getUser()->getLastName();
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
 /**
  * @param Wiki         $wiki
  * @param Section      $section
  * @param Contribution $contribution
  */
 public function __construct(Dropzone $dropzone, $newstate, $userIds)
 {
     $this->dropzone = $dropzone;
     $this->type = $dropzone->getResourceNode()->getName();
     $this->userIds = $userIds;
     // Traitement de la traduction pour CE cas. InnovaERV.
     if ($newstate == 'allowDrop') {
         $this->newState = 'Open';
     }
     if ($newstate == 'finished') {
         $this->newState = 'Closed';
     }
     $this->details = array('newState' => $this->newState);
     $this->userId = $dropzone->getDrops()[0]->getUser()->getId();
     // Récupération du nom et du prénom
     $this->firstName = $dropzone->getDrops()[0]->getUser()->getFirstName();
     $this->lastName = $dropzone->getDrops()[0]->getUser()->getLastName();
     parent::__construct($dropzone->getResourceNode(), $this->details);
 }
Ejemplo n.º 19
0
 /**
  * @DI\Observe("copy_innova_collecticiel")
  *
  * @param CopyResourceEvent $event
  */
 public function onCopy(CopyResourceEvent $event)
 {
     $em = $this->container->get('doctrine.orm.entity_manager');
     /** @var Dropzone $resource */
     $resource = $event->getResource();
     $newDropzone = new Dropzone();
     $newDropzone->setName($resource->getName());
     $newDropzone->setAllowCommentInCorrection($resource->getAllowCommentInCorrection());
     $newDropzone->setAllowRichText($resource->getAllowRichText());
     $newDropzone->setAllowUpload($resource->getAllowUpload());
     $newDropzone->setAllowUrl($resource->getAllowUrl());
     $newDropzone->setAllowWorkspaceResource($resource->getAllowWorkspaceResource());
     $newDropzone->setDisplayNotationMessageToLearners($resource->getDisplayNotationMessageToLearners());
     $newDropzone->setDisplayNotationToLearners($resource->getDisplayNotationToLearners());
     $newDropzone->setEditionState($resource->getEditionState());
     $newDropzone->setEndAllowDrop($resource->getEndAllowDrop());
     $newDropzone->setEndReview($resource->getEndReview());
     $newDropzone->setExpectedTotalCorrection($resource->getExpectedTotalCorrection());
     $newDropzone->setInstruction($resource->getInstruction());
     $newDropzone->setManualPlanning($resource->getManualPlanning());
     $newDropzone->setManualState($resource->getManualState());
     $newDropzone->setMinimumScoreToPass($resource->getMinimumScoreToPass());
     $newDropzone->setPeerReview($resource->getPeerReview());
     $newDropzone->setStartAllowDrop($resource->getStartAllowDrop());
     $newDropzone->setStartReview($resource->getStartReview());
     $newDropzone->setTotalCriteriaColumn($resource->getTotalCriteriaColumn());
     $oldCriteria = $resource->getPeerReviewCriteria();
     foreach ($oldCriteria as $oldCriterion) {
         $newCriterion = new Criterion();
         $newCriterion->setInstruction($oldCriterion->getInstruction());
         $newDropzone->addCriterion($newCriterion);
     }
     $em->persist($newDropzone);
     $event->setCopy($newDropzone);
     $event->stopPropagation();
 }
Ejemplo n.º 20
0
 /**
  * @Route(
  *      "/add/comments/{userId}/{dropzoneId}",
  *      name="innova_collecticiel_add_comment_for_docs",
  *      requirements={"userId" = "\d+", "dropzoneId" = "\d+"}
  * )
  * @ParamConverter("user",class="ClarolineCoreBundle:User",options={"id" = "userId"})
  * @ParamConverter("dropzone", class="InnovaCollecticielBundle:Dropzone", options={"id" = "dropzoneId"})
  * @Method("POST")
  * @Template()
  */
 public function addCommentForDocsInnovaAction(User $user, Dropzone $dropzone)
 {
     // Saisie des commentaires à la volée.
     // Récupération de l'USER
     $user = $this->get('security.context')->getToken()->getUser();
     $em = $this->getDoctrine()->getManager();
     $comment = new Comment();
     $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()) {
             // Récupération du commentaire
             $commentText = $comment->getCommentText();
             // Récupération des documents sur lesquels porte le commentaire saisi
             $docs = $this->getRequest()->request->get('docs');
             // Récupération des ID des documents
             $explodeDocIdS = explode('|', $docs);
             // Parcours du tableau des documents
             foreach ($explodeDocIdS as $documentId) {
                 // Je ne prends pas le dernier élément du tableau
                 if (is_numeric($documentId)) {
                     // Création du nouveau commentaire
                     $document = $this->getDoctrine()->getRepository('InnovaCollecticielBundle:Document')->find($documentId);
                     // Valorisation du commentaire
                     $comment = new Comment();
                     $comment->setDocument($document);
                     $comment->setCommentText($commentText);
                     $comment->setUser($user);
                     // Insertion en base du commentaire
                     $em->persist($comment);
                     // 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
                     $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 LogDropzoneAddCommentEvent($dropzone, $dropzone->getManualState(), $usersIds, $comment);
                     $this->get('event_dispatcher')->dispatch('log', $event);
                 }
             }
             $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 les demandes adressées. InnovaERV.
     return $this->redirect($this->generateUrl('innova_collecticiel_drops_awaiting', ['resourceId' => $dropzone->getId()]));
 }
 /**
  * @param Dropzone    $dropzone
  * @param mixed       $dropzoneChangeSet
  * @param CommentRead $comment_read
  */
 public function __construct(Dropzone $dropzone, $dropzoneChangeSet, CommentRead $comment_read)
 {
     $details = array('dropzone' => array('id' => $dropzone->getId(), 'changeSet' => $dropzoneChangeSet), 'comment_read' => array('id' => $comment_read->getId(), 'comment' => $comment_read->getComment(), 'user' => $comment_read->getUser()));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @param Dropzone $dropzone
  * @param array    $changeSet
  */
 public function __construct(Dropzone $dropzone, $changeSet)
 {
     $details = array('dropzone' => array('id' => $dropzone->getId(), 'changeSet' => $changeSet));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 /**
  * @param Dropzone  $dropzone
  * @param Criterion $criterion
  */
 public function __construct(Dropzone $dropzone, Criterion $criterion)
 {
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'criterion' => array('id' => $criterion->getId(), 'instruction' => $criterion->getInstruction()));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 private function createAgendaEventDrop(User $user, Dropzone $dropzone)
 {
     $translator = $this->container->get('translator');
     $em = $this->container->get('doctrine')->getEntityManager();
     $event = new Event();
     $event->setStart($dropzone->getStartAllowDrop());
     $event->setEnd($dropzone->getEndAllowDrop());
     $event->setUser($user);
     $dropzoneName = $dropzone->getResourceNode()->getName();
     $title = $translator->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
     $desc = $translator->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
     $event->setTitle($title);
     $event->setDescription($desc);
     $em->persist($event);
     $em->flush();
     return $event;
 }
Ejemplo n.º 25
0
 /**
  *  Test to detect the incorrect input.
  *
  * @param Form     $form     form to control
  * @param Dropzone $dropzone dropzone to update
  *
  * @return form
  */
 public function handleFormErrors($form, Dropzone $dropzone)
 {
     if (!$dropzone->getAllowWorkspaceResource() && !$dropzone->getAllowUpload() && !$dropzone->getAllowUrl() && !$dropzone->getAllowRichText()) {
         $form->get('allowWorkspaceResource')->addError(new FormError('Choose at least one type of document'));
         $form->get('allowUpload')->addError(new FormError('Choose at least one type of document'));
         $form->get('allowUrl')->addError(new FormError('Choose at least one type of document'));
         $form->get('allowRichText')->addError(new FormError('Choose at least one type of document'));
     }
     if (!$dropzone->getManualPlanning()) {
         if ($dropzone->getStartAllowDrop() === null) {
             $form->get('startAllowDrop')->addError(new FormError('Choose a date'));
         }
         if ($dropzone->getEndAllowDrop() === null) {
             $form->get('endAllowDrop')->addError(new FormError('Choose a date'));
         }
         if ($dropzone->getStartAllowDrop() !== null && $dropzone->getEndAllowDrop() !== null) {
             if ($dropzone->getStartAllowDrop()->getTimestamp() > $dropzone->getEndAllowDrop()->getTimestamp()) {
                 $form->get('startAllowDrop')->addError(new FormError('Must be before end allow drop'));
                 $form->get('endAllowDrop')->addError(new FormError('Must be after start allow drop'));
             }
         }
     }
     return $form;
 }
 private function addCorrectionCount(Dropzone $dropzone, $users)
 {
     $correctionRepo = $this->getDoctrine()->getManager()->getRepository('InnovaCollecticielBundle:Correction');
     $dropRepo = $this->getDoctrine()->getManager()->getRepository('InnovaCollecticielBundle:Drop');
     $response = array();
     foreach ($users as $user) {
         $responseItem = array();
         $responseItem['userId'] = $user->getId();
         $corrections = $correctionRepo->getByDropzoneUser($dropzone->getId(), $user->getId());
         $isUnlockedDrop = $dropRepo->isUnlockedDrop($dropzone->getId(), $user->getId());
         $count = count($corrections);
         $responseItem['correction_count'] = $count;
         $finishedCount = 0;
         $reportsCount = 0;
         $deniedCount = 0;
         foreach ($corrections as $correction) {
             if ($correction->getCorrectionDenied()) {
                 $deniedCount++;
             }
             if ($correction->getReporter()) {
                 $reportsCount++;
             }
             if ($correction->getFinished()) {
                 $finishedCount++;
             }
         }
         //$dropCount = count($dropRepo->getDropIdsByUser($dropzone->getId(),$user->getId()));
         //$responseItem['userDropCount']= $dropCount;
         $responseItem['correction_deniedCount'] = $deniedCount;
         $responseItem['correction_reportCount'] = $reportsCount;
         $responseItem['correction_finishedCount'] = $finishedCount;
         $responseItem['drop_isUnlocked'] = $isUnlockedDrop;
         $response[$user->getId()] = $responseItem;
     }
     return $response;
 }
Ejemplo n.º 27
0
 /**
  * @param Dropzone $dropzone
  * @param Drop     $drop
  * @param Document $document
  */
 public function __construct(Dropzone $dropzone, Drop $drop, Document $document)
 {
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId(), 'owner' => array('id' => $drop->getUser()->getId(), 'lastName' => $drop->getUser()->getLastName(), 'firstName' => $drop->getUser()->getFirstName(), 'username' => $drop->getUser()->getUsername())), 'document' => $document->toArray());
     parent::__construct($dropzone->getResourceNode(), $details);
 }
 private function createAgendaEventDrop(DateTime $startDate, DateTime $endDate, $user, Dropzone $dropzone, $type = "drop")
 {
     /*
     $dateTS = new DateTime();
     $dateTS = $startDate;
     echo "TS : " . $dateTS;
     echo "TS = " . $dateTS->getTimestamp();
     */
     $event = new Event();
     $event->setStart($startDate);
     $event->setEnd($endDate);
     $event->setUser($user);
     $dropzoneName = $dropzone->getResourceNode()->getName();
     if ($type == 'drop') {
         $title = $this->get('translator')->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $desc = $this->get('translator')->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $event->setTitle($title);
         $event->setDescription($desc);
     } else {
         $title = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $desc = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'innova_collecticiel');
         $event->setTitle($title);
         $event->setDescription($desc);
     }
     $em = $this->getDoctrine()->getManager();
     $em->persist($event);
     $em->flush();
     return $event;
 }
 /**
  * @param Dropzone $dropzone
  * @param Drop $drop
  */
 public function __construct(Dropzone $dropzone, Drop $drop)
 {
     $details = array('dropzone' => array('id' => $dropzone->getId()), 'drop' => array('id' => $drop->getId()));
     parent::__construct($dropzone->getResourceNode(), $details);
 }
Ejemplo n.º 30
0
 public function getRequestByUserCount(Dropzone $dropzone)
 {
     $userRequestCount = array();
     foreach ($dropzone->getDrops() as $drop) {
         $user = $drop->getUser();
         $nbAdressedRequests = $this->documentRepo->countTextToRead($user, $dropzone);
         $userRequestCount[$user->getId()] = $nbAdressedRequests;
     }
     return $userRequestCount;
 }