function getXML($mod, $counter, $activity = true, &$node, &$xmlDoc) { global $DEFAULT_LANG; if ($activity) { $struct = $xmlDoc->createElement("activity"); $struct->appendChild($xmlDoc->createAttribute("type"))->appendChild($xmlDoc->createTextNode($mod->modname)); $struct->appendChild($xmlDoc->createAttribute("order"))->appendChild($xmlDoc->createTextNode($counter)); $struct->appendChild($xmlDoc->createAttribute("digest"))->appendChild($xmlDoc->createTextNode($this->md5)); $node->appendChild($struct); } $title = extractLangs($mod->name); if (is_array($title) && count($title) > 0) { foreach ($title as $l => $t) { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($t))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($l)); $struct->appendChild($temp); } } else { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($mod->name))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $struct->appendChild($temp); } $description = extractLangs($this->resource->intro); if (is_array($description) && count($description) > 0) { foreach ($description as $l => $d) { $temp = $xmlDoc->createElement("description"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($d))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($l)); $struct->appendChild($temp); } } else { $description = strip_tags($this->resource->intro); if ($description != "") { $temp = $xmlDoc->createElement("description"); $temp->appendChild($xmlDoc->createTextNode($description)); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $struct->appendChild($temp); } } $temp = $xmlDoc->createElement("location", $this->resource_filename); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $temp->appendChild($xmlDoc->createAttribute("type"))->appendChild($xmlDoc->createTextNode($this->resource_type)); $struct->appendChild($temp); if ($this->resource_image) { $temp = $xmlDoc->createElement("image"); $temp->appendChild($xmlDoc->createAttribute("filename"))->appendChild($xmlDoc->createTextNode($this->resource_image)); $struct->appendChild($temp); } }
function getXML($mod, $counter, $activity = true, &$node, &$xmlDoc) { global $DEFAULT_LANG; if ($activity) { $struct = $xmlDoc->createElement("activity"); $struct->appendChild($xmlDoc->createAttribute("type"))->appendChild($xmlDoc->createTextNode($mod->modname)); $struct->appendChild($xmlDoc->createAttribute("order"))->appendChild($xmlDoc->createTextNode($counter)); $struct->appendChild($xmlDoc->createAttribute("digest"))->appendChild($xmlDoc->createTextNode($this->md5)); $node->appendChild($struct); } else { $struct = $xmlDoc->createElement("page"); $struct->appendChild($xmlDoc->createAttribute("id"))->appendChild($xmlDoc->createTextNode($this->id)); $node->appendChild($struct); } $title = extractLangs($mod->name); if (is_array($title) && count($title) > 0) { foreach ($title as $l => $t) { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($t))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($l)); $struct->appendChild($temp); } } else { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($mod->name))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $struct->appendChild($temp); } // add in page media if (count($this->page_media) > 0) { $media = $xmlDoc->createElement("media"); foreach ($this->page_media as $m) { $temp = $xmlDoc->createElement("file"); foreach ($m as $var => $value) { $temp->appendChild($xmlDoc->createAttribute($var))->appendChild($xmlDoc->createTextNode($value)); } $media->appendChild($temp); } $struct->appendChild($media); } if (count($this->page_related) > 0) { $related = $xmlDoc->createElement("related"); foreach ($this->page_related as $r) { $temp = $xmlDoc->createElement("activity"); $temp->appendChild($xmlDoc->createAttribute("order"))->appendChild($xmlDoc->createTextNode($r->order)); $temp->appendChild($xmlDoc->createAttribute("digest"))->appendChild($xmlDoc->createTextNode($r->digest)); foreach ($r->activity as $a) { $title = $xmlDoc->createElement("title"); $title->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($a->lang)); $title->appendChild($xmlDoc->createTextNode(strip_tags($a->title))); $temp->appendChild($title); } $related->appendChild($temp); } $struct->appendChild($related); } if ($this->page_image) { $temp = $xmlDoc->createElement("image"); $temp->appendChild($xmlDoc->createAttribute("filename"))->appendChild($xmlDoc->createTextNode($this->page_image)); $struct->appendChild($temp); } foreach ($this->act as $act) { $temp = $xmlDoc->createElement("location", $act->filename); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($act->lang)); $struct->appendChild($temp); } }
unlink($course_root . "/" . $filename) or die('Unable to delete the file'); $temp = $xmlDoc->createElement("image"); $temp->appendChild($xmlDoc->createAttribute("filename"))->appendChild($xmlDoc->createTextNode("/images/" . $resizedFilename)); $meta->appendChild($temp); } $index = array(); $structure = $xmlDoc->createElement("structure"); $sect_orderno = 1; foreach ($sections as $sect) { flush_buffers(); $sectionmods = explode(",", $sect->sequence); if (strip_tags($sect->summary) != "" && count($sectionmods) > 0) { echo "<h3>" . get_string('export_section_title', 'block_oppia_mobile_export', strip_tags($sect->summary, '<span>')) . "</h3>"; $section = $xmlDoc->createElement("section"); $section->appendChild($xmlDoc->createAttribute("order"))->appendChild($xmlDoc->createTextNode($sect_orderno)); $title = extractLangs($sect->summary); if (is_array($title) && count($title) > 0) { foreach ($title as $l => $t) { $temp = $xmlDoc->createElement("title", strip_tags($t)); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($l)); $section->appendChild($temp); } } else { $temp = $xmlDoc->createElement("title", strip_tags($sect->summary)); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $section->appendChild($temp); } // get image for this section $filename = extractImageFile($sect->summary, 'course', 'section', $sect->id, $context->id, $course_root, 0); if ($filename) { $temp = $xmlDoc->createElement("image");
function getXML($mod, $counter, $activity = true, &$node, &$xmlDoc) { global $DEFAULT_LANG; $act = $xmlDoc->createElement("activity"); $act->appendChild($xmlDoc->createAttribute("type"))->appendChild($xmlDoc->createTextNode($mod->modname)); $act->appendChild($xmlDoc->createAttribute("order"))->appendChild($xmlDoc->createTextNode($counter)); $act->appendChild($xmlDoc->createAttribute("digest"))->appendChild($xmlDoc->createTextNode($this->md5)); $title = extractLangs($mod->name); if (is_array($title) && count($title) > 0) { foreach ($title as $l => $t) { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($t))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($l)); $act->appendChild($temp); } } else { $temp = $xmlDoc->createElement("title"); $temp->appendChild($xmlDoc->createTextNode(strip_tags($mod->name))); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode($DEFAULT_LANG)); $act->appendChild($temp); } $temp = $xmlDoc->createElement("content"); $temp->appendChild($xmlDoc->createTextNode($this->content)); $temp->appendChild($xmlDoc->createAttribute("lang"))->appendChild($xmlDoc->createTextNode("en")); $act->appendChild($temp); if ($this->quiz_image) { $temp = $xmlDoc->createElement("image"); $temp->appendChild($xmlDoc->createAttribute("filename"))->appendChild($xmlDoc->createTextNode($this->quiz_image)); $act->appendChild($temp); } $node->appendChild($act); }