Commit fea43a7f authored by stronk7's avatar stronk7
Browse files

Casting $course->modinfo to string prevents one notice to

be showed when it's null, returning false as desired.
parent 0703d22e
......@@ -51,11 +51,9 @@ class block_site_main_menu extends block_list {
$strcancel= get_string('cancel');
$stractivityclipboard = $USER->activitycopyname;
}
if ($course->modinfo !== NULL) {
$modinfo = unserialize($course->modinfo);
} else {
$modinfo = null;
}
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = unserialize((string)$course->modinfo);
$editbuttons = '';
if ($ismoving) {
......
......@@ -46,8 +46,8 @@ class block_social_activities extends block_list {
$strcancel= get_string('cancel');
$stractivityclipboard = $USER->activitycopyname;
}
$modinfo = unserialize($course->modinfo);
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = unserialize((string)$course->modinfo);
$editbuttons = '';
if ($ismoving) {
......@@ -126,4 +126,4 @@ class block_social_activities extends block_list {
}
}
?>
\ No newline at end of file
?>
......@@ -60,7 +60,8 @@ function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0,
$selectedactivity = $modid;
if ($modinfo = unserialize($course->modinfo)) {
/// Casting $course->modinfo to string prevents one notice when the field is null
if ($modinfo = unserialize((string)$course->modinfo)) {
$section = 0;
if ($course->format == 'weeks') { // Body
$strsection = get_string("week");
......@@ -1082,7 +1083,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
$labelformatoptions->noclean = true;
$modinfo = unserialize($course->modinfo);
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = unserialize((string)$course->modinfo);
//Acccessibility: replace table with list <ul>, but don't output empty list.
if (!empty($section->sequence)) {
......
......@@ -71,7 +71,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
$activities = array();
$selectedactivity = "";
if ($modinfo = unserialize($course->modinfo)) {
/// Casting $course->modinfo to string prevents one notice when the field is null
if ($modinfo = unserialize((string)$course->modinfo)) {
$section = 0;
if ($course->format == 'weeks') { // Bodgy
$strsection = get_string("week");
......@@ -217,4 +218,4 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
echo "</center>";
}
?>
\ No newline at end of file
?>
......@@ -19,7 +19,8 @@
if (empty($activitylist)) {
$course = get_record("course","id",$courseid);
$modinfo = unserialize($course->modinfo);
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = unserialize((string)$course->modinfo);
if (!empty($modinfo)) {
......
......@@ -1447,8 +1447,9 @@ function get_all_instances_in_courses($modulename,$courses) {
} else {
$invisible = 0;
}
if (!$modinfo = unserialize($course->modinfo)) {
/// Casting $course->modinfo to string prevents one notice when the field is null
if (!$modinfo = unserialize((string)$course->modinfo)) {
continue;
}
foreach ($modinfo as $mod) {
......@@ -1482,7 +1483,8 @@ function get_all_instances_in_course($modulename, $course) {
global $CFG;
if (!$modinfo = unserialize($course->modinfo)) {
/// Casting $course->modinfo to string prevents one notice when the field is null
if (!$modinfo = unserialize((string)$course->modinfo)) {
return array();
}
......
......@@ -3934,7 +3934,8 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
}
$strjumpto = get_string('jumpto');
if (!$modinfo = unserialize($course->modinfo)) {
/// Casting $course->modinfo to string prevents one notice when the field is null
if (!$modinfo = unserialize((string)$course->modinfo)) {
return '';
}
$isteacher = isteacher($course->id);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment