コード例 #1
0
 protected function getTemplateQtiVariables()
 {
     $variables = parent::getTemplateQtiVariables();
     $variables['typeIdentifier'] = $this->typeIdentifier;
     $variables['markup'] = $this->markup;
     return $variables;
 }
コード例 #2
0
 /**
  * Short description of method takeNoticeOfRemovedInteraction
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Interaction interaction
  * @param  Item item
  * @return mixed
  */
 public function takeNoticeOfRemovedInteraction(Interaction $interaction, Item $item)
 {
     $irpExisted = false;
     foreach ($this->components as $key => $irp) {
         if ($irp->getResponse() === $interaction->getResponse()) {
             unset($this->components[$key]);
             $irpExisted = true;
             break;
         }
     }
     if (!$irpExisted) {
         common_Logger::w('InstanceResponseProcessing not found for removed interaction ' . $interaction->getIdentifier(), array('TAOITEMS', 'QTI'));
     }
 }
コード例 #3
0
 protected function buildInteractionChoices(Interaction $interaction, $data)
 {
     if (isset($data['choices'])) {
         if ($interaction instanceof MatchInteraction) {
             for ($i = 0; $i < 2; $i++) {
                 if (!isset($data['choices'][$i])) {
                     throw new ParsingException('missint matchSet for match interaction ' . $i);
                 }
                 $matchSet = $data['choices'][$i];
                 foreach ($matchSet as $choiceData) {
                     $choice = $this->buildElement($choiceData);
                     if (!is_null($choice)) {
                         $interaction->addChoice($choice, $i);
                     }
                 }
             }
         } else {
             foreach ($data['choices'] as $choiceData) {
                 $choice = $this->buildElement($choiceData);
                 if (!is_null($choice)) {
                     $interaction->addChoice($choice);
                 }
             }
         }
         if ($interaction instanceof GraphicGapMatchInteraction && isset($data['gapImgs'])) {
             foreach ($data['gapImgs'] as $gapImgData) {
                 $gapImg = $this->buildElement($gapImgData);
                 if (!is_null($gapImg)) {
                     $interaction->addGapImg($gapImg);
                 }
             }
         }
     }
 }
コード例 #4
0
 /**
  * Short description of method takeNoticeOfAddedInteraction
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Interaction interaction
  * @param  Item item
  * @return mixed
  */
 public function takeNoticeOfAddedInteraction(Interaction $interaction, Item $item)
 {
     $interaction->getResponse()->setHowMatch(Template::MATCH_CORRECT);
 }
コード例 #5
0
 protected function getTemplateQtiVariables()
 {
     $variables = parent::getTemplateQtiVariables();
     if (trim($this->getPrompt()->getBody()) !== '') {
         //prompt is optional:
         $variables['prompt'] = $this->prompt->toQTI();
     }
     return $variables;
 }