Skip to content

Commit

Permalink
More robustness on checking sequence variables
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Mar 21, 2003
1 parent f843019 commit 7466658
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ function get_array_of_activities($courseid) {

if ($sections = get_records("course_sections", "course", $courseid, "section ASC")) {
foreach ($sections as $section) {
if ($section->sequence) {
if (!empty($section->sequence)) {
$sequence = explode(",", $section->sequence);
foreach ($sequence as $seq) {
if (empty($rawmods[$seq])) {
Expand Down Expand Up @@ -491,7 +491,7 @@ function print_section_block($heading, $course, $section, $mods, $modnames, $mod
$modicon = array();
$editbuttons = "";

if ($section->sequence) {
if (!empty($section->sequence)) {

$sectionmods = explode(",", $section->sequence);

Expand Down Expand Up @@ -523,7 +523,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$modinfo = unserialize($course->modinfo);

echo "<TABLE WIDTH=\"$width\"><TR><TD>\n";
if ($section->sequence) {
if (!empty($section->sequence)) {

$sectionmods = explode(",", $section->sequence);

Expand Down Expand Up @@ -808,7 +808,7 @@ function add_mod_to_section($mod) {
GLOBAL $db;

if ($section = get_record("course_sections", "course", "$mod->course", "section", "$mod->section")) {
if ($section->sequence) {
if (!empty($section->sequence)) {
$newsequence = "$section->sequence,$mod->coursemodule";
} else {
$newsequence = "$mod->coursemodule";
Expand Down Expand Up @@ -894,7 +894,7 @@ function move_module($cm, $move) {
error("Previous section ($prevsection->id) doesn't exist");
}

if ($prevsection->sequence) {
if (!empty($prevsection->sequence)) {
$newsequence = "$prevsection->sequence,$cm->id";
} else {
$newsequence = "$cm->id";
Expand Down Expand Up @@ -936,7 +936,7 @@ function move_module($cm, $move) {
if ($nextsection = get_record("course_sections", "course", "$thissection->course",
"section", "$nextsectionnumber")) {

if ($nextsection->sequence) {
if (!empty($nextsection->sequence)) {
$newsequence = "$cm->id,$nextsection->sequence";
} else {
$newsequence = "$cm->id";
Expand Down

0 comments on commit 7466658

Please sign in to comment.