MDL-12945 fixing mod indexes broken by previous commit; merged from MOODLE_19_STABLE

This commit is contained in:
skodak 2008-02-01 09:09:04 +00:00
parent 78117f38bc
commit 52ae8c057a
8 changed files with 72 additions and 43 deletions

View file

@ -51,11 +51,31 @@
$types = assignment_types();
foreach ($cms as $cm) {
if (!coursemodule_visible_for_user($cm)) {
$modinfo = get_fast_modinfo($course);
foreach ($modinfo->instances['assignment'] as $cm) {
if (!$cm->uservisible) {
continue;
}
$cm->timedue = $cms[$cm->id]->timedue;
$cm->assignmenttype = $cms[$cm->id]->assignmenttype;
//Show dimmed if the mod is hidden
$class = $cm->visible ? '' : 'class="dimmed"';
$link = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>";
$printsection = "";
if ($cm->section !== $currentsection) {
if ($cm->section) {
$printsection = $cm->section;
}
if ($currentsection !== "") {
$table->data[] = 'hr';
}
$currentsection = $cm->section;
}
if (!file_exists($CFG->dirroot.'/mod/assignment/type/'.$cm->assignmenttype.'/assignment.class.php')) {
continue;
}
@ -73,22 +93,6 @@
$due = $cm->timedue ? userdate($cm->timedue) : '-';
//Show dimmed if the mod is hidden
$class = $cm->visible ? '' : 'class="dimmed"';
$link = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>";
$printsection = "";
if ($cm->section !== $currentsection) {
if ($cm->section) {
$printsection = $cm->section;
}
if ($currentsection !== "") {
$table->data[] = 'hr';
}
$currentsection = $cm->section;
}
if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($printsection, $link, $type, $due, $submitted, $grade);
} else {