コード例 #1
0
ファイル: qcmExport.php プロジェクト: pitrackster/ExoBundle
 /**
  * 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();
 }
コード例 #2
0
 /**
  * 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();
 }
コード例 #3
0
 /**
  * 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();
 }
コード例 #4
0
ファイル: openExport.php プロジェクト: pitrackster/ExoBundle
 /**
  * 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());
     }
 }
コード例 #5
0
 public function load(ObjectManager $manager)
 {
     $arr_data = array(array($this->getReference('question1'), 'Une invite pour l\'interaction1 question1 FIX'), array($this->getReference('question1'), 'Une invite pour l\'interaction2 question1 FIX'), array($this->getReference('question2'), 'Une invite pour l\'interaction1 question2 FIX'), array($this->getReference('question2'), 'Une invite pour l\'interaction2 question2 FIX'));
     $inc = 1;
     foreach ($arr_data as $data) {
         $interaction = new Interaction();
         $interaction->setQuestion($data[0]);
         $interaction->setType('InteractionQCM');
         $interaction->setInvite($data[1]);
         $manager->persist($interaction);
         $manager->flush();
         $this->addReference('interaction' . $inc, $interaction);
         $inc++;
     }
 }
コード例 #6
0
ファイル: holeExport.php プロジェクト: pitrackster/ExoBundle
 /**
  * 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();
 }
コード例 #7
0
 /**
  * @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);
 }
コード例 #8
0
 /**
  * Get penalty for an interaction and a paper
  *
  * @access private
  *
  * @param \UJM\ExoBundle\Entity\Interaction $interaction
  * @param integer $paperID id Paper
  *
  * @return array
  */
 private function getPenalty($interaction, $paperID)
 {
     $penalty = 0;
     $hints = $interaction->getHints();
     foreach ($hints as $hint) {
         $lhp = $this->om->getRepository('UJMExoBundle:LinkHintPaper')->getLHP($hint->getId(), $paperID);
         if (count($lhp) > 0) {
             $signe = substr($hint->getPenalty(), 0, 1);
             if ($signe == '-') {
                 $penalty += substr($hint->getPenalty(), 1);
             } else {
                 $penalty += $hint->getPenalty();
             }
         }
     }
     return $penalty;
 }
コード例 #9
0
 /**
  * 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);
 }
コード例 #10
0
 /**
  * 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;
 }