protected function get_unit_interaction(ImsXmlReader $item) { $interactions = $item->list_interactions(); $main = self::get_main_interaction($item); if (count($interactions) == 2) { return $interactions[0]->responseIdentifier == $main->responseIdentifier ? $interactions[1] : $interactions[0]; } else { return $item->get_default_result(); } }
public static function is_calculated(ImsXmlReader $item) { if (!$item->has_templateDeclaration()) { return false; } $templates = $item->list_templateDeclaration(); foreach ($templates as $template) { $base_type = $template->baseType; if ($base_type != Qti::BASETYPE_FLOAT && $base_type != Qti::BASETYPE_INTEGER) { return false; } } return true; }
protected function to_html(ImsXmlReader $item) { $xml = $item->get_xml(); $variables = $item->all_printedVariable(); foreach ($variables as $var) { $var_xml = $var->get_xml(); $name = '{' . $var->identifier . '}'; $xml = str_replace($var_xml, $name, $xml); } $xml = '<?xml version="1.0" encoding="UTF-8" ?>' . $xml; $item = new ImsQtiReader(); $item->load_xml($xml); $result = parent::to_html($item); return $result; }
/** * @return ImsXmlReader */ public function get_reader() { if (!empty($this->reader)) { return $this->reader; } if (!file_exists($this->path)) { return $this->reader = ImsXmlReader::get_empty_reader(); } $path = $this->path; $ext = pathinfo($path, PATHINFO_EXTENSION); if ($ext == 'xml') { return $this->reader = new ImsQtiReader($path); } else { return $this->reader = ImsXmlReader::get_empty_reader(); } }
protected function process_baseValue(ImsXmlReader $item) { $base_type = $item->baseType; $value = $item->value(); return $value; }