You are here

function hosting_server_listing in Hosting 6.2

Output a table of servers with their enabled services.

1 string reference to 'hosting_server_listing'
hosting_server_menu in server/hosting_server.module
Implementation of hook_menu().

File

server/hosting_server.module, line 514

Code

function hosting_server_listing() {
  $services = hosting_server_services();
  $header = array(
    t('Server'),
  );
  foreach ($services as $service => $data) {
    if ($service !== 'server') {
      $header[] = $data['title'];
    }
  }
  $result = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.type='server' AND n.status = 1 ORDER BY n.title"));
  $rows = array();
  while ($obj = db_fetch_object($result)) {
    $row = array();
    $server = node_load($obj->nid);
    $row[] = l($server->title, 'node/' . $server->nid);
    foreach ($services as $service => $data) {
      if ($service !== 'server') {
        if ($server->services[$service]->available) {
          $row[] = array(
            'class' => 'hosting-service-available',
            'data' => $server->services[$service]->type,
          );
        }
        else {
          $row[] = array(
            'class' => 'hosting-service-unavailable',
            'data' => t('No'),
          );
        }
      }
    }
    $rows[] = $row;
  }
  return theme('table', $header, $rows, array(
    'class' => 'hosting-table',
  ));
}