- students cannot add/edit/delete comments if it isn't allowed

- students can view comments if they exist
- teachers bypass the commentsallowed field always (this can be useful to create glossaries with public comments from the teacher).
- buttons are showed correctly.

Bug 1814
(http://moodle.org/bugs/bug.php?op=show&bugid=1814)

Merged from MOODLE_14_STABLE
This commit is contained in:
stronk7 2004-08-28 18:34:10 +00:00
parent 9f106aa197
commit 944d82d4d3
3 changed files with 21 additions and 10 deletions

View file

@ -686,7 +686,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
$return .= "</font> ";
if ( $glossary->allowcomments and !isguest()) {
if ( ($glossary->allowcomments && !isguest()) || isteacher($glossary->course)) {
$return .= " <a title=\"" . get_string("addcomment","glossary") . "\" href=\"comment.php?id=$cm->id&eid=$entry->id\"><img src=\"comment.gif\" height=11 width=11 border=0></a> ";
}
@ -1557,11 +1557,11 @@ function glossary_print_comment($course, $cm, $glossary, $entry, $comment) {
echo "<div align=right><p align=right>";
$ineditperiod = ((time() - $comment->timemodified < $CFG->maxeditingtime) || $glossary->editalways);
if ( ($ineditperiod && $USER->id == $comment->userid) or isteacher($course->id) ) {
if ( ($glossary->allowcomments && $ineditperiod && $USER->id == $comment->userid) || isteacher($course->id) ) {
echo "<a href=\"comment.php?id=$cm->id&eid=$entry->id&cid=$comment->id&action=edit\"><img
alt=\"" . get_string("edit") . "\" src=\"$CFG->pixpath/t/edit.gif\" height=11 width=11 border=0></a> ";
}
if ( $USER->id == $comment->userid or isteacher($course->id) ) {
if ( ($glossary->allowcomments && $USER->id == $comment->userid) || isteacher($course->id) ) {
echo "<a href=\"comment.php?id=$cm->id&eid=$entry->id&cid=$comment->id&action=delete\"><img
alt=\"" . get_string("delete") . "\" src=\"$CFG->pixpath/t/delete.gif\" height=11 width=11 border=0></a>";
}