Permalink
Browse files

enrol/ldap: (merge from HEAD) bugfixes suggested by Jeff Graham here h…

…ttp://moodle.org/mod/forum/post.php?reply=124170 -- fixes course creation not pulling summaries, form errors in ldap_search_sub, calls to deprecated blocks_get_default_blocks() and DB errors when inserting new enrolments. With these fixes, it may even work.
  • Loading branch information...
1 parent 0591a08 commit 6f095c04a96f949ec0a4e0fe92ed5d2f5505a411 martinlanghoff committed Jul 1, 2005
Showing with 6 additions and 6 deletions.
  1. +2 −2 enrol/ldap/config.html
  2. +4 −4 enrol/ldap/enrol.php
View
@@ -91,10 +91,10 @@
<td align="right">ldap_search_sub:</td>
<td>
<?php
- $choices = array();;
+ $choices = array();
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
- choose_from_menu ($choices, "enrol_ldap_search_sub", $form->enrol_ldap_search_sub, "");
+ choose_from_menu ($choices, "enrol_ldap_search_sub", $frm->enrol_ldap_search_sub, "");
?>
<?php if (isset($err["enrol_ldap_search_sub"])) formerr($err["enrol_ldap_search_sub"]); ?>
</td><td>
View
@@ -97,12 +97,12 @@ function get_user_courses(&$user, $type) {
$CFG->debug=10;
if ($type === 'student') { // enrol
error_log("Enrolling student $user->id ($user->username) in course $course_obj->id ($course_obj->shortname) ");
- if (! enrol_student($user->id, $course_obj->id, NULL,NULL, 'ldap')){
+ if (! enrol_student($user->id, $course_obj->id, 0, 0, 'ldap')){
error_log("Failed to enrol student $user->id ($user->username) into course $course_obj->id ($course_obj->shortname)");
}
} else if ($type === 'teacher') {
error_log("Enrolling teacher $user->id ($user->username) in course $course_obj->id ($course_obj->shortname)");
- add_teacher($user->id, $course_obj->id, NULL,NULL,NULL, NULL,'ldap');
+ add_teacher($user->id, $course_obj->id, 1, 0, 0,'ldap');
}
$CFG->debug=0;
}
@@ -559,7 +559,7 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
$course->teacher = 'Teacher';
$course->teachers = 'Teachers';
$course->format = 'topics';
- $course->blockinfo = blocks_get_default_blocks();
+ $course->blockinfo = blocks_get_default();
// override defaults with template course
if(!empty($CFG->enrol_ldap_template)){
@@ -582,7 +582,7 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
}
if(!empty($CFG->enrol_ldap_course_summary)){ // optional
- $course->summary = $course_ext->{$CFG->enrol_ldap_course_summary}[0];
+ $course->summary = $course_ext[$CFG->enrol_ldap_course_summary][0];
}
if(!empty($CFG->enrol_ldap_category)){ // optional ... but ensure it is set!
$course->category = $CFG->enrol_ldap_category;

0 comments on commit 6f095c0

Please sign in to comment.