You are here

function qformat_examview::unxmlise in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/examview/format.php \qformat_examview::unxmlise()

unxmlise reconstructs part of the xml data structure in order to identify the actual data therein

Parameters

array $xml section of the xml data structure:

Return value

string data with evrything else removed

7 calls to qformat_examview::unxmlise()
qformat_examview::parse_co in includes/moodle/question/format/examview/format.php
qformat_examview::parse_ma in includes/moodle/question/format/examview/format.php
qformat_examview::parse_matching_groups in includes/moodle/question/format/examview/format.php
qformat_examview::parse_mc in includes/moodle/question/format/examview/format.php
qformat_examview::parse_nr in includes/moodle/question/format/examview/format.php

... See full list

File

includes/moodle/question/format/examview/format.php, line 40

Class

qformat_examview

Code

function unxmlise($xml) {

  // if it's not an array then it's probably just data
  if (!is_array($xml)) {
    $text = s(addslashes($xml));
  }
  else {

    // otherwise parse the array
    $text = '';
    foreach ($xml as $tag => $data) {

      // if tag is '@' then it's attributes and we don't care
      if ($tag !== '@') {
        $text = $text . $this
          ->unxmlise($data);
      }
    }
  }

  // currently we throw the tags we found
  $text = strip_tags($text);
  return $text;
}