MDL-11517 reserved word MOD used in table alias in questions backup code
[moodle-pu.git] / mod / glossary / comments.php
blob271d13eee44e4a3210edfd7d04092eb897d2ec8b
1 <?php // $Id$
3 /// This page prints a particular instance of glossary
4 require_once('../../config.php');
5 require_once('lib.php');
7 $id = required_param('id', PARAM_INT); // Course Module ID
8 $eid = required_param('eid', PARAM_INT); // Entry ID
10 global $USER, $CFG;
12 if (! $cm = get_coursemodule_from_id('glossary', $id)) {
13 error("Course Module ID was incorrect");
16 if (! $course = get_record("course", "id", $cm->course)) {
17 error("Course is misconfigured");
20 if (! $glossary = get_record("glossary", "id", $cm->instance)) {
21 error("Course module is incorrect");
24 if (! $entry = get_record("glossary_entries", "id", $eid)) {
25 error("Entry is incorrect");
28 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
30 require_login($course->id, false, $cm);
32 add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
34 $strglossaries = get_string("modulenameplural", "glossary");
35 $strglossary = get_string("modulename", "glossary");
36 $strallcategories = get_string("allcategories", "glossary");
37 $straddentry = get_string("addentry", "glossary");
38 $strnoentries = get_string("noentries", "glossary");
39 $strsearchconcept = get_string("searchconcept", "glossary");
40 $strsearchindefinition = get_string("searchindefinition", "glossary");
41 $strsearch = get_string("search");
42 $strcomments = get_string("comments", "glossary");
43 $straddcomment = get_string("addcomment", "glossary");
45 $navlinks = array();
46 $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity');
47 $navlinks[] = array('name' => format_string($glossary->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
48 $navlinks[] = array('name' => $strcomments, 'link' => '', 'type' => 'title');
49 $navigation = build_navigation($navlinks);
51 print_header_simple(strip_tags("$strcomments: $entry->concept"), "", $navigation,
52 "", "", true, update_module_button($cm->id, $course->id, $strglossary),
53 navmenu($course, $cm));
55 /// original glossary entry
57 echo "<div class=\"boxaligncenter\">";
58 glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
59 echo "</div>";
61 /// comments
63 print_heading(format_string(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>"));
65 if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
66 print_heading("<a href=\"comment.php?action=add&amp;eid=$entry->id\">$straddcomment <img title=\"$straddcomment\" src=\"comment.gif\" class=\"iconsmall\" alt=\"$straddcomment\" /></a>");
69 if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) {
70 foreach ($comments as $comment) {
71 glossary_print_comment($course, $cm, $glossary, $entry, $comment);
72 echo '<br />';
74 } else {
75 print_heading(get_string("nocomments","glossary"));
79 /// Finish the page
81 print_footer($course);