]> git.mjollnir.org Git - moodle.git/commitdiff
mnet: fixup remote enrolment handling pages - WIP
authormartinlanghoff <martinlanghoff>
Thu, 18 Jan 2007 04:48:35 +0000 (04:48 +0000)
committermartinlanghoff <martinlanghoff>
Thu, 18 Jan 2007 04:48:35 +0000 (04:48 +0000)
admin/mnet/enr_course_enrol.php
admin/mnet/enr_courses.php
admin/mnet/enr_hosts.php

index dcbd95e6a3c568a8492bf1c6eaa120d5e2e0a88b..cc8d05d50890229a880be93ec43445181a843b8e 100644 (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');
 
                 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)) {
index 425cafa813a9ff83d4755592d4c2659d69a6561f..295c66e050a85729dbbc2d2c3500d913b2404422 100644 (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');
 
 
     $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);
 
 ?>
index 8a4c688a5914af19dd6330c7679b24c5b8389dd5..8514a4d042263b0e257c4b774d4308f690e638d8 100644 (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);
 
 ?>