|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00023 defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); 00024 00025 class cc_label extends entities { 00026 00027 public function generate_node () { 00028 00029 cc2moodle::log_action('Creating Labels mods'); 00030 00031 $response = ''; 00032 00033 $sheet_mod_label = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL); 00034 00035 if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL])) { 00036 foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL] as $instance) { 00037 $response .= $this->create_node_course_modules_mod_label($sheet_mod_label, $instance); 00038 } 00039 } 00040 00041 return $response; 00042 } 00043 00044 private function create_node_course_modules_mod_label ($sheet_mod_label, $instance) { 00045 if ($instance['deep'] <= ROOT_DEEP) { 00046 return ''; 00047 } 00048 00049 $find_tags = array('[#mod_instance#]', 00050 '[#mod_name#]', 00051 '[#mod_content#]', 00052 '[#date_now#]'); 00053 00054 $title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : 'Untitled'; 00055 $content = "<img src=\"$@FILEPHP@$$@SLASH@$"."folder.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}"; 00056 $replace_values = array($instance['instance'], 00057 self::safexml($title), 00058 self::safexml($content), 00059 time()); 00060 00061 return str_replace($find_tags, $replace_values, $sheet_mod_label); 00062 } 00063 }