removing some isteacher()s from glossary

This commit is contained in:
skodak 2006-08-26 19:19:36 +00:00
parent 18d8a6a741
commit b3e570450f
7 changed files with 13 additions and 16 deletions

View File

@ -30,18 +30,13 @@
require_login($course->id, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/glossary:view', $context);
$manageentries = has_capability('mod/glossary:manageentries', $context);
if (isguest()) {
error("Guests are not allowed to edit or delete entries", $_SERVER["HTTP_REFERER"]);
}
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
error("Glossary is incorrect");
}
if (!has_capability('mod/glossary:manageentries', $context) ) {
error("You are not allowed to edit or delete entries");
}
$strareyousuredelete = get_string("areyousuredelete","glossary");
@ -51,11 +46,11 @@
navmenu($course, $cm));
if (($entry->userid != $USER->id) and !isteacher($course->id)) {
if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
error("You can't delete other people's entries!");
}
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if (!$ineditperiod and !isteacher($course->id)) {
if ((!$ineditperiod or !$glossary->studentcanpost) and !$manageentries) {
error("You can't delete this. Time expired!");
}

View File

@ -23,7 +23,7 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
//Use this code to show author's name
//Comments: Configuration not supported
$fullname = fullname($user, isteacher($course->id));
$fullname = fullname($user);
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>' . '<br />';

View File

@ -21,7 +21,7 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
glossary_print_entry_concept($entry);
echo '</span><br />';
$fullname = fullname($user, isteacher($course->id));
$fullname = fullname($user);
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';

View File

@ -22,7 +22,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
glossary_print_entry_concept($entry);
echo '</span><br />';
$fullname = fullname($user, isteacher($course->id));
$fullname = fullname($user);
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.$fullname.'</a>';
$by->date = userdate($entry->timemodified);
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';

View File

@ -14,6 +14,7 @@
}
require_course_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
add_to_log($course->id, "glossary", "view all", "index.php?id=$course->id", "");
@ -55,7 +56,7 @@
$table->align = array ("LEFT", "CENTER");
}
$can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin());
$can_subscribe = has_capability('mod/glossary:view', $context);
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&

View File

@ -819,7 +819,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
// -It isn't a imported entry (so nobody can edit a imported (from secondary to main) entry)) and
// -The user is teacher or he is a student with time permissions (edit period or editalways defined).
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ( !$importedentry and (has_capability('mod/glossary:manageentries', $context) or ($entry->userid == $USER->id and $ineditperiod))) {
if ( !$importedentry and (has_capability('mod/glossary:manageentries', $context) or ($entry->userid == $USER->id and ($ineditperiod and $glossary->studentcanpost)))) {
$output = true;
$return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&amp;mode=delete&amp;entry=$entry->id&amp;prevmode=$mode&amp;hook=$hook\"><img src=\"";
$return .= $icon;

View File

@ -33,11 +33,12 @@
print_header();
require_course_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
/// Loading the textlib singleton instance. We are going to need it.
$textlib = textlib_get_instance();
if (!isteacher($course->id) and !$glossary->allowprintview) {
if (!has_capability('mod/glossary:manageentries', $context) and !$glossary->allowprintview) {
notice(get_string('printviewnotallowed', 'glossary'));
}
@ -169,7 +170,7 @@
if ( isset($entry->uid) ) {
// printing the user icon if defined (only when browsing authors)
$user = get_record("user","id",$entry->uid);
$pivottoshow = fullname($user, isteacher($course->id));
$pivottoshow = fullname($user);
}
echo "<p align=\"center\"><strong>".clean_text($pivottoshow)."</strong></p>" ;