unset($hostlog->modinfo);
$modulearray = array();
foreach($modinfo as $module) {
- $modulearray[$module->cm] = urldecode($module->name);
+ $modulearray[$module->cm] = $module->name;
}
$hostlog->resource_name = $modulearray[$hostlog->cmid];
} else {
if (!empty($info->icon)) {
$mod[$seq]->icon = $info->icon;
}
+ if (!empty($info->iconcomponent)) {
+ $mod[$seq]->iconcomponent = $info->iconcomponent;
+ }
if (!empty($info->name)) {
- $mod[$seq]->name = urlencode($info->name);
+ $mod[$seq]->name = $info->name;
}
}
}
if (!isset($mod[$seq]->name)) {
- $mod[$seq]->name = urlencode($DB->get_field($rawmods[$seq]->modname, "name", array("id"=>$rawmods[$seq]->instance)));
+ $mod[$seq]->name = $DB->get_field($rawmods[$seq]->modname, "name", array("id"=>$rawmods[$seq]->instance));
}
}
}
$activities["section/$mod->section"] = "-------------- $strsection $mod->section --------------";
}
$section = $mod->section;
- $mod->name = strip_tags(format_string(urldecode($mod->name),true));
+ $mod->name = strip_tags(format_string($mod->name, true));
if (strlen($mod->name) > 55) {
$mod->name = substr($mod->name, 0, 50)."...";
}
$activities["section/$mod->section"] = "-------------- $strsection $mod->section --------------";
}
$section = $mod->section;
- $mod->name = strip_tags(format_string(urldecode($mod->name),true));
+ $mod->name = strip_tags(format_string($mod->name, true));
if (strlen($mod->name) > 55) {
$mod->name = substr($mod->name, 0, 50)."...";
}
}
// Some names (labels) come URL-encoded and can be very long, so shorten them
- $activity->name=shorten_text(urldecode($activity->name));
+ $activity->name = shorten_text($activity->name);
if($csv) {
print $sep.csv_quote(strip_tags($activity->name)).$sep.csv_quote($datetext);
foreach ($modinfo as $activity) {
//Exclude labels, hidden activities and activities for group members only
if ($activity->mod != "label" and $activity->visible and empty($activity->groupmembersonly)) {
- $title = s(trim(strip_tags(urldecode($activity->name))));
- $currentname = trim(urldecode($activity->name));
+ $title = s(trim(strip_tags($activity->name)));
+ $currentname = trim($activity->name);
$entitisedname = s($currentname);
/// Avoid empty or unlinkable activity names
if (!empty($title)) {
}
$instance = $rawmods[$cm->id];
if (!empty($cm->extra)) {
- $instance->extra = urlencode($cm->extra); // bc compatibility
+ $instance->extra = $cm->extra;
}
$outputarray[] = $instance;
}
upgrade_main_savepoint($result, 2010020301);
}
+ if ($result && $oldversion < 2010021400) {
+ /// Changes to modinfo mean we need to rebuild course cache
+ require_once($CFG->dirroot . '/course/lib.php');
+ rebuild_course_cache(0, true);
+ upgrade_main_savepoint($result, 2010021400);
+ }
+
return $result;
}
$cm->instance = $mod->id;
$cm->course = $course->id;
$cm->modname = $mod->mod;
- $cm->name = urldecode($mod->name);
+ $cm->name = $mod->name;
$cm->visible = $mod->visible;
$cm->sectionnum = $mod->section;
$cm->groupmode = $mod->groupmode;
$cm->groupmembersonly = $mod->groupmembersonly;
$cm->indent = $mod->indent;
$cm->completion = $mod->completion;
- $cm->extra = isset($mod->extra) ? urldecode($mod->extra) : '';
+ $cm->extra = isset($mod->extra) ? $mod->extra : '';
$cm->icon = isset($mod->icon) ? $mod->icon : '';
+ $cm->iconcomponent = isset($mod->iconcomponent) ? $mod->iconcomponent : '';
$cm->uservisible = true;
if(!empty($CFG->enableavailability)) {
// We must have completion information from modinfo. If it's not
$minimalmodinfo=new stdClass();
$minimalmodinfo->cms=array();
foreach($info as $mod) {
- $minimalcm=new stdClass();
- $minimalcm->id=$mod->cm;
- $minimalcm->name=urldecode($mod->name);
+ $minimalcm = new stdClass();
+ $minimalcm->id = $mod->cm;
+ $minimalcm->name = $mod->name;
$minimalmodinfo->cms[$minimalcm->id]=$minimalcm;
}
}
// Get availability information
$ci = new condition_info($cm);
- $cm->available=$ci->is_available($cm->availableinfo,true,$userid,
- $minimalmodinfo);
+ $cm->available=$ci->is_available($cm->availableinfo, true, $userid, $minimalmodinfo);
} else {
$cm->available=true;
}
}
$modinfo = $this->cache->{'modinfo'.$course->id};
- $resources = array('resource', 'label');
if (!$this->cache->cached('canviewhiddenactivities')) {
$this->cache->canviewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $this->context);
}
continue;
}
$icon = null;
- if (!in_array($module->modname, $resources)) {
- if ($module->icon == '') {
- $icon = new pix_icon('icon', '', $module->modname);
- }
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- $type = navigation_node::TYPE_ACTIVITY;
+ if ($module->icon) {
+ $icon = new pix_icon($module->icon, '', $module->iconcomponent);
} else {
- //TODO: this is not nice and should be probably changed on the module level ;-)
- /*
- $url = null;
- $type = navigation_node::TYPE_RESOURCE;
- if ($module->modname != 'label') {
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- } else {
- if (preg_match('#^\s*<(p|div)>(?<extra>.*?)</\1>\s*$#i', $module->extra, $matches)) {
- $module->extra = $matches['extra'];
- }
- $module->name = format_text($module->extra, FORMAT_HTML, $labelformatoptions);
- }
- if ($module->icon!=='') {
- $icon = $OUTPUT->pix_url(preg_replace('#\.(png|gif)$#i','',$module->icon));
- }
- */
+ $icon = new pix_icon('icon', '', $module->modname);
}
+ $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
+ $type = navigation_node::TYPE_ACTIVITY; // TODO: add some new fast test for resource types
+
$this->add_to_path($keys, $module->id, $module->name, $module->name, $type, $url, $icon);
$child = $this->find_child($module->id, $type);
if ($child != false) {
}
$sections = $this->cache->{'coursesections'.$course->id};
- $resources = array('resource', 'label');
-
if (!$this->cache->cached('canviewhiddenactivities')) {
$this->cache->canviewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $this->context);
}
continue;
}
$icon = null;
- if (!in_array($module->modname, $resources)) {
- if ($module->icon=='') {
- $icon = new pix_icon('icon', '', $module->modname);
- }
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- $type = navigation_node::TYPE_ACTIVITY;
+ if ($module->icon) {
+ $icon = new pix_icon($module->icon, '', $module->iconcomponent);
} else {
- //TODO: this is not nice and should be probably changed on the module level ;-)
- /*
- $url = null;
- $type = navigation_node::TYPE_RESOURCE;
- if ($module->modname!='label') {
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- } else {
- if (preg_match('#^\s*<(p|div)>(?<extra>.*?)</\1>\s*$#i', $module->extra, $matches)) {
- $module->extra = $matches['extra'];
- }
- $module->name = format_text($module->extra, FORMAT_HTML, $labelformatoptions);
- }
- if ($module->icon!=='') {
- $icon = $OUTPUT->pix_url(preg_replace('#\.(png|gif)$#i','',$module->icon));
- }
- */
+ $icon = new pix_icon('icon', '', $module->modname);
}
+ $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
+ $type = navigation_node::TYPE_ACTIVITY; // TODO: add some new fast test for resource types
+
$path = $keys;
if ($course->id !== SITEID) {
$path[] = $sections[$module->sectionnum]->id;
$modinfo = get_fast_modinfo($course);
- $resources = array('resource', 'label');
-
if (!$this->cache->cached('canviewhiddenactivities')) {
$this->cache->canviewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $this->context);
}
continue;
}
$icon = null;
- if (!in_array($module->modname, $resources)) {
- if ($module->icon=='') {
- $icon = new pix_icon('icon', '', $module->modname);
- }
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- $type = navigation_node::TYPE_ACTIVITY;
+ if ($module->icon) {
+ $icon = new pix_icon($module->icon, '', $module->iconcomponent);
} else {
- //TODO: this is not nice and should be probably changed on the module level ;-)
- /*
- $url = null;
- $type = navigation_node::TYPE_RESOURCE;
- if ($module->modname!='label') {
- $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
- }
- if ($module->icon!=='') {
- $icon = $OUTPUT->pix_url(preg_replace('#\.(png|gif)$#i','',$module->icon));
- }
- */
+ $icon = new pix_icon('icon', '', $module->modname);
}
+ $url = new moodle_url('/mod/'.$module->modname.'/view.php', array('id'=>$module->id));
+ $type = navigation_node::TYPE_ACTIVITY; // TODO: add some new fast test for resource types
+
$this->add_to_path($keys, $module->id, $module->name, $module->name, $type, $url, $icon);
$child = $this->find_child($module->id, $type);
if ($child != false) {
} else {
$xml .= ' '.$key.'="false"';
}
+ } else if ($value instanceof pix_icon) {
+ $xml .= ' '.$key.'="'.$OUTPUT->pix_url($value->pix, $value->component).'"';
} else if ($value !== null) {
$xml .= ' '.$key.'="'.$value.'"';
}
}
$url = $mod->modname .'/view.php?id='. $mod->id;
- $mod->name = strip_tags(format_string(urldecode($mod->name),true));
+ $mod->name = strip_tags(format_string($mod->name ,true));
if (strlen($mod->name) > ($width+5)) {
$mod->name = substr($mod->name, 0, $width).'...';
}
}
$info = new object();
// no filtering hre because this info is cached and filtered later
- $info->extra = urlencode(format_module_intro('label', $label, $coursemodule->id, false));
- $info->name = urlencode($label->name);
+ $info->extra = format_module_intro('label', $label, $coursemodule->id, false);
+ $info->name = $label->name;
return $info;
} else {
return null;
global $CFG, $DB;
require_once("$CFG->libdir/resourcelib.php");
+ $info = new object();
+ $info->name = $page->name;
+
if (!$page = $DB->get_record('page', array('id'=>$coursemodule->instance), 'id, name, display, displayoptions')) {
return NULL;
}
if ($page->display != RESOURCELIB_DISPLAY_POPUP) {
- return null;
+ return $info;
}
- $info = new object();
- $info->name = $page->name;
-
$fullurl = "$CFG->wwwroot/mod/page/view.php?id=$coursemodule->id&inpopup=1";
$options = empty($page->displayoptions) ? array() : unserialize($page->displayoptions);
$width = empty($options['popupwidth']) ? 620 : $options['popupwidth'];
$height = empty($options['popupheight']) ? 450 : $options['popupheight'];
$wh = "width=$width,height=$height,toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes";
- $info->extra = urlencode("onclick=\"window.open('$fullurl', '', '$wh'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl', '', '$wh'); return false;\"";
return $info;
}
$width = empty($options['popupwidth']) ? 620 : $options['popupwidth'];
$height = empty($options['popupheight']) ? 450 : $options['popupheight'];
$wh = "width=$width,height=$height,toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes";
- $info->extra = urlencode("onclick=\"window.open('$fullurl', '', '$wh'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl', '', '$wh'); return false;\"";
} else if ($display == RESOURCELIB_DISPLAY_NEW) {
$fullurl = "$CFG->wwwroot/mod/resource/view.php?id=$coursemodule->id&redirect=1";
- $info->extra = urlencode("onclick=\"window.open('$fullurl'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl'); return false;\"";
} else if ($display == RESOURCELIB_DISPLAY_OPEN) {
$fullurl = "$CFG->wwwroot/mod/resource/view.php?id=$coursemodule->id&redirect=1";
- $info->extra = urlencode("onclick=\"window.location.href ='$fullurl';return false;\"");
+ $info->extra = "onclick=\"window.location.href ='$fullurl';return false;\"";
} else if ($display == RESOURCELIB_DISPLAY_DOWNLOAD) {
// do not open any window because it would be left there after download
$context = get_context_instance(CONTEXT_MODULE, $coursemodule->id);
$path = '/'.$context->id.'/resource_content/'.$resource->revision.$resource->mainfile;
$fullurl = addslashes_js(file_encode_url($CFG->wwwroot.'/pluginfile.php', $path, true));
- $info->extra = urlencode("onclick=\"window.open('$fullurl'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl'); return false;\"";
}
return $info;
$width = empty($options['popupwidth']) ? 620 : $options['popupwidth'];
$height = empty($options['popupheight']) ? 450 : $options['popupheight'];
$wh = "width=$width,height=$height,toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes";
- $info->extra = urlencode("onclick=\"window.open('$fullurl', '', '$wh'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl', '', '$wh'); return false;\"";
} else if ($display == RESOURCELIB_DISPLAY_NEW) {
$fullurl = "$CFG->wwwroot/mod/url/view.php?id=$coursemodule->id&redirect=1";
- $info->extra = urlencode("onclick=\"window.open('$fullurl'); return false;\"");
+ $info->extra = "onclick=\"window.open('$fullurl'); return false;\"";
} else if ($display == RESOURCELIB_DISPLAY_OPEN) {
$fullurl = "$CFG->wwwroot/mod/url/view.php?id=$coursemodule->id&redirect=1";
- $info->extra = urlencode("onclick=\"window.location.href ='$fullurl';return false;\"");
+ $info->extra = "onclick=\"window.location.href ='$fullurl';return false;\"";
}
return $info;
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2010020701; // YYYYMMDD = date of the last version bump
+ $version = 2010021400; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20100214)'; // Human-friendly version name