/** * Implements the abstract method * * @access public * @param \UJM\ExoBundle\Entity\Interaction $interaction * @param qtiRepository $qtiRepos * */ public function export(\UJM\ExoBundle\Entity\Interaction $interaction, qtiRepository $qtiRepos) { $this->qtiRepos = $qtiRepos; $this->question = $interaction->getQuestion(); $this->interactiongraph = $this->doctrine->getManager()->getRepository('UJMExoBundle:InteractionGraphic')->findOneBy(array('interaction' => $interaction->getId())); if (count($this->interactiongraph->getCoords()) > 1) { $cardinality = 'multiple'; } else { $cardinality = 'single'; } $this->qtiHead('selectPoint', $this->question->getTitle()); $this->qtiResponseDeclaration('RESPONSE', 'point', $cardinality); $this->qtiOutComeDeclaration(); $this->correctResponseTag(); $this->areaMappingTag(); $this->itemBodyTag(); $this->selectPointInteractionTag(); $this->promptTag(); if ($this->interactiongraph->getInteraction()->getFeedBack() != Null && $this->interactiongraph->getInteraction()->getFeedBack() != "") { $this->qtiFeedBack($interaction->getFeedBack()); } $this->document->save($this->qtiRepos->getUserDir() . $this->question->getId() . '_qestion_qti.xml'); $this->getPicture(); return $this->getResponse(); }
/** * Implements the abstract method * * @access public * @param \UJM\ExoBundle\Entity\Interaction $interaction * @param qtiRepository $qtiRepos * */ public function export(\UJM\ExoBundle\Entity\Interaction $interaction, qtiRepository $qtiRepos) { $this->qtiRepos = $qtiRepos; $this->question = $interaction->getQuestion(); $this->interactionqcm = $this->doctrine->getManager()->getRepository('UJMExoBundle:InteractionQCM')->findOneBy(array('interaction' => $interaction->getId())); //if it's Null mean "Global notation for QCM" Else it's Notation for each choice $weightresponse = $this->interactionqcm->getWeightResponse(); if ($this->interactionqcm->getTypeQCM() == 'Multiple response') { $choiceType = 'choiceMultiple'; $cardinality = 'multiple'; } else { $choiceType = 'choice'; $cardinality = 'single'; } $this->qtiHead($choiceType, $this->question->getTitle()); $this->qtiResponseDeclaration('RESPONSE', 'identifier', $cardinality); $this->qtiOutComeDeclaration(); $this->correctResponseTag(); $this->itemBodyTag(); $this->choiceInteractionTag(); $this->promptTag(); //comment globale for this question if ($this->interactionqcm->getInteraction()->getFeedBack() != Null && $this->interactionqcm->getInteraction()->getFeedBack() != "") { $this->qtiFeedBack($interaction->getFeedBack()); } if ($weightresponse == false) { $this->node->appendChild($this->responseProcessing); } $this->document->save($this->qtiRepos->getUserDir() . $this->question->getId() . '_qestion_qti.xml'); return $this->getResponse(); }
/** * Implements the abstract method * * @access public * @param \UJM\ExoBundle\Entity\Interaction $interaction * @param qtiRepository $qtiRepos */ public function export(\UJM\ExoBundle\Entity\Interaction $interaction, qtiRepository $qtiRepos) { $this->qtiRepos = $qtiRepos; $this->question = $interaction->getQuestion(); $this->interactionmatching = $this->doctrine->getManager()->getRepository('UJMExoBundle:InteractionMatching')->findOneBy(array('interaction' => $interaction->getId())); if ($this->interactionmatching->getTypeMatching() == 'To bind') { $this->cardinality = 'multiple'; } else { $this->cardinality = 'single'; } $matchingType = 'match'; $this->qtiHead($matchingType, $this->question->getTitle()); $this->qtiResponseDeclaration('RESPONSE', 'identifier', $this->cardinality); $this->qtiOutComeDeclaration(); $this->correctResponseTag(); $this->itemBodyTag(); $this->matchingInteractionTag(); $this->promptTag(); //comment globale for this question if ($this->interactionmatching->getInteraction()->getFeedBack() != Null && $this->interactionmatching->getInteraction()->getFeedBack() != "") { $this->qtiFeedBack($interaction->getFeedBack()); } $this->document->save($this->qtiRepos->getUserDir() . $this->question->getId() . '_qestion_qti.xml'); return $this->getResponse(); }
/** * Implements the abstract method * * @access public * @param \UJM\ExoBundle\Entity\Interaction $interaction * @param qtiRepository $qtiRepos * */ public function export(\UJM\ExoBundle\Entity\Interaction $interaction, qtiRepository $qtiRepos) { $this->qtiRepos = $qtiRepos; $this->question = $interaction->getQuestion(); $this->interactionopen = $this->doctrine->getManager()->getRepository('UJMExoBundle:InteractionOpen')->findOneBy(array('interaction' => $interaction->getId())); $this->qtiHead('extendedText', $this->question->getTitle()); $this->qtiResponseDeclaration('RESPONSE', 'string', $this->getCardinality()); $this->qtiOutComeDeclaration(); $this->defaultValueTag(); $this->itemBodyTag(); if ($this->interactionopen->getInteraction()->getFeedBack() != Null && $this->interactionopen->getInteraction()->getFeedBack() != "") { $this->qtiFeedBack($interaction->getFeedBack()); } }
/** * Implements the abstract method * * @access public * @param \UJM\ExoBundle\Entity\Interaction $interaction * @param qtiRepository $qtiRepos * */ public function export(\UJM\ExoBundle\Entity\Interaction $interaction, qtiRepository $qtiRepos) { $this->qtiRepos = $qtiRepos; $this->question = $interaction->getQuestion(); $this->interactionhole = $this->doctrine->getManager()->getRepository('UJMExoBundle:InteractionHole')->findOneBy(array('interaction' => $interaction->getId())); $this->qtiHead('textEntry', $this->question->getTitle()); foreach ($this->interactionhole->getHoles() as $hole) { $numberBlank = $this->nbResponseDeclaration + 1; $this->qtiResponseDeclaration('blank_' . $numberBlank, 'string', 'single'); $this->correctResponseTag(); $this->mappingTag($hole); } $this->qtiOutComeDeclaration(); $this->itemBodyTag(); $this->promptTag(); $this->textWithHole(); if ($this->interactionhole->getInteraction()->getFeedBack() != Null && $this->interactionhole->getInteraction()->getFeedBack() != "") { $this->qtiFeedBack($interaction->getFeedBack()); } $this->document->save($this->qtiRepos->getUserDir() . $this->question->getId() . '_qestion_qti.xml'); return $this->getResponse(); }
/** * @param \UJM\ExoBundle\Entity\Interaction $interaction * * @return int */ public function getNbReponses($interaction) { $em = $this->doctrine->getEntityManager(); $response = $em->getRepository('UJMExoBundle:Response')->findBy(['question' => $interaction->getId()]); return count($response); }
/** * For an interaction know if it's linked with response and if it's shared * * @access public * * @param Doctrine EntityManager $em * @param \UJM\ExoBundle\Entity\Interaction $interaction * * @return array */ public function getActionInteraction($em, $interaction) { $response = $em->getRepository('UJMExoBundle:Response')->findBy(array('interaction' => $interaction->getId())); if (count($response) > 0) { $questionWithResponse[$interaction->getId()] = 1; } else { $questionWithResponse[$interaction->getId()] = 0; } $share = $em->getRepository('UJMExoBundle:Share')->findBy(array('question' => $interaction->getQuestion()->getId())); if (count($share) > 0) { $alreadyShared[$interaction->getQuestion()->getId()] = 1; } else { $alreadyShared[$interaction->getQuestion()->getId()] = 0; } $actions[0] = $questionWithResponse; $actions[1] = $alreadyShared; return $actions; }
/** * For the navigation in a paper * Finds and displays the question selectionned by the User in an assesment * * @access private * * @param integer $numQuestionToDisplayed position of the question in the paper * @param \UJM\ExoBundle\Entity\Interaction $interactionToDisplay interaction (question) to displayed * @param String $typeInterToDisplayed * @param boolean $dispButtonInterrupt to display or no the button "Interrupt" * @param integer $maxAttempsAllowed the number of max attemps allowed for the exercise * @param Claroline workspace $workspace * @param \UJM\ExoBundle\Entity\Paper $paper current paper * * @return \Symfony\Component\HttpFoundation\Response */ private function displayQuestion($numQuestionToDisplayed, $interactionToDisplay, $typeInterToDisplayed, $dispButtonInterrupt, $maxAttempsAllowed, $workspace, $paper) { $em = $this->getDoctrine()->getManager(); $session = $this->getRequest()->getSession(); $tabOrderInter = $session->get('tabOrderInter'); switch ($typeInterToDisplayed) { case "InteractionQCM": $interactionToDisplayed = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:InteractionQCM')->getInteractionQCM($interactionToDisplay->getId()); if ($interactionToDisplayed[0]->getShuffle()) { $interactionToDisplayed[0]->shuffleChoices(); } else { $interactionToDisplayed[0]->sortChoices(); } $responseGiven = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:Response')->getAlreadyResponded($session->get('paper'), $interactionToDisplay->getId()); if (count($responseGiven) > 0) { $responseGiven = $responseGiven[0]->getResponse(); } else { $responseGiven = ''; } break; case "InteractionGraphic": $interactionToDisplayed = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:InteractionGraphic')->getInteractionGraphic($interactionToDisplay->getId()); $coords = $em->getRepository('UJMExoBundle:Coords')->findBy(array('interactionGraphic' => $interactionToDisplayed[0]->getId())); $responseGiven = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:Response')->getAlreadyResponded($session->get('paper'), $interactionToDisplay->getId()); if (count($responseGiven) > 0) { $responseGiven = $responseGiven[0]->getResponse(); } else { $responseGiven = ''; } $array['listCoords'] = $coords; break; case "InteractionHole": $interactionToDisplayed = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:InteractionHole')->getInteractionHole($interactionToDisplay->getId()); $responseGiven = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:Response')->getAlreadyResponded($session->get('paper'), $interactionToDisplay->getId()); if (count($responseGiven) > 0) { $responseGiven = $responseGiven[0]->getResponse(); } else { $responseGiven = ''; } break; case "InteractionOpen": $interactionToDisplayed = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:InteractionOpen')->getInteractionOpen($interactionToDisplay->getId()); $responseGiven = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:Response')->getAlreadyResponded($session->get('paper'), $interactionToDisplay->getId()); if (count($responseGiven) > 0) { $responseGiven = $responseGiven[0]->getResponse(); } else { $responseGiven = ''; } break; case "InteractionMatching": $interactionToDisplayed = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:InteractionMatching')->getInteractionMatching($interactionToDisplay->getId()); if ($interactionToDisplayed[0]->getShuffle()) { $interactionToDisplayed[0]->shuffleProposals(); $interactionToDisplayed[0]->shuffleLabels(); } else { $interactionToDisplayed[0]->sortProposals(); $interactionToDisplayed[0]->sortLabels(); } $responseMatch = $this->getDoctrine()->getManager()->getRepository('UJMExoBundle:Response')->getAlreadyResponded($session->get('paper'), $interactionToDisplay->getId()); if (count($responseMatch) > 0) { $responseGiven = $this->container->get('ujm.exercise_services')->getTabResponseIndex($responseMatch[0]->getResponse()); } else { $responseGiven = ''; } break; } $array['workspace'] = $workspace; $array['tabOrderInter'] = $tabOrderInter; $array['interactionToDisplayed'] = $interactionToDisplayed[0]; $array['interactionType'] = $typeInterToDisplayed; $array['numQ'] = $numQuestionToDisplayed; $array['paper'] = $session->get('paper'); $array['numAttempt'] = $paper->getNumPaper(); $array['response'] = $responseGiven; $array['dispButtonInterrupt'] = $dispButtonInterrupt; $array['maxAttempsAllowed'] = $maxAttempsAllowed; $array['_resource'] = $paper->getExercise(); return $this->render('UJMExoBundle:Exercise:paper.html.twig', $array); }
/** * For the navigation in a paper * Finds and displays the question selected by the User in an assessment. * * * @param int $numQuestionToDisplayed position of the question in the paper * @param \UJM\ExoBundle\Entity\Interaction $interactionToDisplay interaction (question) to displayed * @param string $typeInterToDisplayed * @param bool $dispButtonInterrupt to display or no the button "Interrupt" * @param int $maxAttempsAllowed the number of max attemps allowed for the exercise * @param Claroline workspace $workspace * @param \UJM\ExoBundle\Entity\Paper $paper current paper * @param SessionInterface session * * @return array */ public function displayQuestion($numQuestionToDisplayed, $interactionToDisplay, $typeInterToDisplayed, $dispButtonInterrupt, $maxAttempsAllowed, $workspace, Paper $paper, SessionInterface $session) { $tabOrderInter = $session->get('tabOrderInter'); $interSer = $this->container->get('ujm.exo_' . $interactionToDisplay->getType()); $interactionToDisplayed = $interSer->getInteractionX($interactionToDisplay->getId()); $responseGiven = $interSer->getResponseGiven($interactionToDisplay, $session, $interactionToDisplayed); $array['workspace'] = $workspace; $array['tabOrderInter'] = $tabOrderInter; $array['interactionToDisplayed'] = $interactionToDisplayed; $array['interactionType'] = $typeInterToDisplayed; $array['numQ'] = $numQuestionToDisplayed; $array['paper'] = $session->get('paper'); $array['numAttempt'] = $paper->getNumPaper(); $array['response'] = $responseGiven; $array['dispButtonInterrupt'] = $dispButtonInterrupt; $array['maxAttempsAllowed'] = $maxAttempsAllowed; $array['_resource'] = $paper->getExercise(); return $array; }