From 9d265d37479d3867c33754c3500fe11160c98997 Mon Sep 17 00:00:00 2001 From: danmarsden Date: Mon, 4 Feb 2008 22:13:01 +0000 Subject: [PATCH] MDL-6373 add MyMoodle support for Choice module. - thanks to Stephen Bourget for partial code. --- mod/choice/lib.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/mod/choice/lib.php b/mod/choice/lib.php index b6bc07e787..7d3acc536d 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -732,4 +732,36 @@ function choice_reset_userdata($data) { return $status; } +function choice_print_overview($courses, &$htmlarray) { + global $USER, $CFG; + + if (empty($courses) || !is_array($courses) || count($courses) == 0) { + return array(); + } + if (!$choices = get_all_instances_in_courses('choice',$courses)) { + return; + } + + foreach ($choices as $choice) { + if ($choice->timeclose != 0) { // if this choice is scheduled + $str = '
'.get_string('choiceclose', 'choice'). + ': '.userdate($choice->timeclose).'
'; + + if (isset($USER->id) && ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $USER->id))) { + $str .= '
'.get_string('taken', 'choice').'
'; + } else { + $str .= '
'.get_string('notanswered', 'choice').'
'; + } + + if (empty($htmlarray[$choice->course]['choice'])) { + $htmlarray[$choice->course]['choice'] = $str; + } else { + $htmlarray[$choice->course]['choice'] .= $str; + } + } + } +} ?> -- 2.39.5