/** * @param \Icap\DropzoneBundle\Entity\Dropzone $dropzone * @param \Icap\DropzoneBundle\Entity\Drop $drop */ 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 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(); } }
/** * @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); }
/** * @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 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 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 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); }
/** * 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; }
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()), 'icap_dropzone'); $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 Dropzone $dropzone * @param mixed $dropzoneChangeSet * @param Criterion $criterion */ public function __construct(Dropzone $dropzone, $dropzoneChangeSet, Criterion $criterion) { $details = array('dropzone' => array('id' => $dropzone->getId(), 'changeSet' => $dropzoneChangeSet), 'criterion' => array('id' => $criterion->getId(), 'instruction' => $criterion->getInstruction())); parent::__construct($dropzone->getResourceNode(), $details); }
/** * @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); }
/** * @DI\Observe("copy_icap_dropzone") * * @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(); }
public function testIsPeerReview() { echo "testing DROPZONE->isPeerReview\n"; $dzs = $this->createFixturesDropzones(); $this->assertEquals(false, $dzs[0]->isPeerReview()); $this->assertEquals(false, $dzs[1]->isPeerReview()); $this->assertEquals(true, $dzs[2]->isPeerReview()); $this->assertEquals(false, $dzs[3]->isPeerReview()); $this->assertEquals(true, $dzs[4]->isPeerReview()); $this->assertEquals(false, $dzs[5]->isPeerReview()); $this->assertEquals(false, $dzs[6]->isPeerReview()); $this->assertEquals(false, $dzs[7]->isPeerReview()); $dz2 = new Dropzone(); $dz2->setManualState(Dropzone::MANUAL_STATE_ALLOW_DROP_AND_PEER_REVIEW); $dz2->setManualPlanning(true); $dz2->setPeerReview(false); $this->assertEquals(false, $dz2->isPeerReview()); }
public function getResourcesNodeIdsForDownload(Dropzone $dropzone, $beginDate, $endDate) { $ids = array(); // on veut récupérer uniquement les drops terminés. foreach ($dropzone->getDrops() as $drop) { if ($drop->getFinished()) { //si date début & date de fin // no date => get all completed drops // if dates are not null , get only complete drop between the 2 dates. if ($beginDate == null && $endDate == null || $beginDate != null && $endDate != null && $this->isBetweenDates($beginDate, $endDate, $drop->getDropDate())) { // on récupère le dossier parent des documents. $documents = $drop->getDocuments(); if (count($documents) > 0) { $doc = $documents[0]; $rootId = $doc->getResourceNode()->getParent()->getId(); array_push($ids, $rootId); } } } } return $ids; }
private function addCorrectionCount(Dropzone $dropzone, $users) { $correctionRepo = $this->getDoctrine()->getManager()->getRepository('IcapDropzoneBundle:Correction'); $dropRepo = $this->getDoctrine()->getManager()->getRepository('IcapDropzoneBundle: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; }
private function createAgendaEventDrop($startDate, $endDate, $user, Dropzone $dropzone, $type = 'drop') { $event = new Event(); $event->setStart($startDate->getTimeStamp()); $event->setEnd($endDate->getTimeStamp()); $event->setUser($user); $dropzoneName = $dropzone->getResourceNode()->getName(); if ($type == 'drop') { $title = $this->get('translator')->trans('Deposit phase of the %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone'); $desc = $this->get('translator')->trans('Evaluation %dropzonename% opening', array('%dropzonename%' => $dropzoneName), 'icap_dropzone'); $event->setTitle($title); $event->setDescription($desc); } else { $title = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone'); $desc = $this->get('translator')->trans('Peer Review is starting in %dropzonename% evaluation', array('%dropzonename%' => $dropzoneName), 'icap_dropzone'); $event->setTitle($title); $event->setDescription($desc); } $em = $this->getDoctrine()->getManager(); $em->persist($event); $em->flush(); return $event; }
/** * @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); }
/** * @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); }