class hosting_server_handler_field_services

Field handler to show services running on servers.

Hierarchy

Expanded class hierarchy of hosting_server_handler_field_services

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
hosting_server_handler_field_services::construct function Constructor; calls to base object constructor.
hosting_server_handler_field_services::label function Build a table header compiled from available services.
hosting_server_handler_field_services::render function Build a list of services.

File

server/includes/views/handlers/hosting_server_handler_field_services.inc, line 13
Definition of hosting_server_handler_field_services.

View source
class hosting_server_handler_field_services extends views_handler_field {
  /**
   * Constructor; calls to base object constructor.
   */
  function construct() {
    parent::construct();
    //$this->additional_fields = array('service', 'type', 'available');
  }

  /**
   * Build a table header compiled from available services.
   */
  function label() {
    // Return a simple string for the Views_UI.
    if ($this->view->editing && is_null($this->original_value)) {
      return 'Services';
    }
    $services = hosting_server_services();
    foreach ($services as $name => $service) {
      $services[$name] = $service['title'];
    }
    return implode(',', $services);
  }

  /**
   * Build a list of services.
   */
  function render($values) {
    $all_services = hosting_server_services();
    $types = array();
    foreach ($all_services as $type => $service) {
      $types[$type] = 'no';
    }

    $node = node_load($values->hosting_server_nid);
    foreach ($node->services as $type => $class) {
      $types[$type] = $class->type;
    }
    return implode(',', $types);
  }

}