[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/mod/glossary/ -> comments.php (source)

   1  <?php // $Id: comments.php,v 1.28.2.1 2007/10/12 16:09:44 tjhunt Exp $
   2  
   3  /// This page prints a particular instance of glossary
   4      require_once('../../config.php');
   5      require_once ('lib.php');
   6  
   7      $id  = required_param('id', PARAM_INT);           // Course Module ID
   8      $eid = required_param('eid', PARAM_INT);          // Entry ID
   9  
  10      global $USER, $CFG;
  11  
  12      if (! $cm = get_coursemodule_from_id('glossary', $id)) {
  13          error("Course Module ID was incorrect");
  14      }
  15  
  16      if (! $course = get_record("course", "id", $cm->course)) {
  17          error("Course is misconfigured");
  18      }
  19  
  20      if (! $glossary = get_record("glossary", "id", $cm->instance)) {
  21          error("Course module is incorrect");
  22      }
  23  
  24      if (! $entry = get_record("glossary_entries", "id", $eid)) {
  25          error("Entry is incorrect");
  26      }
  27  
  28      $context = get_context_instance(CONTEXT_MODULE, $cm->id);
  29  
  30      require_login($course->id, false, $cm);
  31  
  32      add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
  33  
  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");
  44  
  45      $navigation = build_navigation($strcomments, $cm);
  46      print_header_simple(strip_tags("$strcomments: $entry->concept"), "", $navigation,
  47          "", "", true, update_module_button($cm->id, $course->id, $strglossary),
  48          navmenu($course, $cm));
  49  
  50  /// original glossary entry
  51  
  52      echo "<div class=\"boxaligncenter\">";
  53      glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
  54      echo "</div>";
  55  
  56  /// comments
  57  
  58      print_heading(format_string(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>"));
  59  
  60      if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
  61          print_heading("<a href=\"comment.php?action=add&amp;eid=$entry->id\">$straddcomment <img title=\"$straddcomment\" src=\"comment.gif\" class=\"iconsmall\" alt=\"$straddcomment\" /></a>");
  62      }
  63  
  64      if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) {
  65          foreach ($comments as $comment) {
  66              glossary_print_comment($course, $cm, $glossary, $entry, $comment);
  67              echo '<br />';
  68          }
  69      } else {
  70          print_heading(get_string("nocomments","glossary"));
  71      }
  72  
  73  
  74  /// Finish the page
  75  
  76      print_footer($course);
  77  
  78  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7