Merged enrolment-related fixes from stable
This commit is contained in:
@@ -143,16 +143,14 @@ class block_admin extends block_list {
|
||||
}
|
||||
|
||||
/// Authorize hooks
|
||||
if (has_capability('enrol/authorize:managepayments', $context)) {
|
||||
if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) {
|
||||
require_once($CFG->dirroot.'/enrol/authorize/const.php');
|
||||
$paymenturl = '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?course='.$course->id.'">'.get_string('payments').'</a> ';
|
||||
if ($cnt = count_records('enrol_authorize', 'status', AN_STATUS_AUTH, 'courseid', $course->id)) {
|
||||
$paymenturl .= '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?status='.AN_STATUS_AUTH.'&course='.$course->id.'">'.get_string('paymentpending', 'moodle', $cnt).'</a>';
|
||||
}
|
||||
$this->content->items[] = $paymenturl;
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
|
||||
if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) {
|
||||
require_once($CFG->dirroot.'/enrol/authorize/const.php');
|
||||
$paymenturl = '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?course='.$course->id.'">'.get_string('payments').'</a> ';
|
||||
if ($cnt = count_records('enrol_authorize', 'status', AN_STATUS_AUTH, 'courseid', $course->id)) {
|
||||
$paymenturl .= '<a href="'.$CFG->wwwroot.'/enrol/authorize/index.php?status='.AN_STATUS_AUTH.'&course='.$course->id.'">'.get_string('paymentpending', 'moodle', $cnt).'</a>';
|
||||
}
|
||||
$this->content->items[] = $paymenturl;
|
||||
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
|
||||
}
|
||||
|
||||
/// View course grades (or just your own grades, same link)
|
||||
@@ -162,14 +160,16 @@ class block_admin extends block_list {
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" alt="" />';
|
||||
}
|
||||
|
||||
/// Person can unenrol themselves from this course
|
||||
if (has_capability('moodle/role:unassignself', $context, NULL, false) and empty($course->metacourse)) {
|
||||
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
if (empty($course->metacourse)) {
|
||||
if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Are a guest now
|
||||
$this->content->items[]='<a href="enrol.php?id='.$this->instance->pageid.'">'.get_string('enrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
} else if (has_capability('moodle/role:unassignself', $context, NULL, false)) { // Have some role
|
||||
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
|
||||
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Should the following two be in this block?
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ function print_entry($course) {
|
||||
print_error('couldnotassignrole');
|
||||
}
|
||||
|
||||
if ($SESSION->wantsurl) {
|
||||
if (!empty($SESSION->wantsurl)) {
|
||||
$destination = $SESSION->wantsurl;
|
||||
unset($SESSION->wantsurl);
|
||||
} else {
|
||||
@@ -86,7 +86,13 @@ function print_entry($course) {
|
||||
|
||||
} else if (!empty($_GET['cancel'])) {
|
||||
unset($SESSION->wantsurl);
|
||||
redirect($CFG->wwwroot);
|
||||
if (!empty($SESSION->enrolcancel)) {
|
||||
$destination = $SESSION->enrolcancel;
|
||||
unset($SESSION->enrolcancel);
|
||||
} else {
|
||||
$destination = $CFG->wwwroot;
|
||||
}
|
||||
redirect($destination);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1469,9 +1469,10 @@ $string['yahooid'] = 'Yahoo ID';
|
||||
$string['yes'] = 'Yes';
|
||||
$string['youareabouttocreatezip'] = 'You are about to create a zip file containing';
|
||||
$string['youaregoingtorestorefrom'] = 'You are about to start the restore process for';
|
||||
$string['youneedtoenrol'] = 'To perform that action you need to enrol in this course.';
|
||||
$string['yourlastlogin'] = 'Your last login was';
|
||||
$string['yourself'] = 'yourself';
|
||||
$string['yourteacher'] = 'your $a';
|
||||
$string['zippingbackup'] = 'Zipping backup';
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
+8
-1
@@ -376,10 +376,17 @@
|
||||
if (! $course = get_record("course", "id", $discussion->course)) {
|
||||
error("The course number was incorrect ($discussion->course)");
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
if (! forum_user_can_post($forum)) {
|
||||
error("Sorry, but you can not post in this forum.");
|
||||
if (has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) { // User is a guest here!
|
||||
$SESSION->wantsurl = $FULLME;
|
||||
$SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
|
||||
redirect($CFG->wwwroot.'/course/enrol.php?id='.$course->id, get_string('youneedtoenrol'));
|
||||
} else {
|
||||
print_error('nopostforum', 'forum');
|
||||
}
|
||||
}
|
||||
|
||||
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
|
||||
|
||||
Reference in New Issue
Block a user