|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); 00028 require_once($CFG->libdir.'/adminlib.php'); 00029 require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php'); 00030 00031 admin_externalpage_setup('mnetenrol'); 00032 $service = mnetservice_enrol::get_instance(); 00033 00034 echo $OUTPUT->header(); 00035 echo $OUTPUT->heading_with_help(get_string('clientname', 'mnetservice_enrol'), 'clientname', 'mnetservice_enrol'); 00036 00037 if (!$service->is_available()) { 00038 echo $OUTPUT->box(get_string('mnetdisabled','mnet'), 'noticebox'); 00039 echo $OUTPUT->footer(); 00040 die(); 00041 } 00042 00043 $roamingusers = get_users_by_capability(get_system_context(), 'moodle/site:mnetlogintoremote', 'u.id'); 00044 if (empty($roamingusers)) { 00045 $capname = get_string('site:mnetlogintoremote', 'role'); 00046 $url = new moodle_url('/admin/roles/manage.php'); 00047 echo notice(get_string('noroamingusers', 'mnetservice_enrol', $capname), $url); 00048 } 00049 unset($roamingusers); 00050 00051 // remote hosts that may publish remote enrolment service and we are subscribed to it 00052 $hosts = $service->get_remote_publishers(); 00053 00054 if (empty($hosts)) { 00055 echo $OUTPUT->box(get_string('nopublishers', 'mnetservice_enrol'), 'noticebox'); 00056 echo $OUTPUT->footer(); 00057 die(); 00058 } 00059 00060 $table = new html_table(); 00061 $table->attributes['class'] = 'generaltable remotehosts'; 00062 $table->head = array( 00063 get_string('hostappname', 'mnetservice_enrol'), 00064 get_string('hostname', 'mnetservice_enrol'), 00065 get_string('hosturl', 'mnetservice_enrol'), 00066 get_string('action') 00067 ); 00068 foreach ($hosts as $host) { 00069 $hostlink = html_writer::link(new moodle_url($host->hosturl), s($host->hosturl)); 00070 $editbtn = $OUTPUT->single_button(new moodle_url('/mnet/service/enrol/host.php', array('id'=>$host->id)), 00071 get_string('editenrolments', 'mnetservice_enrol'), 'get'); 00072 $table->data[] = array(s($host->appname), s($host->hostname), $hostlink, $editbtn); 00073 } 00074 echo html_writer::table($table); 00075 00076 echo $OUTPUT->footer();