function theme_budgets_supplier_header($node, $teaser) { $output = '<div class="suppliers-help-rating">' . '<small><a href="/comment/reply/' . $node->nid . '#comment-form">' . t('User rating: give your feedback & vote!') . '</a></small> - ' . t('Zone(s)') . ': '; foreach ($node->zones as $k => $value) { $output .= ' > ' . guifi_zone_l($value); } $output .= '</div><br>'; return $output; }
function theme_guifi_zone_nodes($node, $links = TRUE) { if (!isset($node->id)) { $node->id = $node->nid; } $output = '<h2>' . t('Nodes listed at') . ' ' . $node->title . '</h2>'; // Going to list child zones totals $result = db_query('SELECT z.id, z.title FROM {guifi_zone} z WHERE z.master = %d ORDER BY z.weight, z.title', $node->id); $rows = array(); $header = array(array('data' => t('Zone name')), array('data' => t('Online'), NULL, NULL, 'style' => 'text-align: right'), array('data' => t('Planned'), NULL, NULL, 'style' => 'text-align: right'), array('data' => t('Building'), NULL, NULL, 'style' => 'text-align: right'), array('data' => t('Testing'), NULL, NULL, 'style' => 'text-align: right'), array('data' => t('Inactive'), NULL, NULL, 'style' => 'text-align: right'), array('data' => t('Total'), NULL, NULL, 'style' => 'text-align: right')); while ($zone = db_fetch_object($result)) { $summary = guifi_zone_totals(guifi_zone_childs($zone->id)); $rows[] = array(array('data' => guifi_zone_l($zone->id, $zone->title, 'node/'), 'class' => 'zonename'), array('data' => number_format($summary['Working'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Working', 'align' => 'right'), array('data' => number_format($summary['Planned'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Planned', 'align' => 'right'), array('data' => number_format($summary['Building'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Building', 'align' => 'right'), array('data' => number_format($summary['Testing'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Testing', 'align' => 'right'), array('data' => number_format($summary['Inactive'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Inactive', 'align' => 'right'), array('data' => number_format($summary['Total'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Total', 'align' => 'right')); if (!empty($summary)) { foreach ($summary as $key => $sum) { $totals[$key] = $totals[$key] + $sum; } } } $rows[] = array(array('data' => NULL, 'class' => 'zonename'), array('data' => number_format($totals['Working'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Online', 'align' => 'right'), array('data' => number_format($totals['Planned'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Planned', 'align' => 'right'), array('data' => number_format($totals['Building'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Building', 'align' => 'right'), array('data' => number_format($totals['Testing'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Testing', 'align' => 'right'), array('data' => number_format($totals['Inactive'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Inactive', 'align' => 'right'), array('data' => number_format($totals['Total'], 0, NULL, variable_get('guifi_thousand', '.')), 'class' => 'Total', 'align' => 'right')); if (count($rows) > 1) { $output .= theme('table', $header, $rows); } // Going to list the zone nodes $rows = array(); $result = pager_query(' SELECT l.id,l.nick, l.notification, l.zone_description, l.status_flag, count(*) radios FROM {guifi_location} l LEFT JOIN {guifi_radios} r ON l.id = r.nid WHERE l.zone_id = %d GROUP BY 1,2,3,4,5 ORDER BY radios DESC, l.nick', 50, 0, 'SELECT count(*) FROM {guifi_location} WHERE zone_id = %d', $node->id); $header = array(array('data' => t('nick (shortname)')), array('data' => t('supernode')), array('data' => t('area')), array('data' => t('status'))); while ($loc = db_fetch_object($result)) { if ($loc->radios == 1) { $loc->radios = t('No'); } $rows[] = array(array('data' => guifi_zone_l($loc->id, $loc->nick, 'node/')), array('data' => $loc->radios), array('data' => $loc->zone_description), array('data' => t($loc->status_flag), 'class' => $loc->status_flag)); } if (count($rows) > 0) { $output .= theme('table', $header, $rows); $output .= theme_pager(NULL, 50); } if ($links) { drupal_set_breadcrumb(guifi_zone_ariadna($node->id, 'node/%d/view/nodes')); $node = node_load(array('nid' => $node->id)); $output .= theme_links(module_invoke_all('link', 'node', $node, FALSE)); print theme('page', $output, FALSE); return; } return $output; }