diff --git a/blocks/course_list/block_course_list.php b/blocks/course_list/block_course_list.php index e2e3752a5c1..c307276ec72 100644 --- a/blocks/course_list/block_course_list.php +++ b/blocks/course_list/block_course_list.php @@ -51,6 +51,7 @@ class block_course_list extends block_list { $this->title = get_string('mycourses'); $this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>..."; if ($this->content->items) { // make sure we don't return an empty list + $this->get_remote_courses(); return $this->content; } } @@ -79,19 +80,46 @@ class block_course_list extends block_list { $this->content->icons[]=$icon; } $this->content->footer = "<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>..."; + $this->get_remote_courses(); } else { - $this->content->items = array(); - $this->content->icons = array(); - $this->content->footer = get_string('nocoursesyet').'<br /><br />'; - if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id))) { - $this->content->footer .= '<a href="'.$CFG->wwwroot.'/course/edit.php?category='.$category->id.'">'.get_string("addnewcourse").'</a>...'; + if ($this->get_remote_courses()) { + $this->content->items = array(); + $this->content->icons = array(); + $this->content->footer = get_string('nocoursesyet').'<br /><br />'; + if (has_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id))) { + $this->content->footer .= '<a href="'.$CFG->wwwroot.'/course/edit.php?category='.$category->id.'">'.get_string("addnewcourse").'</a>...'; + } } } $this->title = get_string('courses'); } } + return $this->content; } + + function get_remote_courses() { + global $THEME, $CFG, $USER; + $sql = "SELECT c.remoteid, c.shortname, c.fullname, c.hostid + FROM {$CFG->prefix}mnet_enrol_course c + JOIN {$CFG->prefix}mnet_enrol_assignments a ON c.id=a.courseid + WHERE a.studentid={$USER->id}"; + if ($courses = get_records_sql($sql)) { + $icon = "<img src=\"$CFG->pixpath/i/mnethost.png\"". + " height=\"16\" width=\"16\" alt=\"".get_string("course")."\" />"; + $this->content->items[] = 'Remote Courses'; + $this->content->icons[] = ''; + foreach ($courses as $course) { + $this->content->items[]="<a title=\"$course->shortname\" ". + "href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&wantsurl=/course/view.php?id={$course->remoteid}\">$course->fullname</a>"; + $this->content->icons[]=$icon; + } + } else { + return false; + } + return true; + } + } ?> diff --git a/blocks/login/block_login.php b/blocks/login/block_login.php index 4c140af426e..decfe2cd44f 100644 --- a/blocks/login/block_login.php +++ b/blocks/login/block_login.php @@ -27,19 +27,12 @@ class block_login extends block_base { $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); } - if ($CFG->auth == 'email') { + $authplugin = get_auth_plugin($CFG->auth); + if (method_exists($authplugin, 'user_signup')) { $signup = $wwwroot . '/login/signup.php'; + } + if ($authplugin->can_change_password()) { $forgot = $wwwroot . '/login/forgot_password.php'; - } else { - if (!empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'}) - || is_internal_auth() ) { - if (is_internal_auth() || !empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})) { - $forgot = $wwwroot . '/login/forgot_password.php'; - } - else { - $forgot = ''; - } - } } $username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();