From 6b36958872903856745de2e3109c97ff2cce6e1b Mon Sep 17 00:00:00 2001 From: jerome mouneyrac Date: Mon, 21 Dec 2009 06:11:50 +0000 Subject: [PATCH] webservice MDL-12886 do not display the web service core if no service available --- lib/adminlib.php | 60 ++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index e5d435ebbaf1c..e7e1bbde0f140 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -6174,44 +6174,48 @@ public function output_html($data, $query='') { $euurl = "$CFG->wwwroot/$CFG->admin/webservice/service_users.php"; // built in services - $return = $OUTPUT->heading(get_string('servicesbuiltin', 'webservice'), 3, 'main'); + $services = $DB->get_records_select('external_services', 'component IS NOT NULL', null, 'name'); + $return = ""; + if (!empty($services)) { + $return .= $OUTPUT->heading(get_string('servicesbuiltin', 'webservice'), 3, 'main'); - $services = $DB->get_records_select('external_services', 'component IS NOT NULL', null, 'name'); - $table = new html_table(); - $table->head = array($strservice, $strplugin, $strfunctions, $strusers, $stredit); - $table->align = array('left', 'left', 'center', 'center', 'center'); - $table->size = array('30%', '20%', '20%', '20%', '10%'); - $table->width = '100%'; - $table->data = array(); - // iterate through auth plugins and add to the display table - foreach ($services as $service) { - $name = $service->name; + $table = new html_table(); + $table->head = array($strservice, $strplugin, $strfunctions, $strusers, $stredit); + $table->align = array('left', 'left', 'center', 'center', 'center'); + $table->size = array('30%', '20%', '20%', '20%', '10%'); + $table->width = '100%'; + $table->data = array(); - // hide/show link - if ($service->enabled) { - $displayname = "$name"; - } else { - $displayname = "$name"; - } + // iterate through auth plugins and add to the display table + foreach ($services as $service) { + $name = $service->name; + + // hide/show link + if ($service->enabled) { + $displayname = "$name"; + } else { + $displayname = "$name"; + } - $plugin = $service->component; + $plugin = $service->component; - $functions = "id\">$strfunctions"; + $functions = "id\">$strfunctions"; - if ($service->restrictedusers) { - $users = "id\">$strserviceusers"; - } else { - $users = '-'; - } + if ($service->restrictedusers) { + $users = "id\">$strserviceusers"; + } else { + $users = '-'; + } - $edit = "id\">$stredit"; + $edit = "id\">$stredit"; - // add a row to the table - $table->data[] = array($displayname, $plugin, $functions, $users, $edit); + // add a row to the table + $table->data[] = array($displayname, $plugin, $functions, $users, $edit); + } + $return .= $OUTPUT->table($table); } - $return .= $OUTPUT->table($table); // Custom services $return .= $OUTPUT->heading(get_string('servicescustom', 'webservice'), 3, 'main');