function guifi_device_print($device = NULL) { if ($device == NULL) { print theme('page', t('Not found'), FALSE); return; } $output = '<div id="guifi">'; $node = node_load(array('nid' => $device[nid])); $title = t('Node:') . ' <a href="' . url('node/' . $node->nid) . '">' . $node->nick . '</a> · ' . t('Device:') . ' ' . $device[nick]; drupal_set_breadcrumb(guifi_node_ariadna($node)); switch (arg(4)) { case 'all': case 'data': default: $table = theme_table(null, guifi_device_print_data($device), array('class' => 'device-data')); $output .= theme('box', $title, $table); if (arg(4) == 'data') { break; } case 'comment': if (!empty($device['comment'])) { $output .= theme('box', t('Comments'), $device['comment']); } if (arg(4) == 'comment') { break; } case 'graphs': if (empty($device['interfaces'])) { break; } // device graphs $table = theme('table', array(t('traffic overview')), guifi_device_graph_overview($device)); $output .= theme('box', t('device graphs'), $table); if (arg(4) == 'graphs') { break; } case 'links': // links $output .= theme('box', NULL, guifi_device_links_print($device)); if (arg(4) == 'links') { break; } case 'interfaces': if (empty($device['interfaces'])) { break; } $header = array(t('id'), t('connects with'), t('connector'), t('comments'), t('mac'), t('ip address'), t('netmask')); $tables = theme_table($header, guifi_device_print_interfaces($device), array('class' => 'device-data')); $output .= theme('box', t('physical ports & connections'), $tables); foreach (array('vlans', 'aggregations', 'tunnels') as $iClass) { $rows = guifi_device_print_iclass($iClass, $device); if (empty($rows)) { continue; } if ($iClass == 'vlans') { $header = array(t('type'), t('name'), t('parent'), t('vlan'), t('comments'), t('mac'), t('ip address'), t('netmask')); } else { $header = array(t('type'), t('name'), t('parent'), t('comments'), t('mac'), t('ip address'), t('netmask')); } $tables = theme_table($header, $rows, array('class' => 'device-data')); $output .= theme('box', t($iClass), $tables); } break; case 'services': $output .= theme('box', t('services information'), theme_guifi_services_list($device['id'])); $output .= '</div>'; return; } $output .= '</div>'; drupal_set_title(t('View device %dname', array('%dname' => $device['nick']))); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); print theme('page', $output, FALSE); return; }
function guifi_domain_print($domain = NULL) { if ($domain == NULL) { print theme('page', t('Not found'), FALSE); return; } $output = '<div id="guifi">'; $title = ''; drupal_set_breadcrumb(guifi_node_ariadna($node)); switch (arg(4)) { case 'all': case 'data': default: $table = theme('table', NULL, guifi_domain_print_data($domain)); $output .= theme('box', $title, $table); if (arg(4) == 'data') { break; } case 'delegations': $header = array(t('Delegation'), t('IPv4 Address'), t('Nameserver')); $table = theme('table', $header, guifi_delegations_print_data($domain['name'], $domain['scope'])); $output .= theme('box', t('Delegations'), $table); if (arg(4) == 'delegations') { break; } case 'hosts': $header = array(t('HostName'), t('Alias'), t('IPv4 Address'), t('IPv6 Address'), t('Namserver'), t('MailServer'), t('MX Priority')); $table = theme('table', $header, guifi_hosts_print_data($domain['id'])); $output .= theme('box', t('Hostnames'), $table); break; } $output .= '</div>'; drupal_set_title(t('View domain %dname', array('%dname' => $domain['name']))); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); print theme('page', $output, FALSE); return; }
function guifi_users_node_list($node) { guifi_log(GUIFILOG_TRACE, 'function guifi_users_node_list()', $node); $output = drupal_get_form('guifi_users_node_list_form', $node); $node = node_load(array('nid' => $node->id)); drupal_set_breadcrumb(guifi_node_ariadna($node)); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); // To gain space, save bandwith and CPU, omit blocks print theme('page', $output, FALSE); }
function theme_guifi_node_links($node, $links = FALSE) { $output = theme_guifi_node_links_by_type($node->id, 'wds') . theme_guifi_node_links_by_type($node->id, 'cable') . theme_guifi_node_links_by_type($node->id, 'ap/client'); if ($links) { $node = node_load(array('nid' => $node->id)); drupal_set_title(t('links @ %node', array('%node' => $node->title))); drupal_set_breadcrumb(guifi_node_ariadna($node)); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); print theme('page', $output, FALSE); return; } return $output; }
function theme_guifi_services_list($node, $service = '%') { if (is_numeric($node)) { $typestr = t('by device'); } else { $node = node_load(array('nid' => $node->id)); if ($node->type == 'guifi_node') { $typestr = t('by node'); } else { $typestr = t('by zone'); } } $rows = guifi_list_services_query($node, $typestr); $rows ? $box .= theme('table', array(t('service'), t('zone'), t('device'), t('status'), t('disponibilitat')), array_merge($rows), array('width' => '100%')) : ($box .= t('There are no services defined at the database')); $output = theme('box', t('Services of %node (%by)', array('%node' => $node->title, '%by' => $typestr)), $box); switch ($typestr) { case t('by node'): drupal_set_title(t('services @ %node', array('%node' => $node->title))); drupal_set_breadcrumb(guifi_node_ariadna($node, 'node/%d/view/services')); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); break; case t('by zone'): drupal_set_breadcrumb(guifi_zone_ariadna($node->id, 'node/%d/view/services')); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); break; case t('by device'): $device = guifi_device_load($node); drupal_set_title(t('View device %dname', array('%dname' => $device['nick'], '%nid' => $device['nid']))); $node = node_load(array('nid' => $device['nid'])); drupal_set_breadcrumb(guifi_node_ariadna($node)); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); break; } $output .= theme_pager(NULL, variable_get("guifi_pagelimit", 50)); print theme('page', $output, FALSE); return; }