protected function getTemplateQtiVariables() { $variables = parent::getTemplateQtiVariables(); $variables['defaultValue'] = null; $defaultValue = $this->getDefaultValue(); if (!is_null($defaultValue) || trim($defaultValue) != '') { $variables['defaultValue'] = $defaultValue; } return $variables; }
protected function getTemplateQtiVariables() { $variables = parent::getTemplateQtiVariables(); $variables['correctResponses'] = $this->getCorrectResponses(); $variables['defaultValue'] = $this->getDefaultValue(); $variables['mapping'] = $this->mapping; $variables['areaMapping'] = $this->areaMapping; //@todo : clean this please: do not use a class attributes to store childdren's ones! unset($variables['attributes']['mapping']); unset($variables['attributes']['areaMapping']); $mappingAttributes = array('defaultValue' => $this->mappingDefaultValue); if (is_array($this->getAttributeValue('mapping'))) { $mappingAttributes = array_merge($mappingAttributes, $this->getAttributeValue('mapping')); } elseif (is_array($this->getAttributeValue('areaMapping'))) { $mappingAttributes = array_merge($mappingAttributes, $this->getAttributeValue('areaMapping')); } $variables['mappingAttributes'] = $this->xmlizeOptions($mappingAttributes, true); $rpTemplate = ''; switch ($this->howMatch) { case Template::MATCH_CORRECT: $rpTemplate = 'match_correct'; break; case Template::MAP_RESPONSE: $rpTemplate = 'map_response'; break; case Template::MAP_RESPONSE_POINT: $rpTemplate = 'map_response_point'; break; } $variables['howMatch'] = $this->howMatch; //the template $variables['rpTemplate'] = $rpTemplate; //the template return $variables; }