From 65345f200c9bc5cf7668107f3f9e2cd723db38ca Mon Sep 17 00:00:00 2001 From: Darko Miletic Date: Thu, 14 Jun 2012 18:05:32 -0300 Subject: [PATCH] MDL-33523: fix --- backup/cc/cc2moodle.php | 18 +++++++++++++----- backup/cc/entities.class.php | 4 ++-- backup/cc/entities11.class.php | 6 +++--- backup/cc/entity.label.class.php | 2 +- 4 files changed, 19 insertions(+), 11 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") { diff --git a/backup/cc/entities.class.php b/backup/cc/entities.class.php index 625d390bc3b..e0737fdca11 100644 --- a/backup/cc/entities.class.php +++ b/backup/cc/entities.class.php @@ -262,14 +262,14 @@ class entities { if (!empty($labels) && ($labels->length > 0)) { $tname = 'course_files'; $dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname; - $rfpath = 'folder.gif'; + $rfpath = 'files.gif'; $fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath; if (!file_exists($dpath)) { mkdir($dpath); } //copy the folder.gif file - $folder_gif = "{$CFG->dirroot}/pix/f/folder.gif"; + $folder_gif = "{$CFG->dirroot}/pix/i/files.gif"; copy($folder_gif, $fpath); $all_files[] = $rfpath; } diff --git a/backup/cc/entities11.class.php b/backup/cc/entities11.class.php index 9af9f3c89c0..e9873da72a6 100644 --- a/backup/cc/entities11.class.php +++ b/backup/cc/entities11.class.php @@ -62,13 +62,13 @@ class entities11 extends entities { if (!empty($labels) && ($labels->length > 0)) { $tname = 'course_files'; $dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname; - $rfpath = 'folder.gif'; - $fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif'; + $rfpath = 'files.gif'; + $fpath = $dpath . DIRECTORY_SEPARATOR . 'files.gif'; if (!file_exists($dpath)) { mkdir($dpath); } //copy the folder.gif file - $folder_gif = "{$CFG->dirroot}/pix/f/folder.gif"; + $folder_gif = "{$CFG->dirroot}/pix/i/files.gif"; copy($folder_gif, $fpath); $all_files[] = $rfpath; } diff --git a/backup/cc/entity.label.class.php b/backup/cc/entity.label.class.php index 6c27bf2b27b..e8dfe82efcb 100644 --- a/backup/cc/entity.label.class.php +++ b/backup/cc/entity.label.class.php @@ -52,7 +52,7 @@ class cc_label extends entities { '[#date_now#]'); $title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : 'Untitled'; - $content = "\"Folder\" {$title}"; + $content = "\"Folder\" {$title}"; $replace_values = array($instance['instance'], self::safexml($title), self::safexml($content),