mnet: fixup remote enrolment handling pages - WIP

This commit is contained in:
martinlanghoff 2007-01-18 04:48:35 +00:00
parent a298f31145
commit ce89882a37
3 changed files with 29 additions and 44 deletions

View File

@ -7,9 +7,9 @@
include_once($CFG->dirroot.'/mnet/xmlrpc/client.php');
$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
admin_externalpage_setup('mnetenrol', $adminroot);
$CFG->pagepath = 'admin/mnet';
$CFG->pagepath = 'enrol/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
@ -106,7 +106,7 @@
u.firstname,
u.lastname,
u.email,
coalesce ( a.hostid , 0) as ismnetenrolment,
COALESCE(a.hostid, 0) as ismnetenrolment,
a.courseid
FROM
{$CFG->prefix}user u
@ -181,7 +181,7 @@ print_simple_box_end();
echo "<hr />";
print_simple_box_start('center');
include('remote_enrolment.html');
include(dirname(__FILE__).'/enr_course_enrol.html');
print_simple_box_end();
if (!empty($errors)) {

View File

@ -6,9 +6,9 @@
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
admin_externalpage_setup('mnetenrol', $adminroot);
$CFG->pagepath = 'admin/mnet';
$CFG->pagepath = 'enrol/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
@ -16,18 +16,11 @@
$courses = $enrolment->fetch_remote_courses($mnethost);
/// Print the page
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
/// Print the page
admin_externalpage_print_header($adminroot);
print_simple_box_start("center", "80%");
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_string("description", "enrol_mnet");
print_simple_box_end();
print_box(get_string("description", "enrol_mnet"));
echo "<hr />";
@ -35,7 +28,7 @@
foreach ($courses as $course) {
print ('<tr>'
. "<td colspan=\"2\"><a href=\"{$CFG->wwwroot}/enrol/mnet/remote_enrolment.php?host={$mnethost}&amp;courseid={$course->id}\">{$course->fullname}</a></td>"
. "<td colspan=\"2\"><a href=\"{$CFG->wwwroot}/admin/mnet/enr_course_enrol.php?host={$mnethost}&amp;courseid={$course->id}&amp;sesskey={$USER->sesskey}\">{$course->fullname}</a></td>"
. '</tr><tr>'
. "<td align=\"left\" valign=\"top\">{$course->shortname}<br />"
. '</td>'
@ -44,8 +37,6 @@
}
print ('</table>');
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
?>

View File

@ -6,59 +6,53 @@
require_once($CFG->libdir.'/adminlib.php');
$adminroot = admin_get_root();
admin_externalpage_setup('enrolment', $adminroot);
$CFG->pagepath = 'enrol/mnet';
admin_externalpage_setup('mnetenrol', $adminroot);
$CFG->pagepath = 'admin/mnet';
require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
/// If data submitted, then process and store.
if ($frm = data_submitted()) {
}
/// Otherwise fill and print the form.
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
admin_externalpage_print_header($adminroot);
/// Print current enrolment type description
print_simple_box_start("center", "80%");
print_heading($options[$enrol]);
print_simple_box_start("center", "60%", '', 5, 'informationbox');
print_string("description", "enrol_$enrol");
print_simple_box_end();
print_box(get_string("remoteenrolhosts_desc", "mnet"));
echo "<hr />";
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
print_box(get_string('mnetdisabled','mnet'));
}
print ('<table align="center">'
. '<tr>'
. '<th> Name </th>'
. '<th> Host </th>'
. '<th> Enrolments </th>'
. '<th> Available Courses </th>'
. '<th> Activity </th>'
. '<th> Courses </th>'
. '<th> &nbsp; </th>'
. '</tr>');
$hosts = $enrolment->list_remote_servers();
foreach ($hosts as $host) {
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&amp;sesskey={$USER->sesskey}";
$coursecount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_course WHERE hostid={$host->id}");
if (empty($coursecount)) {
$coursecount = '?';
}
$enrolcount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_assignments WHERE hostid={$host->id}");
print ('<tr>'
. "<td><a href=\"{$CFG->wwwroot}/enrol/mnet/remote_courses.php?host={$host->id}\">{$host->name}</a></td>"
. '<td align="center" > - (View) </td>'
. "<td align=\"center\" > - (<a href=\"{$CFG->wwwroot}/enrol/mnet/remote_courses.php?host={$host->id}\">Enrol</a>) </td>"
. "<td><a href=\"{$coursesurl}\">{$host->name}</a></td>"
. "<td align=\"center\" >$enrolcount</td>"
. "<td align=\"center\" ><a href=\"{$coursesurl}\">$coursecount - edit</a></td>"
. '<td align="center" > <a href="">Logs</a> </td>'
. '</tr>');
}
print ('</table>');
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
?>