private function createFixturesDropzones() { $dz0 = new Dropzone(); $dz0->setManualState(Dropzone::MANUAL_STATE_NOT_STARTED); $dz0->setManualPlanning(true); $dz0->setPeerReview(true); $dz1 = new Dropzone(); $dz1->setManualState(Dropzone::MANUAL_STATE_ALLOW_DROP); $dz1->setManualPlanning(true); $dz1->setPeerReview(true); $dz2 = new Dropzone(); $dz2->setManualState(Dropzone::MANUAL_STATE_ALLOW_DROP_AND_PEER_REVIEW); $dz2->setManualPlanning(true); $dz2->setPeerReview(true); $dz3 = new Dropzone(); $dz3->setManualState(Dropzone::MANUAL_STATE_FINISHED); $dz3->setManualPlanning(true); $dz3->setPeerReview(true); $dz4 = new Dropzone(); $dz4->setManualState(Dropzone::MANUAL_STATE_PEER_REVIEW); $dz4->setManualPlanning(true); $dz4->setPeerReview(true); $dz5 = new Dropzone(); $dz5->setManualPlanning(false); $dz5->setStartAllowDrop(new \DateTime()); $dateEnd6 = DateTime::createFromFormat('d-m-Y', '15-02-2019'); $dz5->setEndAllowDrop($dateEnd6); $dz5->setPeerReview(true); $dz6 = new Dropzone(); $dz6->setManualPlanning(false); $date7 = DateTime::createFromFormat('d-m-Y', '15-02-2010'); $dateEnd7 = DateTime::createFromFormat('d-m-Y', '15-02-2011'); $dz6->setStartAllowDrop($date7); $dz6->setEndAllowDrop($dateEnd7); $dz6->setPeerReview(true); $dz7 = new Dropzone(); $dz7->setManualPlanning(false); $date8 = DateTime::createFromFormat('d-m-Y', '15-02-2019'); $dateEnd8 = DateTime::createFromFormat('d-m-Y', '15-02-2020'); $dz7->setStartAllowDrop($date8); $dz7->setEndAllowDrop($dateEnd8); $dz7->setPeerReview(true); return array($dz0, $dz1, $dz2, $dz3, $dz4, $dz5, $dz6, $dz7); }
/** * @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(); }