Example #1
0
 /**
  * Create choices
  *
  * @access protected
  *
  */
 protected function createChoices()
 {
     $order = 1;
     $ib = $this->assessmentItem->getElementsByTagName("itemBody")->item(0);
     $ci = $ib->getElementsByTagName("choiceInteraction")->item(0);
     foreach ($ci->getElementsByTagName("simpleChoice") as $simpleChoice) {
         $choice = new Choice();
         if ($simpleChoice->hasAttribute("fixed") && $simpleChoice->getAttribute("fixed") == 'true') {
             $choice->setPositionForce(true);
         }
         $feedback = $simpleChoice->getElementsByTagName("feedbackInline");
         if ($feedback->item(0)) {
             $choice->setFeedback($feedback->item(0)->nodeValue);
             $simpleChoice->removeChild($feedback->item(0));
         }
         $choice->setLabel($this->choiceValue($simpleChoice));
         $choice->setOrdre($order);
         $choice->setWeight($this->getWeightChoice($simpleChoice->getAttribute("identifier")));
         $choice->setRightResponse($this->getRightResponse($simpleChoice->getAttribute("identifier")));
         $choice->setInteractionQCM($this->interactionQCM);
         $this->om->persist($choice);
         $order++;
     }
     $this->om->flush();
 }
Example #2
0
 /**
  * Create choices.
  */
 protected function createChoices()
 {
     $order = 1;
     $ib = $this->assessmentItem->getElementsByTagName('itemBody')->item(0);
     $ci = $ib->getElementsByTagName('choiceInteraction')->item(0);
     foreach ($ci->getElementsByTagName('simpleChoice') as $simpleChoice) {
         $choice = new Choice();
         if ($simpleChoice->hasAttribute('fixed') && $simpleChoice->getAttribute('fixed') === 'true') {
             $choice->setPositionForce(true);
         }
         $feedback = $simpleChoice->getElementsByTagName('feedbackInline');
         if ($feedback->item(0)) {
             $feedbackVal = $this->domElementToString($feedback->item(0));
             $feedbackVal = html_entity_decode($feedbackVal);
             $choice->setFeedback($feedbackVal);
             $simpleChoice->removeChild($feedback->item(0));
         }
         $choice->setLabel($this->choiceValue($simpleChoice));
         $choice->setOrdre($order);
         $choice->setWeight($this->getWeightChoice($simpleChoice->getAttribute('identifier')));
         $choice->setRightResponse($this->getRightResponse($simpleChoice->getAttribute('identifier')));
         $choice->setInteractionQCM($this->interactionQCM);
         $this->om->persist($choice);
         ++$order;
     }
     $this->om->flush();
 }