2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * @subpackage backup-imscc
19 * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com)
20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
25 class cc_label
extends entities
{
27 public function generate_node () {
29 cc2moodle
::log_action('Creating Labels mods');
33 $sheet_mod_label = cc2moodle
::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL
);
35 if (!empty(cc2moodle
::$instances['instances'][MOODLE_TYPE_LABEL
])) {
36 foreach (cc2moodle
::$instances['instances'][MOODLE_TYPE_LABEL
] as $instance) {
37 $response .= $this->create_node_course_modules_mod_label($sheet_mod_label, $instance);
44 private function create_node_course_modules_mod_label ($sheet_mod_label, $instance) {
45 if ($instance['deep'] <= ROOT_DEEP
) {
49 $find_tags = array('[#mod_instance#]',
54 $title = isset($instance['title']) && !empty($instance['title']) ?
$instance['title'] : 'Untitled';
55 $content = "<img src=\"$@FILEPHP@$$@SLASH@$"."files.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}";
56 $replace_values = array($instance['instance'],
57 self
::safexml($title),
58 self
::safexml($content),
61 return str_replace($find_tags, $replace_values, $sheet_mod_label);