]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13155 once more - reverting mod/xx/index.php to use get_all_instances_in_courses...
authorskodak <skodak>
Tue, 5 Feb 2008 21:40:21 +0000 (21:40 +0000)
committerskodak <skodak>
Tue, 5 Feb 2008 21:40:21 +0000 (21:40 +0000)
12 files changed:
mod/chat/index.php
mod/choice/index.php
mod/data/index.php
mod/glossary/index.php
mod/journal/index.php
mod/lesson/index.php
mod/quiz/index.php
mod/resource/index.php
mod/scorm/index.php
mod/survey/index.php
mod/wiki/index.php
mod/workshop/index.php

index 127aa6ecf1b73a37ae78799936e0d19cab33b5a7..a9a365fe9bbfcafaa6b4687dca18fe76c59313a3 100644 (file)
@@ -30,7 +30,7 @@
 
 /// Get all the appropriate data
 
-    if (!$cms = get_coursemodules_in_course('chat', $course->id)) {
+    if (! $chats = get_all_instances_in_course('chat', $course)) {
         notice(get_string('thereareno', 'moodle', $strchats), "../../course/view.php?id=$course->id");
         die();
     }
     }
 
     $currentsection = '';
-
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['chat'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
+    foreach ($chats as $chat) {
+        if (!$chat->visible) {
+            //Show dimmed if the mod is hidden
+            $link = "<a class=\"dimmed\" href=\"view.php?id=$chat->coursemodule\">".format_string($chat->name,true)."</a>";
+        } else {
+            //Show normal if the mod is visible
+            $link = "<a href=\"view.php?id=$chat->coursemodule\">".format_string($chat->name,true)."</a>";
         }
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $link = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>";
-
         $printsection = '';
-        if ($cm->sectionnum !== $currentsection) {
-            if ($cm->sectionnum) {
-                $printsection = $cm->sectionnum;
+        if ($chat->section !== $currentsection) {
+            if ($chat->section) {
+                $printsection = $chat->section;
             }
             if ($currentsection !== '') {
                 $table->data[] = 'hr';
             }
-            $currentsection = $cm->sectionnum;
+            $currentsection = $chat->section;
         }
         if ($course->format == 'weeks' or $course->format == 'topics') {
             $table->data[] = array ($printsection, $link);
index e72831478766981d898fe45265096cc9fcd13b6a..f60fda7b4d40c3275979f81b3afb51bf68a8a0ea 100644 (file)
@@ -22,7 +22,7 @@
     print_header_simple("$strchoices", "", $navigation, "", "", true, "", navmenu($course));
 
 
-    if (!$cms = get_coursemodules_in_course('choice', $course->id)) {
+    if (! $choices = get_all_instances_in_course("choice", $course)) {
         notice(get_string('thereareno', 'moodle', $strchoices), "../../course/view.php?id=$course->id");
     }
 
 
     $currentsection = "";
 
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['choice'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
+    foreach ($choices as $choice) {
+        if (!empty($answers[$choice->id])) {
+            $answer = $answers[$choice->id];
+        } else {
+            $answer = "";
+        }
+        if (!empty($answer->optionid)) {
+            $aa = format_string(choice_get_option_text($choice, $answer->optionid));
+        } else {
+            $aa = "";
         }
-
         $printsection = "";
-        if ($cm->sectionnum !== $currentsection) {
-            if ($cm->sectionnum) {
-                $printsection = $cm->sectionnum;
+        if ($choice->section !== $currentsection) {
+            if ($choice->section) {
+                $printsection = $choice->section;
             }
             if ($currentsection !== "") {
                 $table->data[] = 'hr';
             }
-            $currentsection = $cm->sectionnum;
+            $currentsection = $choice->section;
         }
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $tt_href = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>";
-
-        if (!empty($answers[$cm->instance])) {
-            $answer = $answers[$cm->instance];
+        
+        //Calculate the href
+        if (!$choice->visible) {
+            //Show dimmed if the mod is hidden
+            $tt_href = "<a class=\"dimmed\" href=\"view.php?id=$choice->coursemodule\">".format_string($choice->name,true)."</a>";
         } else {
-            $answer = "";
+            //Show normal if the mod is visible
+            $tt_href = "<a href=\"view.php?id=$choice->coursemodule\">".format_string($choice->name,true)."</a>";
         }
-        if (!empty($answer->optionid)) {
-            $aa = format_string(choice_get_option_text(null, $answer->optionid));
-        } else {
-            $aa = "";
-        }
-
         if ($course->format == "weeks" || $course->format == "topics") {
             $table->data[] = array ($printsection, $tt_href, $aa);
         } else {
index cd3cd813c5e948aed05c7a104f1ef118d247296f..2e0be42a8541606baa9a975e07738e0f15be8a66 100755 (executable)
@@ -49,7 +49,7 @@
 
     print_header_simple($strdata, '', $navigation, '', '', true, "", navmenu($course));
 
-    if (!$cms = get_coursemodules_in_course('data', $course->id, 'm.intro, m.approval, m.rssarticles')) {
+    if (! $datas = get_all_instances_in_course("data", $course)) {
         notice(get_string('thereareno', 'moodle',$strdataplural) , "$CFG->wwwroot/course/view.php?id=$course->id");
     }
 
 
     $currentsection = "";
 
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['data'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
-        }
-
-        $cm->intro       = $cms[$cm->id]->intro;
-        $cm->approval    = $cms[$cm->id]->approval;
-        $cm->rssarticles = $cms[$cm->id]->rssarticles;
+    foreach ($datas as $data) {
 
         $printsection = "";
 
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $link = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name,true)."</a>";
+        //Calculate the href
+        if (!$data->visible) {
+            //Show dimmed if the mod is hidden
+            $link = "<a class=\"dimmed\" href=\"view.php?id=$data->coursemodule\">".format_string($data->name,true)."</a>";
+        } else {
+            //Show normal if the mod is visible
+            $link = "<a href=\"view.php?id=$data->coursemodule\">".format_string($data->name,true)."</a>";
+        }
 
         // TODO: add group restricted counts here, and limit unapproved to ppl with approve cap only + link to approval page
 
         $numrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
-                'data_records r WHERE r.dataid ='.$cm->instance);
+                'data_records r WHERE r.dataid ='.$data->id);
 
-        if ($cm->approval == 1) {
+        if ($data->approval == 1) {
             $numunapprovedrecords = count_records_sql('SELECT COUNT(r.id) FROM '.$CFG->prefix.
-                    'data_records r WHERE r.dataid ='.$cm->instance.
+                    'data_records r WHERE r.dataid ='.$data->id.
                     ' AND r.approved <> 1');
         } else {
             $numunapprovedrecords = '-';
         }
 
         $rsslink = '';
-        if ($rss && $cm->rssarticles > 0) {
-            $rsslink = rss_get_link($course->id, $USER->id, 'data', $cm->instance, 'RSS');
+        if ($rss && $data->rssarticles > 0) {
+            $rsslink = rss_get_link($course->id, $USER->id, 'data', $data->id, 'RSS');
         }
 
         if ($course->format == 'weeks' or $course->format == 'topics') {
-            if ($cm->sectionnum !== $currentsection) {
-                if ($cm->sectionnum) {
-                    $printsection = $cm->sectionnum;
+            if ($data->section !== $currentsection) {
+                if ($data->section) {
+                    $printsection = $data->section;
                 }
                 if ($currentsection !== '') {
                     $table->data[] = 'hr';
                 }
-                $currentsection = $cm->sectionnum;
+                $currentsection = $data->section;
             }
-            $row = array ($printsection, $link, $cm->intro, $numrecords, $numunapprovedrecords);
+            $row = array ($printsection, $link, $data->intro, $numrecords, $numunapprovedrecords);
 
         } else {
-            $row = array ($link, $cm->intro, $numrecords, $numunapprovedrecords);
+            $row = array ($link, $data->intro, $numrecords, $numunapprovedrecords);
         }
 
         if ($rss) {
index a6b1db3fcf5bcb9dba14ba7387aa04f0a1e6512f..6b53b9e2669082fb956fc5f34a8f5e0c00d7fa8a 100644 (file)
@@ -36,7 +36,7 @@
 
 /// Get all the appropriate data
 
-    if (!$cms = get_coursemodules_in_course('glossary', $course->id, 'm.rsstype, m.rssarticles')) {
+    if (! $glossarys = get_all_instances_in_course("glossary", $course)) {
         notice(get_string('thereareno', 'moodle', $strglossarys), "../../course/view.php?id=$course->id");
         die;
     }
 
     $currentsection = "";
 
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['glossary'] as $cm) {
-        if (!$cm->uservisible) {
+    foreach ($glossarys as $glossary) {
+        if (!$glossary->visible && has_capability('moodle/course:viewhiddenactivities', $context)) {
+            // Show dimmed if the mod is hidden.
+            $link = "<a class=\"dimmed\" href=\"view.php?id=$glossary->coursemodule\">".format_string($glossary->name,true)."</a>";
+        } else if ($glossary->visible) {
+            // Show normal if the mod is visible.
+            $link = "<a href=\"view.php?id=$glossary->coursemodule\">".format_string($glossary->name,true)."</a>";
+        } else {
+            // Don't show the glossary.
             continue;
         }
-
-        $cm->rsstype      = $cms[$cm->id]->rsstype;
-        $cm->rssarticles  = $cms[$cm->id]->rssarticles;
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $link = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>";
-
         $printsection = "";
-        if ($cm->sectionnum !== $currentsection) {
-            if ($cm->sectionnum) {
-                $printsection = $cm->sectionnum;
+        if ($glossary->section !== $currentsection) {
+            if ($glossary->section) {
+                $printsection = $glossary->section;
             }
             if ($currentsection !== "") {
                 $table->data[] = 'hr';
             }
-            $currentsection = $cm->sectionnum;
+            $currentsection = $glossary->section;
         }
 
         // TODO: count only approved if not allowed to see them
 
-        $count = count_records_sql("SELECT COUNT(*) FROM {$CFG->prefix}glossary_entries where (glossaryid = $cm->instance or sourceglossaryid = $cm->instance)");
+        $count = count_records_sql("SELECT COUNT(*) FROM {$CFG->prefix}glossary_entries where (glossaryid = $glossary->id or sourceglossaryid = $glossary->id)");
 
         //If this glossary has RSS activated, calculate it
         if ($show_rss) {
             $rsslink = '';
-            if ($cm->rsstype and $cm->rssarticles) {
+            if ($glossary->rsstype and $glossary->rssarticles) {
                 //Calculate the tolltip text
-                $tooltiptext = get_string("rsssubscriberss","glossary",format_string($cm->name));
+                $tooltiptext = get_string("rsssubscriberss","glossary",format_string($glossary->name));
                 if (empty($USER->id)) {
                     $userid = 0;
                 } else {
                     $userid = $USER->id;
                 }
                 //Get html code for RSS link
-                $rsslink = rss_get_link($course->id, $userid, "glossary", $cm->instance, $tooltiptext);
+                $rsslink = rss_get_link($course->id, $userid, "glossary", $glossary->id, $tooltiptext);
             }
         }
 
index 051190a5b5e021bb3dc9633d903f02d7156552d0..0a9a90791d848abd6c0dfc84ff05feb68067122d 100644 (file)
     }
 
     foreach ($journals as $journal) {
-        $cm = get_coursemodule_from_instance('journal', $journal->id, $course->id);
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
-        if (!coursemodule_visible_for_user($cm)) {
-            continue;
-        }
 
         $journal->timestart  = $course->startdate + (($journal->section - 1) * 608400);
         if (!empty($journal->daysopen)) {
index 725acca7f398cafb6f7d0e624f767af3ec8ee5bb..0dd0c97d633935e28f347730427b6f94e6211179 100644 (file)
     }
 
     foreach ($lessons as $lesson) {
-        $cm = get_coursemodule_from_instance('lesson', $lesson->id, $course->id);
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
-        if (!coursemodule_visible_for_user($cm)) {
-            continue;
+        if (!$lesson->visible) {
+            //Show dimmed if the mod is hidden
+            $link = "<a class=\"dimmed\" href=\"view.php?id=$lesson->coursemodule\">".format_string($lesson->name,true)."</a>";
+        } else {
+            //Show normal if the mod is visible
+            $link = "<a href=\"view.php?id=$lesson->coursemodule\">".format_string($lesson->name,true)."</a>";
         }
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $link = "<a $class href=\"view.php?id=$lesson->coursemodule\">".format_string($lesson->name)."</a>";
+        $cm = get_coursemodule_from_instance('lesson', $lesson->id);
+        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
         if ($lesson->deadline > $timenow) {
             $due = userdate($lesson->deadline);
index ea0ce369b8a406a90b23ab8bd3b96a052c8ab983..da8a4eed1fa223a71acba9ad315b6c0105bfb3b1 100644 (file)
     foreach ($quizzes as $quiz) {
         $cm      = get_coursemodule_from_instance('quiz', $quiz->id);
         $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
-        if (!coursemodule_visible_for_user($cm)) {
-            continue;
-        }
-
         $data = array();
 
         // Section number if necessary.
index e9e71dc3751ed97653edf0c56a51903312b5e4a0..807c029d1b36e41ae033ec693d56983985fa8824 100644 (file)
@@ -30,7 +30,7 @@
     print_header("$course->shortname: $strresources", $course->fullname, $navigation,
                  "", "", true, "", navmenu($course));
 
-    if (!$cms = get_coursemodules_in_course('resource', $course->id, 'm.timemodified, m.summary')) {
+    if (! $resources = get_all_instances_in_course("resource", $course)) {
         notice(get_string('thereareno', 'moodle', $strresources), "../../course/view.php?id=$course->id");
         exit;
     }
 
     $currentsection = "";
     $options->para = false;
-
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['resource'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
-        }
-
-        $cm->summary      = $cms[$cm->id]->summary;
-        $cm->timemodified = $cms[$cm->id]->timemodified;
-
+    foreach ($resources as $resource) {
         if ($course->format == "weeks" or $course->format == "topics") {
             $printsection = "";
-            if ($cm->sectionnum !== $currentsection) {
-                if ($cm->sectionnum) {
-                    $printsection = $cm->sectionnum;
+            if ($resource->section !== $currentsection) {
+                if ($resource->section) {
+                    $printsection = $resource->section;
                 }
                 if ($currentsection !== "") {
                     $table->data[] = 'hr';
                 }
-                $currentsection = $cm->sectionnum;
+                $currentsection = $resource->section;
             }
         } else {
-            $printsection = '<span class="smallinfo">'.userdate($cm->timemodified)."</span>";
+            $printsection = '<span class="smallinfo">'.userdate($resource->timemodified)."</span>";
+        }
+        if (!empty($resource->extra)) {
+            $extra = urldecode($resource->extra);
+        } else {
+            $extra = "";
+        }
+        if (!$resource->visible) {      // Show dimmed if the mod is hidden
+            $table->data[] = array ($printsection, 
+                    "<a class=\"dimmed\" $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
+                    format_text($resource->summary, FORMAT_MOODLE, $options) );
+
+        } else {                        //Show normal if the mod is visible
+            $table->data[] = array ($printsection, 
+                    "<a $extra href=\"view.php?id=$resource->coursemodule\">".format_string($resource->name,true)."</a>",
+                    format_text($resource->summary, FORMAT_MOODLE, $options) );
         }
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $table->data[] = array ($printsection,
-                "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name)."</a>",
-                format_text($cm->summary, FORMAT_MOODLE, $options) );
     }
 
     echo "<br />";
index 9be62c359f926b09c3844caa4d8625e8700e9a9c..cdd8ae6d048e2a17ed198b9f46fcf9d37c667254 100755 (executable)
     }
 
     foreach ($scorms as $scorm) {
-        $cm      = get_coursemodule_from_instance('scorm', $forum->id, $course->id);
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
-        if (!coursemodule_visible_for_user($cm)) {
-            continue;
-        }
 
+        $context = get_context_instance(CONTEXT_MODULE,$scorm->coursemodule);
         $tt = "";
         if ($course->format == "weeks" or $course->format == "topics") {
             if ($scorm->section) {
             $report = scorm_grade_user($scorm, $USER->id);
             $reportshow = get_string('score','scorm').": ".$report;
         }
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $table->data[] = array ($tt, "<a $class href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name)."</a>",
-                                format_text($scorm->summary), $reportshow);
+        if (!$scorm->visible) {
+           //Show dimmed if the mod is hidden
+           $table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name)."</a>",
+                                   format_text($scorm->summary), $reportshow);
+        } else {
+           //Show normal if the mod is visible
+           $table->data[] = array ($tt, "<a href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name)."</a>",
+                                   format_text($scorm->summary), $reportshow);
+        }
     }
 
     echo "<br />";
index da203dcccec7aacf2611e308f7ec9cc6d6555b4c..217bb13ae8aa0a2d2b1fc70a8dd54bf52bfe1aba 100644 (file)
@@ -28,7 +28,7 @@
     print_header_simple("$strsurveys", "", $navigation,
                  "", "", true, "", navmenu($course));
 
-    if (!$cms = get_coursemodules_in_course('survey', $course->id)) {
+    if (! $surveys = get_all_instances_in_course("survey", $course)) {
         notice(get_string('thereareno', 'moodle', $strsurveys), "../../course/view.php?id=$course->id");
     }
 
 
     $currentsection = '';
 
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['survey'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
-        }
-
-        if (!empty($USER->id) and survey_already_done($cm->instance, $USER->id)) {
+    foreach ($surveys as $survey) {
+        if (!empty($USER->id) and survey_already_done($survey->id, $USER->id)) {
             $ss = $strdone;
         } else {
             $ss = $strnotdone;
         }
         $printsection = "";
-        if ($cm->sectionnum !== $currentsection) {
-            if ($cm->sectionnum) {
-                $printsection = $cm->sectionnum;
+        if ($survey->section !== $currentsection) {
+            if ($survey->section) {
+                $printsection = $survey->section;
             }
             if ($currentsection !== "") {
                 $table->data[] = 'hr';
             }
-            $currentsection = $cm->sectionnum;
+            $currentsection = $survey->section;
         }
         //Calculate the href
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $tt_href = "<a $class href=\"view.php?id=$cm->id\">".format_string($cm->name,true)."</a>";
+        if (!$survey->visible) {
+            //Show dimmed if the mod is hidden
+            $tt_href = "<a class=\"dimmed\" href=\"view.php?id=$survey->coursemodule\">".format_string($survey->name,true)."</a>";
+        } else {
+            //Show normal if the mod is visible
+            $tt_href = "<a href=\"view.php?id=$survey->coursemodule\">".format_string($survey->name,true)."</a>";
+        }
 
         if ($course->format == "weeks" or $course->format == "topics") {
-            $table->data[] = array ($printsection, $tt_href, "<a href=\"view.php?id=$cm->id\">$ss</a>");
+            $table->data[] = array ($printsection, $tt_href, "<a href=\"view.php?id=$survey->coursemodule\">$ss</a>");
         } else {
-            $table->data[] = array ($tt_href, "<a href=\"view.php?id=$cm->id\">$ss</a>");
+            $table->data[] = array ($tt_href, "<a href=\"view.php?id=$survey->coursemodule\">$ss</a>");
         }
     }
 
index 9bb4cc93cf09897946ecf835cd145fbf438f2d67..313891df4ad1ee0030dd30b9131e4cab3006a2b4 100644 (file)
@@ -32,7 +32,7 @@
 
 /// Get all the appropriate data
 
-    if (!$cms = get_coursemodules_in_course('wiki', $course->id, 'm.summary, m.wtype, m.timemodified')) {
+    if (! $wikis = get_all_instances_in_course("wiki", $course)) {
         notice(get_string('thereareno', 'moodle', $strwikis), "../../course/view.php?id=$course->id");
         die;
     }
         $table->align = array ('LEFT', 'LEFT', 'LEFT', 'LEFT');
     }
 
-    $modinfo = get_fast_modinfo($course);
-    foreach ($modinfo->instances['wiki'] as $cm) {
-        if (!$cm->uservisible) {
-            continue;
+    foreach ($wikis as $wiki) {
+        if (!$wiki->visible) {
+            //Show dimmed if the mod is hidden
+            $link = '<a class="dimmed" href="view.php?id='.$wiki->coursemodule.'">'.format_string($wiki->name,true).'</a>';
+        } else {
+            //Show normal if the mod is visible
+            $link = '<a href="view.php?id='.$wiki->coursemodule.'">'.format_string($wiki->name,true).'</a>';
         }
 
-        $cm->summary      = $cms[$cm->id]->summary;
-        $cm->wtype        = $cms[$cm->id]->wtype;
-        $cm->timemodified = $cms[$cm->id]->timemodified;
-
-        $class = $cm->visible ? '' : 'class="dimmed"';
-        $link = '<a '.$class.' href="view.php?id='.$cm->id.'">'.format_string($cm->name).'</a>';
-
-        $timmod = '<span class="smallinfo">'.userdate($cm->timemodified).'</span>';
-        $summary = '<span class="smallinfo">'.format_text($cm->summary).'</span>';
+        $timmod = '<span class="smallinfo">'.userdate($wiki->timemodified).'</span>';
+        $summary = '<span class="smallinfo">'.format_text($wiki->summary).'</span>';
 
         $site = get_site();
-        switch ($cm->wtype) {
+        switch ($wiki->wtype) {
 
         case 'teacher':
             $wtype = $site->teacher;
@@ -94,7 +90,7 @@
         $wtype = '<span class="smallinfo">'.$wtype.'</span>';
 
         if ($course->format == "weeks" or $course->format == "topics") {
-            $table->data[] = array ($cm->sectionnum, $link, $summary, $wtype, $timmod);
+            $table->data[] = array ($wiki->section, $link, $summary, $wtype, $timmod);
         } else {
             $table->data[] = array ($link, $summary, $wtype, $timmod);
         }
index 5873eb909d97d62a3060f3fedc1750506caad207..5bc2ad7572c47924e7f79332a67d0df02c0dc2e0 100644 (file)
     $strinfo = get_string("grade")."/".$strinfo = get_string("phase", "workshop");
     $strdeadline = get_string("deadline", "workshop");
     $strsubmitted = get_string("submitted", "assignment");
-    
+
     $navlinks = array();
     $navlinks[] = array('name' => $strworkshops, 'link' => '', 'type' => 'activity');
     $navigation = build_navigation($navlinks);
-    
+
     print_header_simple("$strworkshops", "", $navigation, "", "", true, "", navmenu($course));
 
     if (! $workshops = get_all_instances_in_course("workshop", $course)) {
     }
 
     foreach ($workshops as $workshop) {
-        $cm      = get_coursemodule_from_instance('workshop', $workshop->id);
-        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-
-        if (!coursemodule_visible_for_user($cm)) {
-            continue;
-        }
-
         if (workshop_is_teacher($workshop, $USER->id)) { // teacher see info (students see grade)
             $info = workshop_phase($workshop, 'short');
             if (time() > $workshop->submissionstart) {