mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-14150 - Make tag:edit and tag:manage more distinct - related tags and description are now editing, renaming is managing. (merge from 1.9)
This commit is contained in:
parent
2173417c72
commit
3efae234fa
10
tag/edit.php
10
tag/edit.php
@ -69,7 +69,7 @@ if ($tagnew = $tagform->get_data()) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
if (!has_capability('moodle/tag:manage', $systemcontext) && !has_capability('moodle/tag:edit', $systemcontext)) {
|
||||
unset($tagnew->name);
|
||||
unset($tagnew->rawname);
|
||||
|
||||
@ -87,9 +87,11 @@ if ($tagnew = $tagform->get_data()) {
|
||||
|
||||
$tagnew->timemodified = time();
|
||||
|
||||
// rename tag if needed
|
||||
if (!tag_rename($tag->id, $tagnew->rawname)) {
|
||||
print_error('Error updating tag record');
|
||||
if (has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
// rename tag
|
||||
if(!tag_rename($tag->id, $tagnew->rawname)) {
|
||||
error('Error updating tag record');
|
||||
}
|
||||
}
|
||||
|
||||
//updated related tags
|
||||
|
@ -177,13 +177,11 @@ function tag_print_management_box($tag_object, $return=false) {
|
||||
$links[] = '<a href="'. $CFG->wwwroot .'/tag/user.php?action=flaginappropriate&sesskey='. sesskey() .'&tag='. rawurlencode($tag_object->name) .'">'. get_string('flagasinappropriate', 'tag', rawurlencode($tagname)) .'</a>';
|
||||
|
||||
// Edit tag: Only people with moodle/tag:edit capability who either have it as an interest or can manage tags
|
||||
if (has_capability('moodle/tag:edit', $systemcontext) &&
|
||||
(tag_record_tagged_with('user', $USER->id, $tag_object->name) ||
|
||||
has_capability('moodle/tag:manage', $systemcontext))) {
|
||||
if (has_capability('moodle/tag:edit', $systemcontext) ||
|
||||
has_capability('moodle/tag:manage', $systemcontext)) {
|
||||
$links[] = '<a href="'. $CFG->wwwroot .'/tag/edit.php?tag='. rawurlencode($tag_object->name) .'">'. get_string('edittag', 'tag') .'</a>';
|
||||
}
|
||||
|
||||
|
||||
$output .= implode(' | ', $links);
|
||||
$output .= print_box_end(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user