Better links for managing tags
This commit is contained in:
+12
-16
@@ -1208,29 +1208,27 @@ function print_tag_management_box($tag_object, $return=false) {
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
$addtaglink = '';
|
||||
|
||||
if ( has_capability('moodle/tag:manage',$systemcontext) ) {
|
||||
$manage_link = "<a href=\"{$CFG->wwwroot}/tag/manage.php\">" . get_string('managetags', 'tag') . "</a>" ;
|
||||
$output .= $manage_link .' | ';
|
||||
}
|
||||
$links = array();
|
||||
|
||||
// if the user is not tagged with the $tag_object tag, a link "add blahblah to my interests" will appear
|
||||
if( !is_item_tagged_with('user', $USER->id, $tag_object->id )) {
|
||||
$addtaglink = '<a href="' . $CFG->wwwroot . '/user/tag.php?action=addinterest&sesskey='.sesskey().'&id='. $tag_object->id .'">';
|
||||
$addtaglink .= get_string('addtagtomyinterests','tag',$tagname). '</a>';
|
||||
$output .= $addtaglink .' | ';
|
||||
$links[] = '<a href="' . $CFG->wwwroot . '/user/tag.php?action=addinterest&sesskey='.sesskey().'&id='. $tag_object->id .'">'.get_string('addtagtomyinterests','tag',$tagname). '</a>';
|
||||
}
|
||||
|
||||
// only people with moodle/tag:edit capability may edit the tag description
|
||||
if ( has_capability('moodle/tag:edit',$systemcontext) && is_item_tagged_with('user', $USER->id, $tag_object->id ) ) {
|
||||
$output .= ' <a href="'. $CFG->wwwroot . '/tag/edit.php?id='.$tag_object->id .'">'.get_string('edittag', 'tag').'</a> | ';
|
||||
$links[] = '<a href="'. $CFG->wwwroot . '/tag/edit.php?id='.$tag_object->id .'">'.get_string('edittag', 'tag').'</a>';
|
||||
}
|
||||
|
||||
// flag as inappropriate link
|
||||
$flagtaglink = '<a href="' . $CFG->wwwroot . '/user/tag.php?action=flaginappropriate&sesskey='.sesskey().'&id='. $tag_object->id .'">';
|
||||
$flagtaglink .= get_string('flagasinappropriate','tag',$tagname). '</a>';
|
||||
$output .= $flagtaglink;
|
||||
$links[] = '<a href="' . $CFG->wwwroot . '/user/tag.php?action=flaginappropriate&sesskey='.sesskey().'&id='. $tag_object->id .'">' . get_string('flagasinappropriate','tag',$tagname). '</a>';
|
||||
|
||||
// Manage all tags links
|
||||
if ( has_capability('moodle/tag:manage',$systemcontext) ) {
|
||||
$links[] = '<a href="'.$CFG->wwwroot.'/tag/manage.php">' . get_string('managetags', 'tag') . '</a>' ;
|
||||
}
|
||||
|
||||
$output .= implode(' | ', $links);
|
||||
|
||||
$output .= print_box_end(true);
|
||||
|
||||
@@ -1238,12 +1236,10 @@ function print_tag_management_box($tag_object, $return=false) {
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user