Пример #1
0
function theme_guifi_node_data($node, $links = FALSE)
{
    guifi_log(GUIFILOG_TRACE, 'function guifi_node_data(node)', $node);
    /*  $zone = db_fetch_object(db_query('SELECT id, title, master, zone_mode FROM {guifi_zone} WHERE id = %d',
        $node->zone_id));*/
    $zone = db_fetch_object(db_query('SELECT id, title, master FROM {guifi_zone} WHERE id = %d', $node->zone_id));
    $rows[] = array(t('node'), $node->nid . ' ' . $node->nick, '<b>' . $node->title . '</b>');
    //  $rows[] = array(t('zone (mode)'),l($zone->title,'node/'.$zone->id).' ('.t($zone->zone_mode).')',$node->zone_description);
    $rows[] = array(t('zone'), l($zone->title, 'node/' . $zone->id), $node->zone_description);
    $rows[] = array(t('position (lat/lon)'), sprintf('<a href="http://maps.guifi.net/world.phtml?Lat=%f&Lon=%f&Layers=all" target="_blank">Lat:%f<br />Lon:%f</a>', $node->lat, $node->lon, $node->lat, $node->lon), $node->elevation . '&nbsp;' . t('meters above the ground'));
    $rows[] = array(t('available for mesh &#038; status'), $node->stable, array('data' => t($node->status_flag), 'class' => $node->status_flag));
    if (count($node->funders)) {
        $rows[] = array(count($node->funders) == 1 ? t('Funder') : t('Funders'), array('data' => implode(', ', guifi_funders_links($node->funders)), 'colspan' => 2));
    }
    if (count($node->maintainers)) {
        $rows[] = array(t('Maintenance & SLAs'), array('data' => implode(', ', guifi_maintainers_links($node->maintainers)), 'colspan' => 2));
    } else {
        $radios = db_fetch_object(db_query('SELECT count(id) c FROM {guifi_radios} WHERE nid=%d', $node->id));
        if ($radios->c > 1) {
            $pmaintainers = guifi_maintainers_parents($node->zone_id);
            if (!empty($pmaintainers)) {
                $rows[] = array(t('Maintenance & SLAs') . ' ' . t('(from parents)'), implode(', ', guifi_maintainers_links($pmaintainers)));
            }
        }
    }
    if ($node->graph_server > 0) {
        $gs = node_load(array('nid' => $node->graph_server));
    } else {
        $gs = node_load(array('nid' => guifi_graphs_get_server($node->id, 'node')));
    }
    $rows[] = array(t('graphs provided from'), array('data' => l(guifi_service_str($node->graph_server), $gs->l, array('attributes' => array('title' => $gs->nick . ' - ' . $gs->title))), 'colspan' => 2));
    $output = theme('table', NULL, array_merge($rows));
    $output .= theme_guifi_contacts($node);
    if ($links) {
        $node = node_load(array('nid' => $node->id));
        drupal_set_title(t('%node data', 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 theme('box', NULL, $output);
}
Пример #2
0
/** guifi_zone_data(): outputs the zone information data
**/
function guifi_zone_data($zone)
{
    $rows[] = array(t('zone name'), $zone->nick . ' - <b>' . $zone->title . '</b>');
    if (count($zone->maintainers)) {
        $rows[] = array(t('Maintenance & SLAs'), implode(', ', guifi_maintainers_links($zone->maintainers)));
    } else {
        $pmaintainers = guifi_maintainers_parents($zone->id);
        if (!empty($pmaintainers)) {
            $rows[] = array(t('Maintenance & SLAs') . ' ' . t('(from parents)'), implode(', ', guifi_maintainers_links($pmaintainers)));
        }
    }
    if ($zone->homepage) {
        $rows[] = array(t('homepage'), l($zone->homepage, $zone->homepage));
    }
    $rows[] = array(t('default proxy'), l(guifi_service_str($zone->proxy_id), guifi_zone_get_service($zone, 'proxy_id', TRUE)));
    if ($zone->graph_server > 0) {
        $gs = node_load(array('nid' => $zone->graph_server));
    } else {
        $gs = node_load(array('nid' => guifi_graphs_get_server($zone->id, 'zone')));
    }
    $rows[] = array(t('default graph server'), array('data' => l(guifi_service_str($zone->graph_server), $gs->l, array('attributes' => array('title' => $gs->nick . ' - ' . $gs->title))), 'colspan' => 2));
    $rows[] = array(t('network global information') . ':', NULL);
    //  $rows[] = array(t('Mode'),t($zone->zone_mode));
    $rows[] = array(t('DNS Servers'), $zone->dns_servers);
    $rows[] = array(t('NTP Servers'), $zone->ntp_servers);
    $rows[] = array(t('OSPF zone'), $zone->ospf_zone);
    $tz = db_fetch_object(db_query("SELECT description FROM {guifi_types} WHERE type = 'tz' AND text = '%s'", $zone->time_zone));
    $rows[] = array(t('Time zone'), $tz->description);
    return array_merge($rows);
}