Merged fix for doc links MDL-10670 from 1.8 stable

This commit is contained in:
moodler
2007-07-31 16:19:53 +00:00
parent 71ee4471ac
commit 80c3fd51ee
+16 -2
View File
@@ -6160,7 +6160,21 @@ function convert_tabrows_to_tree($tabrows, $selected, $inactive, $activated) {
* @param string $iconpath The path to the icon to be displayed
*/
function page_doc_link($text='', $iconpath='') {
global $ME, $CFG;
global $ME, $COURSE, $CFG;
if (empty($CFG->docroot)) {
return '';
}
if (empty($COURSE->id)) {
$context = get_context_instance(CONTEXT_SYSTEM);
} else {
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
}
if (!has_capability('moodle/site:doclinks', $context)) {
return '';
}
if (empty($CFG->pagepath)) {
$CFG->pagepath = $ME;
@@ -6187,7 +6201,7 @@ function page_doc_link($text='', $iconpath='') {
function doc_link($path='', $text='', $iconpath='') {
global $CFG;
if (empty($CFG->docroot) || !has_capability('moodle/site:doclinks')) {
if (empty($CFG->docroot)) {
return '';
}