mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
removing some isteacher()s from glossary
This commit is contained in:
parent
18d8a6a741
commit
b3e570450f
@ -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!");
|
||||
}
|
||||
|
||||
|
@ -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.'&course='.$course->id.'">'.$fullname.'</a>';
|
||||
$by->date = userdate($entry->timemodified);
|
||||
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>' . '<br />';
|
||||
|
@ -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.'&course='.$course->id.'">'.$fullname.'</a>';
|
||||
$by->date = userdate($entry->timemodified);
|
||||
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
|
||||
|
@ -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.'&course='.$course->id.'">'.$fullname.'</a>';
|
||||
$by->date = userdate($entry->timemodified);
|
||||
echo '<span class="author">'.get_string('bynameondate', 'forum', $by).'</span>';
|
||||
|
@ -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) &&
|
||||
|
@ -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&mode=delete&entry=$entry->id&prevmode=$mode&hook=$hook\"><img src=\"";
|
||||
$return .= $icon;
|
||||
|
@ -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>" ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user