From 754794658047592e8dc663b9204eae3c19b0aed4 Mon Sep 17 00:00:00 2001 From: Darko Miletic Date: Thu, 14 Jun 2012 17:12:53 -0300 Subject: [PATCH] MDL-33523: Fixed item C of the issue --- backup/cc/cc2moodle.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/backup/cc/cc2moodle.php b/backup/cc/cc2moodle.php index 013d89123eb..05e8239f12d 100644 --- a/backup/cc/cc2moodle.php +++ b/backup/cc/cc2moodle.php @@ -620,15 +620,23 @@ class cc2moodle { $array_index++; if ($item->nodeName == "item") { + $identifierref = ''; + if ($item->hasAttribute('identifierref')) { + $identifierref = $item->getAttribute('identifierref'); + } - $identifierref = $xpath->query('@identifierref', $item); - $identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : ''; - - $title = $xpath->query('imscc:title', $item); - $title = !empty($title->item(0)->nodeValue) ? $title->item(0)->nodeValue : ''; + $title = ''; + $titles = $xpath->query('imscc:title', $item); + if ($titles->length > 0) { + $title = $titles->item(0)->nodeValue; + } $cc_type = $this->get_item_cc_type($identifierref); $moodle_type = $this->convert_to_moodle_type($cc_type); + //Fix the label issue - MDL-33523 + if (empty($identifierref) && empty($title)) { + $moodle_type = TYPE_UNKNOWN; + } } elseif ($item->nodeName == "resource") {