mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
tags MDL-22030 fixed redirection error after adding a tag. fixed course tags links rendering on only first tag block.
This commit is contained in:
parent
0159e3b608
commit
43ff78fdb4
@ -237,6 +237,7 @@ class block_tags extends block_base {
|
||||
<form action="{$CFG->wwwroot}/tag/coursetags_add.php" method="post" id="coursetag"
|
||||
onsubmit="return ctags_checkinput(this.coursetag_new_tag.value)">
|
||||
<div style="display: none;">
|
||||
<input type="hidden" name="returnurl" value="{$this->page->url}" />
|
||||
<input type="hidden" name="entryid" value="$COURSE->id" />
|
||||
<input type="hidden" name="userid" value="$USER->id" />
|
||||
<input type="hidden" name="sesskey" value="$sesskey" />
|
||||
@ -273,8 +274,9 @@ EOT;
|
||||
|
||||
// Navigation elements at the bottom of the block
|
||||
// show the alternative displays options if available
|
||||
$elementid = 'coursetagslinks_'.$this->instance->id;
|
||||
if ($mytags or $officialtags or $commtags or $coursetags) {
|
||||
$this->content->footer .= '<div id="coursetagslinks"></div>';
|
||||
$this->content->footer .= '<div id="'.$elementid.'"></div>';
|
||||
}
|
||||
// This section sets the order of the links
|
||||
$coursetagslinks = array();
|
||||
@ -304,7 +306,7 @@ EOT;
|
||||
'onclick'=>'f_coursetags',
|
||||
'text'=>get_string('coursetags1', $tagslang));
|
||||
}
|
||||
coursetag_get_jscript_links($coursetagslinks);
|
||||
coursetag_get_jscript_links($elementid, $coursetagslinks);
|
||||
|
||||
} else {
|
||||
//if not logged in
|
||||
|
@ -15,6 +15,7 @@ if (empty($CFG->usetags)) {
|
||||
print_error('tagsaredisabled', 'tag');
|
||||
}
|
||||
|
||||
$returnurl = optional_param('returnurl', null, PARAM_TEXT);
|
||||
$keyword = optional_param('coursetag_new_tag', '', PARAM_TEXT);
|
||||
$courseid = optional_param('entryid', 0, PARAM_INT);
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
@ -32,8 +33,8 @@ if ($keyword and confirm_sesskey()) {
|
||||
}
|
||||
|
||||
// send back to originating page, where the new tag will be visible in the block
|
||||
if ($courseid > 0) {
|
||||
$myurl = $CFG->wwwroot.'/course/view.php?id='.$courseid;
|
||||
if ($returnurl) {
|
||||
redirect($returnurl);
|
||||
} else {
|
||||
$myurl = $CFG->wwwroot.'/';
|
||||
}
|
||||
|
@ -264,12 +264,12 @@ function coursetag_get_jscript($coursetagdivs = '') {
|
||||
/**
|
||||
* Returns javascript to create the links in the tag block footer.
|
||||
*/
|
||||
function coursetag_get_jscript_links($coursetagslinks) {
|
||||
function coursetag_get_jscript_links($elementid, $coursetagslinks) {
|
||||
global $PAGE;
|
||||
|
||||
if (!empty($coursetagslinks)) {
|
||||
foreach ($coursetagslinks as $a) {
|
||||
$PAGE->requires->js_function_call('add_tag_footer_link', array('coursetagslinks', $a['title'], $a['onclick'], $a['text']), true);
|
||||
$PAGE->requires->js_function_call('add_tag_footer_link', array($elementid, $a['title'], $a['onclick'], $a['text']), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user