Permalink
Browse files

mnet: fixup remote enrolment handling pages - WIP

  • Loading branch information...
1 parent a298f31 commit ce89882a371e5e99ef51a0c9fac42767a12270e4 martinlanghoff committed Jan 18, 2007
Showing with 29 additions and 44 deletions.
  1. +4 −4 admin/mnet/enr_course_enrol.php
  2. +5 −14 admin/mnet/enr_courses.php
  3. +20 −26 admin/mnet/enr_hosts.php
@@ -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 @@
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
@@ -6,36 +6,29 @@
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');
$mnethost = required_param('host', PARAM_INT);
$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 />";
print ('<table align="center">');
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
@@ -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);
?>

0 comments on commit ce89882

Please sign in to comment.