Hi Worth,
I've messed around with the enrollment code enought that I think I can actually help you. Actually, you are going about it backwards. Instead of trying to force the paypal button into course>lib.php, you need to force the course summary box into the paypal>enrol.php file to include the paypal button. Right now it prints the course summary info in its own box with the paypal enrollment box below it. I just tried it by pasting the course box print from course>lib and messing around with it a little and see what I got below: (I also deleted the strings that go above the button from the paypal>enrol.html file). Maybe you can mess around with it to add back in the course cost (I lost that somehow?). You just add that string back above the form in the enrol.html file to do this. I didn't do that for this example. To get started, in the payal>enrol.php file, paste the following between the print_header and print_footer.
print_simple_box_start("center", '', 5, "coursebox");
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
echo "<table width=\"100%\">";
echo '<tr valign="top">';
echo '<td valign="top" width="50%" class="info">';
echo '<b><a title="'.get_string('entercourse').'"'.
$linkcss.' href="'.$CFG->
wwwroot.'/course/view.php?id='.$course->id.'">'.
$course->fullname.'</a></b><br />';
if ($teachers = get_course_teachers($course->id)) {
echo "<span class=\"teachers\">\n";
foreach ($teachers as $teacher) {
if ($teacher->authority > 0) {
if (!$teacher->role) {
$teacher->role = $course->teacher;
}
$fullname = fullname($teacher, isteacher($course->id)); // is the USER a teacher of that course
echo $teacher->role.': <a href="'.$CFG->wwwroot.'/user/view.php?id='.$teacher->id.
'&course='.SITEID.'">'.$fullname.'</a><br />';
}
}
echo "</span>\n";
}
echo '</td><td valign="top" width="50%" class="summary">';
$options = NULL;
$options->noclean = true;
$options->para = false;
echo format_text($course->summary, FORMAT_MOODLE, $options, $course->id);
echo "</td></tr>";
echo "</table>";
if ($course->password) { // Presenting two options
print_simple_box(get_string('costorkey', 'enrol_paypal'), 'center');
}
//Sanitise some fields before building the PayPal form
$coursefullname = $this->sanitise_for_paypal($course->fullname);
$courseshortname = $this->sanitise_for_paypal($course->shortname);
$userfullname = $this->sanitise_for_paypal(fullname($USER));
$userfirstname = $this->sanitise_for_paypal($USER->firstname);
$userlastname = $this->sanitise_for_paypal($USER->lastname);
$useraddress = $this->sanitise_for_paypal($USER->address);
$usercity = $this->sanitise_for_paypal($USER->city);
include($CFG->
dirroot.'/enrol/paypal/enrol.html');
if ($course->password) { // Second option
$password = '';
include($CFG->dirroot.'/enrol/internal/enrol.html');
}
print_simple_box_end();