course)) {
error("Course is misconfigured");
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Course module is incorrect");
}
if (! $entry = get_record("glossary_entries", "id", $eid)) {
error("Entry is incorrect");
}
if ( $cid ) {
if (! $comment = get_record("glossary_comments", "id", $cid)) {
error("Comment is incorrect");
}
}
require_login($course->id);
if (!$cm->visible and !isteacher($course->id)) {
notice(get_string("activityiscurrentlyhidden"));
}
if (isguest()) {
error("Guests are not allowed to post comments", $_SERVER["HTTP_REFERER"]);
}
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
/// Printing the page header
if ($course->category) {
$navigation = "id\">$course->shortname ->";
}
switch ( $action ){
case "add":
$straction = get_string("addingcomment","glossary");
break;
case "edit":
$straction = get_string("editingcomment","glossary");
break;
case "delete":
$straction = get_string("deletingcomment","glossary");
break;
}
$strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
"$navigation id>$strglossaries -> id>$glossary->name -> id&eid=$entry->id>$strcomments -> " . $straction,
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
print_heading($glossary->name);
/// Info boxes
if ( $glossary->intro ) {
print_simple_box(format_text($glossary->intro), "center","70%");
echo "
";
}
echo "
"; echo "
";
echo "
| |||
";
if ($entry->attachment) {
$entry->course = $course->id;
echo "
| ";
echo "
"; echo "
cellheading\">";
$user = get_record("user", "id", $comment->userid);
$strby = get_string("writtenby","glossary");
print_user_picture($user->id, $course->id, $user->picture);
echo " $strby $user->firstname $user->lastname"; echo " (".get_string("lastedited").": ".userdate($comment->timemodified).")"; echo " | cellcontent\">"; echo format_text($comment->comment, $comment->format); echo " |
"; print_simple_box_start("center","40%", "#FFBBBB"); echo "