hosting_server_handler_field_services.inc

Definition of hosting_server_handler_field_services.

Classes

Namesort descending Description
hosting_server_handler_field_services Field handler to show services running on servers.

File

server/includes/views/handlers/hosting_server_handler_field_services.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Definition of hosting_server_handler_field_services.
  5. */
  6. /**
  7. * Field handler to show services running on servers.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class hosting_server_handler_field_services extends views_handler_field {
  12. /**
  13. * Constructor; calls to base object constructor.
  14. */
  15. function construct() {
  16. parent::construct();
  17. //$this->additional_fields = array('service', 'type', 'available');
  18. }
  19. /**
  20. * Build a table header compiled from available services.
  21. */
  22. function label() {
  23. // Return a simple string for the Views_UI.
  24. if ($this->view->editing && is_null($this->original_value)) {
  25. return 'Services';
  26. }
  27. $services = hosting_server_services();
  28. foreach ($services as $name => $service) {
  29. $services[$name] = $service['title'];
  30. }
  31. return implode(',', $services);
  32. }
  33. /**
  34. * Build a list of services.
  35. */
  36. function render($values) {
  37. $all_services = hosting_server_services();
  38. $types = array();
  39. foreach ($all_services as $type => $service) {
  40. $types[$type] = 'no';
  41. }
  42. $node = node_load($values->hosting_server_nid);
  43. foreach ($node->services as $type => $class) {
  44. $types[$type] = $class->type;
  45. }
  46. return implode(',', $types);
  47. }
  48. }