Skip to content

Commit

Permalink
webservice MDL-12886 do not display the web service core if no servic…
Browse files Browse the repository at this point in the history
…e available
  • Loading branch information
mouneyrac committed Dec 21, 2009
1 parent ac9b2d3 commit 6b36958
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions lib/adminlib.php
Expand Up @@ -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 = "<span>$name</span>";
} else {
$displayname = "<span class=\"dimmed_text\">$name</span>";
}
// iterate through auth plugins and add to the display table
foreach ($services as $service) {
$name = $service->name;

// hide/show link
if ($service->enabled) {
$displayname = "<span>$name</span>";
} else {
$displayname = "<span class=\"dimmed_text\">$name</span>";
}

$plugin = $service->component;
$plugin = $service->component;

$functions = "<a href=\"$efurl?id=$service->id\">$strfunctions</a>";
$functions = "<a href=\"$efurl?id=$service->id\">$strfunctions</a>";

if ($service->restrictedusers) {
$users = "<a href=\"$euurl?id=$service->id\">$strserviceusers</a>";
} else {
$users = '-';
}
if ($service->restrictedusers) {
$users = "<a href=\"$euurl?id=$service->id\">$strserviceusers</a>";
} else {
$users = '-';
}

$edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";
$edit = "<a href=\"$esurl?id=$service->id\">$stredit</a>";

// 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');
Expand Down

0 comments on commit 6b36958

Please sign in to comment.