See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * prints the overview of all feedbacks included into the current course 19 * 20 * @author Andreas Grabs 21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 22 * @package mod_feedback 23 */ 24 25 require_once("../../config.php"); 26 require_once ("lib.php"); 27 28 $id = required_param('id', PARAM_INT); 29 30 $url = new moodle_url('/mod/feedback/index.php', array('id'=>$id)); 31 32 $PAGE->set_url($url); 33 34 if (!$course = $DB->get_record('course', array('id'=>$id))) { 35 throw new \moodle_exception('invalidcourseid'); 36 } 37 38 $context = context_course::instance($course->id); 39 40 require_login($course); 41 $PAGE->set_pagelayout('incourse'); 42 $PAGE->add_body_class('limitedwidth'); 43 44 // Trigger instances list viewed event. 45 $event = \mod_feedback\event\course_module_instance_list_viewed::create(array('context' => $context)); 46 $event->add_record_snapshot('course', $course); 47 $event->trigger(); 48 49 /// Print the page header 50 $strfeedbacks = get_string("modulenameplural", "feedback"); 51 $strfeedback = get_string("modulename", "feedback"); 52 53 $PAGE->navbar->add($strfeedbacks); 54 $PAGE->set_heading($course->fullname); 55 $PAGE->set_title(get_string('modulename', 'feedback').' '.get_string('activities')); 56 echo $OUTPUT->header(); 57 if (!$PAGE->has_secondary_navigation()) { 58 echo $OUTPUT->heading($strfeedbacks); 59 } 60 61 /// Get all the appropriate data 62 63 if (! $feedbacks = get_all_instances_in_course("feedback", $course)) { 64 $url = new moodle_url('/course/view.php', array('id'=>$course->id)); 65 notice(get_string('thereareno', 'moodle', $strfeedbacks), $url); 66 die; 67 } 68 69 $usesections = course_format_uses_sections($course->format); 70 71 /// Print the list of instances (your module will probably extend this) 72 73 $timenow = time(); 74 $strname = get_string("name"); 75 $strresponses = get_string('responses', 'feedback'); 76 77 $table = new html_table(); 78 79 if ($usesections) { 80 $strsectionname = get_string('sectionname', 'format_'.$course->format); 81 if (has_capability('mod/feedback:viewreports', $context)) { 82 $table->head = array ($strsectionname, $strname, $strresponses); 83 $table->align = array ("center", "left", 'center'); 84 } else { 85 $table->head = array ($strsectionname, $strname); 86 $table->align = array ("center", "left"); 87 } 88 } else { 89 if (has_capability('mod/feedback:viewreports', $context)) { 90 $table->head = array ($strname, $strresponses); 91 $table->align = array ("left", "center"); 92 } else { 93 $table->head = array ($strname); 94 $table->align = array ("left"); 95 } 96 } 97 98 99 foreach ($feedbacks as $feedback) { 100 //get the responses of each feedback 101 $viewurl = new moodle_url('/mod/feedback/view.php', array('id'=>$feedback->coursemodule)); 102 103 if (has_capability('mod/feedback:viewreports', $context)) { 104 $completed_feedback_count = intval(feedback_get_completeds_group_count($feedback)); 105 } 106 107 $dimmedclass = $feedback->visible ? '' : 'class="dimmed"'; 108 $link = '<a '.$dimmedclass.' href="'.$viewurl->out().'">'.$feedback->name.'</a>'; 109 110 if ($usesections) { 111 $tabledata = array (get_section_name($course, $feedback->section), $link); 112 } else { 113 $tabledata = array ($link); 114 } 115 if (has_capability('mod/feedback:viewreports', $context)) { 116 $tabledata[] = $completed_feedback_count; 117 } 118 119 $table->data[] = $tabledata; 120 121 } 122 123 echo "<br />"; 124 125 echo html_writer::table($table); 126 127 /// Finish the page 128 129 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body