Ejemplo n.º 1
0
/**
 * Renders comment(s) without forms.
 *
 * @param $node
 *   The node which comment(s) needs rendering.
 * @param $cid
 *   Optional, if given, only one comment is rendered.
 *
 * @see comment_render.
 */
function comment_display_comment_render_without_form($node, $cid = 0)
{
    global $user;
    $output = '';
    if (user_access('access comments')) {
        // Pre-process variables.
        $nid = $node->nid;
        if (empty($nid)) {
            $nid = 0;
        }
        $mode = _comment_get_display_setting('mode', $node);
        $order = _comment_get_display_setting('sort', $node);
        $comments_per_page = _comment_get_display_setting('comments_per_page', $node);
        if ($cid && is_numeric($cid)) {
            // Single comment view.
            $query = 'SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d';
            $query_args = array($cid);
            if (!user_access('administer comments')) {
                $query .= ' AND c.status = %d';
                $query_args[] = COMMENT_PUBLISHED;
            }
            $query = db_rewrite_sql($query, 'c', 'cid');
            $result = db_query($query, $query_args);
            if ($comment = db_fetch_object($result)) {
                $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
                $links = module_invoke_all('link', 'comment', $comment, 1);
                drupal_alter('link', $links, $node);
                $output .= theme('comment_view', $comment, $node, $links);
            }
        } else {
            // Multiple comment view
            $query_count = 'SELECT COUNT(*) FROM {comments} c WHERE c.nid = %d';
            $query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d';
            $query_args = array($nid);
            if (!user_access('administer comments')) {
                $query .= ' AND c.status = %d';
                $query_count .= ' AND c.status = %d';
                $query_args[] = COMMENT_PUBLISHED;
            }
            if ($order == COMMENT_ORDER_NEWEST_FIRST) {
                if ($mode == COMMENT_MODE_FLAT_COLLAPSED || $mode == COMMENT_MODE_FLAT_EXPANDED) {
                    $query .= ' ORDER BY c.cid DESC';
                } else {
                    $query .= ' ORDER BY c.thread DESC';
                }
            } else {
                if ($order == COMMENT_ORDER_OLDEST_FIRST) {
                    if ($mode == COMMENT_MODE_FLAT_COLLAPSED || $mode == COMMENT_MODE_FLAT_EXPANDED) {
                        $query .= ' ORDER BY c.cid';
                    } else {
                        // See comment above. Analysis reveals that this doesn't cost too
                        // much. It scales much much better than having the whole comment
                        // structure.
                        $query .= ' ORDER BY SUBSTRING(c.thread, 1, (LENGTH(c.thread) - 1))';
                    }
                }
            }
            $query = db_rewrite_sql($query, 'c', 'cid');
            $query_count = db_rewrite_sql($query_count, 'c', 'cid');
            // Start a form, for use with comment control.
            $result = pager_query($query, $comments_per_page, 0, $query_count, $query_args);
            $divs = 0;
            $num_rows = FALSE;
            $comments = '';
            drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css');
            while ($comment = db_fetch_object($result)) {
                $comment = drupal_unpack($comment);
                $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
                $comment->depth = count(explode('.', $comment->thread)) - 1;
                if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) {
                    if ($comment->depth > $divs) {
                        $divs++;
                        $comments .= '<div class="indented">';
                    } else {
                        while ($comment->depth < $divs) {
                            $divs--;
                            $comments .= '</div>';
                        }
                    }
                }
                if ($mode == COMMENT_MODE_FLAT_COLLAPSED) {
                    $comments .= theme('comment_flat_collapsed', $comment, $node);
                } else {
                    if ($mode == COMMENT_MODE_FLAT_EXPANDED) {
                        $comments .= theme('comment_flat_expanded', $comment, $node);
                    } else {
                        if ($mode == COMMENT_MODE_THREADED_COLLAPSED) {
                            $comments .= theme('comment_thread_collapsed', $comment, $node);
                        } else {
                            if ($mode == COMMENT_MODE_THREADED_EXPANDED) {
                                $comments .= theme('comment_thread_expanded', $comment, $node);
                            }
                        }
                    }
                }
                $num_rows = TRUE;
            }
            while ($divs-- > 0) {
                $comments .= '</div>';
            }
            $output .= $comments;
            $output .= theme('pager', NULL, $comments_per_page, 0);
        }
        $output = theme('comment_wrapper', $output, $node);
    }
    return $output;
}
Ejemplo n.º 2
0
function budgets_supplier_sla($supplier, $type, $pager = 50)
{
    guifi_log(GUIFILOG_TRACE, 'budgets_supplier_sla (supplier)', $type);
    if ($type != 'all') {
        $swt = ' AND subject_type = "' . $type . '" ';
    }
    $qquery = 'SELECT * ' . 'FROM {guifi_maintainers} ' . 'WHERE supplier_id=' . $supplier->id . ' ' . $swt . 'ORDER BY timestamp_created desc ';
    guifi_log(GUIFILOG_TRACE, 'budgets_supplier_sla (budgets query)', $qquery);
    $pager = pager_query($qquery, variable_get('default_nodes_main', $pager));
    $output = '';
    $rows = array();
    while ($s = db_fetch_object($pager)) {
        guifi_log(GUIFILOG_TRACE, 'budgets_supplier_sla (row)', $s);
        switch ($s->subject_type) {
            case 'location':
                $n = guifi_get_nodename($s->subject_id);
                $l = 'node/' . $s->subject_id;
                break;
            case 'zone':
                $n = guifi_get_zone_name($s->subject_id);
                $l = 'node/' . $s->subject_id;
                break;
            case 'device':
                $n = guifi_get_devicename($s->subject_id);
                $l = 'guifi/device/' . $s->subject_id . '/view';
                break;
        }
        if ($type == 'all') {
            $n .= ' (' . t($s->subject_type) . ')';
        }
        $u = user_load($s->user_created);
        $rows[] = array(l($s->subject_id . '-' . $n, $l), $s->commitment, $s->sla, $s->sla_resp, $s->sla_fix, l(t('by') . ' ' . $u->name, 'user/' . $s->user_created), format_date($s->timestamp_created));
    }
    if (count($rows) == 0) {
        $rows[] = array(array('data' => t('none'), 'colspan' => 8));
    }
    $header = array(t($type), t('type'), t('SLA'), t('resp.'), t('fix.'), t('created'), null);
    $output = theme('table', $header, $rows);
    $output .= theme('pager', NULL, $pager);
    print theme('page', $output, FALSE);
    return;
}
Ejemplo n.º 3
0
/**
 * Query information about existing MAC addresses.
 *
 * @param $mac
 *   MAC to query information about.
 *
 * @return
 *   Table with information about nodes, HTML formatted.
 */
function guifi_tools_mac_search($mac = NULL)
{
    $output = drupal_get_form('guifi_tools_mac_search_form', $mac);
    if (is_null($mac)) {
        return $output;
    }
    $output .= '<h2>' . t('Query result for "mac LIKE %mac"', array('%mac' => "'" . $mac . "'")) . '</h2>';
    $headers = array(t('mac'), t('interface'), t('device'), t('node'));
    $sqlm = pager_query('SELECT * FROM {guifi_interfaces} WHERE mac LIKE "%s"', 50, 0, NULL, $mac);
    while ($interface = db_fetch_object($sqlm)) {
        $row = array();
        $row[] = $interface->mac;
        $row[] = $interface->id . '/' . $interface->radiodev_counter . ' ' . $interface->interface_type;
        // device
        if ($device = db_fetch_object(db_query('SELECT * from {guifi_devices} WHERE id=%d', $interface->device_id))) {
            $row[] = $device->id . '-' . l($device->nick, 'guifi/device/' . $device->id);
        } else {
            $row[] = t('Orphan');
            $rows[] = $row;
            continue;
        }
        // node
        if ($node = db_fetch_object(db_query('SELECT id from {guifi_location} WHERE id=%d', $device->nid))) {
            $node = node_load(array('nid' => $node->id));
            $row[] = $node->id . '-' . l($node->title, 'node/' . $node->id);
        } else {
            $row[] = t('Orphan');
            $rows[] = $row;
            continue;
        }
        $rows[] = $row;
    }
    $output .= theme('table', $headers, $rows);
    $output .= theme_pager(NULL, 50);
    return $output;
}
Ejemplo n.º 4
0
function budgets_quote_list($params = NULL)
{
    guifi_log(GUIFILOG_TRACE, 'quote_list (params)', $params);
    $output = drupal_get_form('budgets_quote_list_filter', $params);
    if (!empty($params)) {
        $vs = explode('-', $params);
        if (count($vs) > 1 and is_numeric($vs[0])) {
            $where = ' q.id = ' . $vs[0];
        } else {
            $strings = str_word_count(strtoupper(arg(4)), 1, '0123456789ÀÁÈÉÍÓÒÚÑÇÏÄËÜ');
            foreach ($strings as $k => $v) {
                $strings[$k] = '(CONCAT(upper(s.title), " ",q.id, "-", q.partno, ", ", upper(q.title)) LIKE "%' . $v . '%") ';
            }
            $where = implode(' AND ', $strings);
        }
    } else {
        $where = ' 1=1 ';
    }
    $qsql = 'SELECT q.id ' . 'FROM {supplier} s, {supplier_quote} q ' . 'WHERE q.supplier_id=s.id AND ' . $where . ' ORDER BY q.title, q.partno, q.id';
    guifi_log(GUIFILOG_TRACE, 'quote_list (query)', $qsql);
    $qquotes = pager_query($qsql, variable_get('default_nodes_main', 10));
    if (!$teaser) {
        $output .= '<br<br><hr><h2>' . t('Quotes from') . ': <em>' . $supplier->title . '</em></h2>';
        $q = 0;
        while ($quote = db_fetch_object($qquotes)) {
            guifi_log(GUIFILOG_TRACE, 'quote_list (supplier)', $quote);
            $output .= node_view(node_load(array('nid' => $quote->id)), TRUE, FALSE);
            $q++;
        }
        $q == 0 ? $output .= t('No quotes available') : NULL;
        $node->content['quotes'] = array('#value' => $output . theme('pager', NULL, variable_get('default_nodes_main', 10)), '#weight' => 1);
    }
    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
    //drupal_set_breadcrumb(guifi_zone_ariadna($zone->id,'node/%d/view/suppliers'));
    print theme('page', $output, FALSE);
    return;
}
Ejemplo n.º 5
0
function MNI_notifications_content_page_thread($account = null)
{
    global $user;
    if (is_null($account)) {
        $account = $user;
    }
    // query string for node subscriptions
    $query = "SELECT s.*, f.value AS nid, n.type AS node_type, n.title FROM {notifications} s\n    INNER JOIN {notifications_fields} f ON s.sid = f.sid LEFT JOIN {node} n ON f.intval = n.nid\n    WHERE s.uid = %d AND s.type = 'thread' AND s.event_type = 'node' AND s.conditions = 1 AND f.field = 'nid'\n    ORDER BY node_type, n.title";
    $results = pager_query($query, NOTIFICATIONS_CONTENT_PAGER, 0, null, $account->uid);
    $subscriptions = $list = array();
    $content_types = notifications_content_types('name');
    while ($sub = db_fetch_object($results)) {
        $subscriptions[$sub->nid] = $sub;
        $list[$sub->nid] = l($sub->title, 'node/' . $sub->nid);
    }
    if (!$subscriptions) {
        $output = t('You are not currently signed up for any alerts');
    } else {
        //$output = t('You are currently subscribed to the following threads:');
        $defaults = array('type' => 'thread', 'event_type' => 'node');
        $options = array('title' => t('Title'));
        $output .= drupal_get_form('notifications_user_form', $account, 'thread', $subscriptions, $list, $defaults, $options);
        $output .= theme('pager', null, NOTIFICATIONS_CONTENT_PAGER);
    }
    return $output;
}
Ejemplo n.º 6
0
<?php
        $teaser_length = 512;
        $items_per_page = 10;
        $query = "SELECT n.title, r.body, n.nid, n.created FROM node n, node_revisions r WHERE n.type = 'ivillage_story_feed' AND n.nid = r.nid ORDER BY n.created DESC";

        $result = pager_query($query,$items_per_page);
        $output = "";

        while ($current_story = db_fetch_object($result)) {
            $pub_date = date("d/m/Y", $current_story->created);
            
            $teaser = truncate(strip_tags($current_story->body),$teaser_length,$etc = "...");
            
            $output .= '<div><a href="node/' . $current_story->nid . '">' . $current_story->title . '</a> - ' . $pub_date . '</div>';
            $output .= '<div>' . $teaser . '</div><br />';
        
        
        }


        $output .= theme('pager', NULL, $items_per_page, 0);
        print $output;
?>


<?php
// Alter the group title in user profile page's group display.
$user_details1 = user_load(array('name' => arg(1)));
/*$query44 = "SELECT node.nid AS nid, users.name AS users_name, users.uid AS users_uid, og_uid.uid AS og_uid_uid, og_uid.nid AS og_uid_nid, node.title AS node_title FROM node node  LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid INNER JOIN users users ON node.uid = users.uid WHERE (node.status <> 0) AND (node.type IN ('creat_group')) AND (og_uid.uid = ".$user_details1->uid.") ORDER BY node_title ASC";*/

$query44 = "SELECT node.nid AS nid, users.name AS users_name, users.uid AS users_uid, og_uid.uid AS og_uid_uid, og_uid.nid AS og_uid_nid, node.title AS node_title FROM node node  LEFT JOIN og og ON node.nid = og.nid INNER JOIN users users ON node.uid = users.uid LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid WHERE (node.status <> 0) AND (node.type IN ('creat_group')) AND (og.og_directory <> 0)  AND (og_uid.uid = ".$user_details1->uid.") GROUP BY node.nid ORDER BY node_title ASC";

$num_per_page = 30;
$rs = pager_query($query44,$num_per_page);
//$exc44 = db_query($query44);
 while ($data = db_fetch_object($rs)){
 print "<div class='user_grp'><a href='../groupdetails/".$data->nid."'>".$data->node_title."</a></div>";
 }
?>
Ejemplo n.º 8
0
function user_import_limited_errors($import_id = NULL, $template_id = NULL)
{
    if (empty($import_id) || !is_numeric($import_id)) {
        drupal_goto('user_import/' . $template_id);
    }
    $pager_id = 1;
    $max = 25;
    $import = _user_import_settings_select($import_id);
    $total = db_result(db_query("SELECT count(data) FROM {user_import_errors} WHERE import_id = %d", $import['import_id']));
    if (empty($total)) {
        $output .= theme('There were no import errors');
    } else {
        $results = pager_query("SELECT * FROM {user_import_errors} WHERE import_id = %d", $max, $pager_id, NULL, array($import['import_id']));
        while ($line = db_fetch_array($results)) {
            $line['data'] = unserialize($line['data']);
            $line['errors'] = unserialize($line['errors']);
            $file_lines[] = $line;
        }
        $output .= theme('user_import_errors_display', $import, $file_lines, $total);
        $output .= theme('pager', NULL, $max, $pager_id);
    }
    $output .= l(t('Return'), "user_import/{$template_id}/{$import_id}");
    return $output;
}
<?php
$flag=0;
// Alter the group title in user profile page's group display.
$user_details1 = user_load(array('name' => arg(1)));
/*$query44 = "SELECT node.nid AS nid, users.name AS users_name, users.uid AS users_uid, og_uid.uid AS og_uid_uid, og_uid.nid AS og_uid_nid, node.title AS node_title FROM node node  LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid INNER JOIN users users ON node.uid = users.uid WHERE (node.status <> 0) AND (node.type IN ('creat_group')) AND (og_uid.uid = ".$user_details1->uid.") ORDER BY node_title ASC";*/

$query55 = "SELECT node.nid AS nid, users.name AS users_name, users.uid AS users_uid, og_uid.uid AS og_uid_uid, og_uid.nid AS og_uid_nid, node.title AS node_title FROM node node  LEFT JOIN og og ON node.nid = og.nid INNER JOIN users users ON node.uid = users.uid LEFT JOIN og_uid og_uid ON node.nid = og_uid.nid WHERE (node.status <> 0) AND (node.type IN ('creat_group')) AND (og.og_directory <> 0)  AND (og_uid.uid = ".$user_details1->uid.") GROUP BY node.nid ORDER BY node_title ASC";

$num_per_page = 30;
$rs55 = pager_query($query55,$num_per_page);
//$exc44 = db_query($query44);
 while ($data = db_fetch_object($rs55)){
$flag=1;
 }
if($flag==1)
{
?>
<div class="view view-<?php print $css_name; ?> view-id-<?php print $name; ?> view-display-id-<?php print $display_id; ?> view-dom-id-<?php print $dom_id; ?>">
  <?php if ($admin_links): ?>
    <div class="views-admin-links views-hide">
      <?php print $admin_links; ?>
    </div>
  <?php endif; ?>
  <?php if ($header): ?>
    <div class="view-header">
      <?php print $header; ?>
    </div>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
Ejemplo n.º 10
0
 public function getLastTournamentsRes($number = 10)
 {
     $sql = "select t1.*, (SELECT GROUP_CONCAT(Title ORDER BY Number) FROM {%1\$s} t2 WHERE t2.ParentId=t1.Id GROUP BY t2.ParentId  ) tours FROM {%1\$s} t1 WHERE t1.Type='Ч'  ORDER BY t1.CreatedAt DESC";
     $sql = sprintf($sql, self::TOURNAMENT_TABLE);
     $count_sql = sprintf("SELECT count(*) FROM {%1\$s} WHERE Type='Ч'", self::TOURNAMENT_TABLE);
     return pager_query($sql, $number, 0, $count_sql);
 }
Ejemplo n.º 11
0
 public function loadRecentNodes($limit = 10, $element = 0)
 {
     $assoc = $this->associatesWith();
     $nodes = array();
     $sql = "SELECT";
     $sql .= " n.nid,";
     $sql .= " IF(n.changed < c.last_comment_timestamp,";
     if ($assoc) {
         $sql .= " IF(IFNULL(a.last_association_timestamp, 0) > c.last_comment_timestamp, a.last_association_timestamp, c.last_comment_timestamp),";
         $sql .= " IF(IFNULL(a.last_association_timestamp, 0) > n.changed, a.last_association_timestamp, n.changed)) AS t ";
     } else {
         $sql .= " n.changed, c.last_comment_timestamp) AS t ";
     }
     $sql .= "FROM {node} n JOIN {node_comment_statistics} c ON n.nid = c.nid ";
     if ($assoc) {
         $sql .= " LEFT OUTER JOIN {association_statistics} a ON n.nid = a.nid ";
     }
     $sql .= "WHERE type = '%s' AND status = 1 ";
     $sql .= "ORDER BY";
     $sql .= " t DESC";
     $sql = db_rewrite_sql($sql);
     $result = pager_query($sql, $limit, $element, NULL, $this->name);
     while ($row = db_fetch_array($result)) {
         $nodes[] = node_load($row['nid']);
     }
     return array($nodes, theme('pager', NULL, $limit, $element));
 }
Ejemplo n.º 12
0
function guifi_users_queue($zone)
{
    function _guifi_user_queue_device_form($form_state, $d = array())
    {
        guifi_log(GUIFILOG_TRACE, 'function guifi_user_queue_device_form()', $d);
        if (count($d['radios']) != 1) {
            return;
        }
        if ($d['radios'][0]['mode'] != 'client') {
            return;
        }
        if (!isset($d['radios'][0]['interfaces'])) {
            return;
        }
        $iid = key($d['radios'][0]['interfaces']);
        if (!isset($d['radios'][0]['interfaces'][$iid]['ipv4'][0]['links'])) {
            return;
        }
        $lid = key($d['radios'][0]['interfaces'][$iid]['ipv4'][0]['links']);
        if (empty($iid) or empty($lid)) {
            return;
        }
        if (empty($form_state['values'])) {
            $form_state['values'] = $d;
        }
        $f['flag'] = array('#type' => 'item', '#value' => $form_state['values']['flag'], '#prefix' => '<table><tr><td>', '#suffix' => '</td>');
        $f['mac'] = array('#type' => 'textfield', '#required' => TRUE, '#size' => 17, '#maxlength' => 17, '#default_value' => $form_state['values']['radios'][0]['mac'], '#element_validate' => array('guifi_mac_validate'), '#prefix' => '<td>', '#suffix' => '</td>');
        $f['did'] = array('#type' => 'hidden', '#value' => $form_state['values']['id']);
        $f['nid'] = array('#type' => 'hidden', '#value' => $form_state['values']['nid']);
        $f['uid'] = array('#type' => 'hidden', '#value' => $form_state['values']['uid']);
        $f['iid'] = array('#type' => 'hidden', '#value' => $iid);
        $f['lid'] = array('#type' => 'hidden', '#value' => $lid);
        $f['approve'] = array('#type' => 'image_button', '#src' => drupal_get_path('module', 'guifi') . '/icons/ok.png', '#attributes' => array('title' => t('Set the device and link Online, confirm MAC & approve user.')), '#prefix' => '<td>', '#suffix' => '</td></tr></table>');
        return $f;
    }
    function _guifi_user_queue_form($form_state, $params = array())
    {
        guifi_log(GUIFILOG_TRACE, 'function guifi_user_queue_form()', $params);
        if (empty($form_state['values'])) {
            $form_state['values'] = $params;
        }
        $f['status'] = array('#type' => 'select', '#options' => guifi_types('user_status'), '#default_value' => $form_state['values']['status'], '#prefix' => '<table><tr><td>', '#suffix' => '</td>');
        $f['uid'] = array('#type' => 'hidden', '#value' => $form_state['values']['id']);
        $f['saveUser'] = array('#type' => 'image_button', '#src' => drupal_get_path('module', 'guifi') . '/icons/save.png', '#attributes' => array('title' => t('Change & Save users Status.')), '#submit' => array('_guifi_user_queue_device_form_submit'), '#prefix' => '<td>', '#suffix' => '</td></tr></table>');
        return $f;
    }
    function _guifi_user_queue_devices($u)
    {
        $query = db_query('SELECT d.id ' . 'FROM {guifi_devices} d ' . 'WHERE d.nid=%d' . '  AND type="radio"', $u['nid']);
        $rows = array();
        while ($d = db_fetch_array($query)) {
            $d = guifi_device_load($d['id']);
            $d['uid'] = $u['id'];
            if (guifi_device_access('update', $d['id'])) {
                $edit_device_icon = l(guifi_img_icon('edit.png'), 'guifi/device/' . $d['id'] . '/edit', array('html' => TRUE, 'attributes' => array('target' => '_blank'))) . l(guifi_img_icon('drop.png'), 'guifi/device/' . $d['id'] . '/delete', array('html' => TRUE, 'attributes' => array('target' => '_blank')));
            } else {
                $edit_device_icon = '';
            }
            if (user_access('administer guifi users')) {
                $edit_ok_icon = drupal_get_form('_guifi_user_queue_device_form', $d);
            } else {
                $edit_ok_icon = $d['flag'];
                if (count($d['radios']) == 1 and $d['radios'][0]['mode'] == 'client') {
                    $edit_ok_icon .= ' ' . $d['radios'][0]['mac'];
                }
            }
            $ip = guifi_main_ip($d['id']);
            $status_url = guifi_cnml_availability(array('device' => $d['id'], 'format' => 'short'));
            $rows[] = array($edit_device_icon . l($d['nick'], 'guifi/device/' . $d['id'], array('attributes' => array('target' => '_blank'))), array('data' => l($ip['ipv4'] . '/' . $ip['maskbits'], guifi_device_admin_url($d, $ip['ipv4']), array('attributes' => array('title' => t('Connect to the device on a new window'), 'target' => '_blank'))), 'align' => 'right'), array('data' => $edit_ok_icon, 'class' => $d['flag']), array('data' => $status_url, 'class' => $d['flag']));
        }
        return $rows;
    }
    global $user;
    $owner = $user->uid;
    guifi_log(GUIFILOG_TRACE, 'function guifi_users_node_list()', $zone);
    drupal_set_breadcrumb(guifi_zone_ariadna($zone->id, 'node/%d/view/userqueue'));
    $title = t('Queue of pending users @') . ' ' . $zone->title;
    drupal_set_title($title);
    $childs = guifi_zone_childs($zone->id);
    $childs[] = $zone->id;
    $sql = 'SELECT ' . '  u.*, l.id nid, l.nick nnick, l.status_flag nflag, l.zone_id ' . 'FROM {guifi_users} u, {guifi_location} l ' . 'WHERE u.nid=l.id' . '  AND (l.status_flag != "Working" OR u.status != "Approved") ' . '  AND l.zone_id IN (' . implode(',', $childs) . ') ' . 'ORDER BY FIND_IN_SET(u.status,"New,Pending,Approved,Rejected"),' . '  u.timestamp_created';
    $query = pager_query($sql, variable_get("guifi_pagelimit", 50));
    $rows = array();
    $nrow = 0;
    if (user_access('administer guifi networks') || user_access('administer guifi zones') || user_access('administer guifi users')) {
        $administer = TRUE;
    } else {
        $administer = FALSE;
    }
    while ($u = db_fetch_array($query)) {
        $pUser = (object) guifi_user_load($u['id']);
        $proxy = node_load(array('nid' => $pUser->services['proxy']));
        $srows = _guifi_user_queue_devices($u);
        $nsr = count($srows);
        if (empty($nsr)) {
            $nsr = 1;
        }
        $node = node_load(array('nid' => $u['nid']));
        if (guifi_node_access('update', $node)) {
            $edit_node_icon = l(guifi_img_icon('edit.png'), 'node/' . $u['nid'] . '/edit', array('html' => TRUE, 'attributes' => array('target' => '_blank'))) . l(guifi_img_icon('drop.png'), 'node/' . $u['nid'] . '/delete', array('html' => TRUE, 'attributes' => array('target' => '_blank')));
        } else {
            $edit_node_icon = '';
        }
        if (guifi_user_access('update', $u)) {
            $edit_user_icon = l(guifi_img_icon('edit.png'), 'guifi/user/' . $u['id'] . '/edit', array('html' => TRUE, 'attributes' => array('target' => '_blank'))) . l(guifi_img_icon('drop.png'), 'guifi/user/' . $u['id'] . '/delete', array('html' => TRUE, 'attributes' => array('target' => '_blank')));
        } else {
            $edit_user_icon = '';
        }
        if ($administer) {
            $edit_user_form = drupal_get_form('_guifi_user_queue_form', $u);
        } else {
            $edit_user_form = $u['status'];
        }
        if (user_access('administer guifi users') or $node->uid == $owner) {
            $rn3 = $u['lastname'] . ", " . $u['firstname'];
            $u3 = $u['username'];
        } else {
            $rn3 = ereg_replace("_", " ", $u['lastname'] . ", " . $u['firstname']);
            if (strlen($rn3) > 3) {
                $rn3 = substr($u['lastname'] . ", " . $u['firstname'], 0, 3);
                $rn3 .= "..";
            }
            $u3 = $u['username'];
            if (strlen($u3) > 3) {
                $u3 = substr($u['username'], 0, 5);
                $u3 .= "..";
            }
        }
        $rows[] = array(array('data' => $edit_user_icon . l($u3, 'node/' . $u['nid'] . '/view/users', array('attributes' => array('title' => $rn3, 'target' => '_blank'))) . "\n<br />" . '<small>' . format_date($u['timestamp_created']) . '<br />' . l($proxy->nick, "node/" . $proxy->id, array('attributes' => array('title' => $proxy->title))), 'rowspan' => $nsr), array('data' => guifi_get_zone_nick($u['zone_id']) . "<br /><strong>" . $edit_node_icon . l($u['nnick'], 'node/' . $u['nid'], array('html' => TRUE, 'attributes' => array('target' => '_blank'))) . '</strong><br /><small>' . l(t('add a comment'), 'comment/reply/' . $u['nid'], array('fragment' => 'comment-form', 'html' => TRUE, 'attributes' => array('title' => t('Add a comment to the page of this node'), 'target' => '_blank'))) . '</small>', 'class' => $u['nflag'], 'rowspan' => $nsr), array('data' => $edit_user_form, 'rowspan' => $nsr));
        end($rows);
        $krow = key($rows);
        if (count($srows)) {
            // merge current row with first element
            $rows[$krow] = array_merge($rows[$krow], array_shift($srows));
            // adding rest og the elements
            foreach ($srows as $k => $v) {
                $rows[] = $v;
            }
        }
    }
    $header = array(t('Username'), t('Node'), t('User status'), t('Device'), t('IP v4 address'), t('Status & MAC'), t('Current status'));
    $output .= theme('table', $header, $rows);
    $output .= theme_pager(NULL, variable_get("guifi_pagelimit", 50));
    // Full screen (no lateral bars, etc...)
    print theme('page', $output, FALSE);
    // If normal output, retrurn $output...
}
Ejemplo n.º 13
0
 private function getTableHtml()
 {
     global $pager_total_items;
     $filter = $this->build_filter_query();
     $header = array(array('data' => '&#8470;'), array('data' => 'Фамилия, имя', 'field' => 'p.surname'), array('data' => 'Турниров', 'field' => 'p.TNumber', 'sort' => 'desc'), array('data' => 'Вопросов', 'field' => 'p.QNumber'), array('data' => 'Сертификация', 'field' => 'p.QNumber'), array('data' => 'Ник на сайте'));
     $sql = "SELECT  p.* from {People} p {$filter['join']} WHERE 1 {$filter['where']} GROUP BY CharId";
     $sql .= tablesort_sql($header);
     $sql = preg_replace('/(p\\.surname\\s+(A|DE)SC)/', '$1, p.name $2SC', $sql);
     $query_count = "SELECT count(DISTINCT CharId) from  {People} p {$filter['join']} WHERE 1 {$filter['where']}";
     $result = pager_query($sql, 50, 0, $query_count, $filter['args']);
     $rows = array();
     $output .= '<p>' . $pager_total_items[0] . ' человек' . $this->suffix($pager_total_items[0]) . '</p>';
     $n = isset($_GET['page']) ? $_GET['page'] * 50 : 0;
     while ($line = db_fetch_object($result)) {
         $n++;
         $person = DbPerson::newFromRow($line);
         $cert = array();
         if ($person->isCertifiedEditor()) {
             $cert[] = 'редактор';
         }
         if ($person->isCertifiedReferee()) {
             $cert[] = 'арбитр';
         }
         $cert = $cert ? implode(', ', $cert) : '&mdash;';
         $nick = $person->getNick() or $nick = '&mdash;';
         $rows[] = array($n, $person->getLink(), $person->getToursNumber(), $person->getQuestionsNumber(), $cert, $nick);
     }
     $output .= theme('table', $header, $rows);
     $output .= theme('pager', NULL, 50, 0);
     return $output;
     /*    $accounts[$account->uid] = '';
         $form['name'][$account->uid] = array('#value' => theme('username', $account));
         $form['status'][$account->uid] =  array('#value' => $status[$account->status]);
         $users_roles = array();
         $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = %d', $account->uid);
         while ($user_role = db_fetch_object($roles_result)) {
           $users_roles[] = $roles[$user_role->rid];
         }
         asort($users_roles);
         $form['roles'][$account->uid][0] = array('#value' => theme('item_list', $users_roles));
         $form['member_for'][$account->uid] = array('#value' => format_interval(time() - $account->created));
         $form['last_access'][$account->uid] =  array('#value' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never'));
         $form['operations'][$account->uid] = array('#value' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
       }*/
 }
Ejemplo n.º 14
0
function guifi_ipv4_print_data($zone, $list = 'parents', $ips_allocated)
{
    global $user;
    $header = array(array('data' => t('network')), t('start / end'), array('data' => t('hosts'), 'style' => 'text-align: right;'), t('type'), t('min / max'), array('data' => t('ips used'), 'style' => 'text-align: right;'), array('data' => t('used %'), 'style' => 'text-align: right;'));
    if (user_access('administer guifi networks')) {
        $header = array_merge($header, array(t('operations')));
    }
    if ($list == 'childs') {
        $zones = guifi_zone_childs($zone->id);
        $pager = 1;
        $k = array_search($zone->id, $zones);
        unset($zones[$k]);
    } else {
        $zones = guifi_zone_get_parents($zone->id);
        $pager = 0;
    }
    if (empty($zones)) {
        return t('There is no zones to look at');
    }
    $sql = 'SELECT
            zone, id, base, mask, network_type
          FROM {guifi_networks}
          WHERE zone IN (' . implode(',', $zones) . ')
          ORDER BY FIND_IN_SET(zone,"' . implode(',', $zones) . '")';
    $rows = array();
    $result = pager_query($sql, variable_get('guifi_pagelimit', 10));
    $current_zoneid = -1;
    while ($net = db_fetch_object($result)) {
        $item = _ipcalc($net->base, $net->mask);
        // obtaing the used ip's
        $min = ip2long($item['netstart']);
        $max = ip2long($item['netend']);
        $ips = 0;
        $k = $min;
        $amin = NULL;
        $amax = NULL;
        while ($k <= $max) {
            if (isset($ips_allocated[$k])) {
                $ips++;
                $amax = $k;
                if ($ips == 1) {
                    $amin = $k;
                }
            }
            $k++;
        }
        if ($current_zoneid != $net->zone) {
            $current_zoneid = $net->zone;
            $rows[] = array(array('data' => l(guifi_get_zone_name($net->zone), 'node/' . $net->zone . '/view/ipv4'), 'colspan' => '0'));
        }
        $row = array($net->base . '/' . $item['maskbits'] . ' (' . $net->mask . ')', $item['netstart'] . ' / ' . $item['netend'], array('data' => number_format($item['hosts']), 'align' => 'right'), $net->network_type, long2ip($amin) . ' / ' . long2ip($amax), array('data' => number_format($ips), 'align' => 'right'), array('data' => round($ips * 100 / $item['hosts']) . '%', 'align' => 'right'));
        if (user_access('administer guifi networks')) {
            $row[] = array('data' => l(guifi_img_icon('edit.png'), 'guifi/ipv4/' . $net->id . '/edit', array('html' => TRUE, 'title' => t('edit network'), 'attributes' => array('target' => '_blank'))) . l(guifi_img_icon('drop.png'), 'guifi/ipv4/' . $net->id . '/delete', array('html' => TRUE, 'title' => t('delete device'), 'attributes' => array('target' => '_blank'))), 'align' => 'center');
        }
        $rows[] = $row;
    }
    if (count($rows)) {
        $output .= theme('table', $header, $rows);
        $output .= theme('pager', NULL, variable_get('guifi_pagelimit', 10));
    } else {
        $output .= t('None');
    }
    return $output;
}
Ejemplo n.º 15
0
<?php 
}
?>
</div>

<div id="profile_blog">
    <!-- START - LATEST 10 BLOG ENTRIES -->
    <div class="profilefeeds">
    <?php 
$nlimit = 10;
?>
    <?php 
$userid = $profile->uid;
?>
    <?php 
$result1 = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 AND n.uid = {$userid} ORDER BY n.created DESC"), variable_get('default_nodes_main', $nlimit));
?>
    <?php 
while ($node = db_fetch_object($result1)) {
    $output2 .= node_view(node_load(array('nid' => $node->nid)), 1);
}
?>
    
    <?php 
if ($output2) {
    ?>
    <?php 
    print $output2;
    ?>
    <?php 
} else {
Ejemplo n.º 16
0
 $wid = workflow_get_workflow_for_type($node->type);
 $states_per_page = 250;
 $states = array();
 $result = db_query("SELECT sid, state FROM {workflow_states} WHERE status = 1 ORDER BY sid");
 while ($data = db_fetch_object($result)) {
     $states[$data->sid] = check_plain(t($data->state));
 }
 $deleted_states = array();
 $result = db_query("SELECT sid, state FROM {workflow_states} WHERE status = 0 ORDER BY sid");
 while ($data = db_fetch_object($result)) {
     $deleted_states[$data->sid] = check_plain(t($data->state));
 }
 $current = workflow_node_current_state($node);
 // theme_workflow_current_state() must run state through check_plain().
 $output = '<p>' . t('Current state: <strong>!state</strong>', array('!state' => $states[$current])) . "</p>\n";
 $result = pager_query("SELECT h.*, u.name FROM {workflow_node_history} h LEFT JOIN {users} u ON h.uid = u.uid WHERE nid = %d ORDER BY hid DESC", $states_per_page, 0, NULL, $node->nid);
 $rows = array();
 while ($history = db_fetch_object($result)) {
     if ($history->sid == $current && !isset($deleted_states[$history->sid]) && !isset($current_themed)) {
         // Theme the current state differently so it stands out.
         $state_name = $states[$history->sid];
         // Make a note that we have themed the current state; other times in the history
         // of this node where the node was in this state do not need to be specially themed.
         $current_themed = TRUE;
     } elseif (isset($deleted_states[$history->sid])) {
         // The state has been deleted, but we include it in the history.
         $state_name = $deleted_states[$history->sid];
         $footer_needed = TRUE;
     } else {
         // Regular state.
         $state_name = check_plain(t($states[$history->sid]));
        $photo      = _dw_campaigns_get_photo(array(), array(), 'donation-photo', $supporter->id, $image_match);
        $email      = $contact->email;
        $amount     = $supporter->amount;
        $location   = $contact->city . ', ' . $contact->state_province;
        //$date       = substr($contribution->receive_date, 0, 10);
        $date       = $contribution->receive_date;
        $note       = is_object($supporter->pcp_personal_note)?'':$supporter->pcp_personal_note;
        $pay_later  = $supporter->is_pay_later;
        
        db_query("insert into {donations_as} (name, photo, email, amount, location, donationdate, note, is_pay_later) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $name, $photo, $email, $amount, $location, $date, $note, $pay_later);
    }

    $sql_count = "select count(*) from donations_as";

    //$result = db_query("select * from donations_as " . tablesort_sql($headers));
    $result = pager_query("select * from donations_as " . tablesort_sql($headers), $num_per_page, 0, $sql_count);

    $rows = array();
    while ($db_row = db_fetch_object($result)) {
        $tr_class = ($db_row->is_pay_later == 1) ? 'is_pay_later' : '';

        $rows[] = array(
            'data' => array(
                array('data' => '<img src="' . $db_row->photo . '" width="25"> <a href="mailto:' . $db_row->email . '">' . $db_row->name . '</a>', 'class' => 'name' ),
                array('data' => dw_campaigns_force_decimal($db_row->amount, $campaign->field_dw_currency['0']['value']), 'class' => 'amount'),
                array('data' => $db_row->location, 'class' => 'location'),
                array('data' => dw_campaigns_format_date($db_row->donationdate), 'class' => 'date'),
                array('data' => $db_row->note, 'class' => 'note'),
            ),
            'class' => $tr_class
        );
Ejemplo n.º 18
0
function sopac_lists_page($list_id = 0, $op = NULL, $search = NULL)
{
    global $user;
    profile_load_profile(&$user);
    require_once 'sopac_social.php';
    $insurge = sopac_get_insurge();
    if ($list_id === 'public') {
        // Display a paged list of all the public lists
        $count = 10;
        if ($op == "search") {
            $output .= drupal_get_form('sopac_list_search_form', $search);
            $args = array();
            foreach (explode(' ', $search) as $term) {
                $search_sql .= " AND (title LIKE '%%%s%%' OR description LIKE '%%%s%%')";
                $args[] = $term;
                $args[] = $term;
            }
        } else {
            $output .= drupal_get_form('sopac_list_search_form');
        }
        $output .= "<h1>Public Lists:</h1>";
        $sql = "SELECT * FROM {sopac_lists} WHERE public = 1 {$search_sql} ORDER BY list_id DESC";
        $countsql = "SELECT COUNT(*) FROM {sopac_lists} WHERE public = 1 {$search_sql} ORDER BY list_id DESC";
        $res = pager_query($sql, $count, 0, $countsql, $args);
        $output .= theme('pager', NULL, $count);
        while ($list = db_fetch_array($res)) {
            $list['items'] = $insurge->get_list_items($list['list_id']);
            $output .= theme('sopac_list', $list);
            $list_count++;
        }
        $output .= theme('pager', NULL, $count);
        if ($list_count == $public_limit) {
            $output .= '<ul class="list-overview-actions"><li class="button green">' . l("Next {$public_limit} Lists", 'user/lists/public', array('query' => array('offset' => $public_offset + $public_limit))) . '</li></ul>';
        }
    } else {
        if ($list_id) {
            // display list contents
            $list = db_fetch_array(db_query("SELECT * FROM sopac_lists WHERE list_id = %d LIMIT 1", $list_id));
            if ($list['list_id']) {
                if ($list['public'] || sopac_lists_access($list['list_id'])) {
                    global $pager_page_array, $pager_total;
                    drupal_set_title($list['title']);
                    drupal_set_breadcrumb(array(l('Home', '<front>'), l('Lists', 'user/lists'), l($list['title'], $_GET['q'])));
                    // Update Checkout History?
                    if ($list['title'] == 'Checkout History' && $user->profile_cohist) {
                        sopac_update_history($list);
                        if (empty($_GET['sort'])) {
                            $_GET['sort'] = 'date_newest';
                        }
                    }
                    if ($_GET['perpage']) {
                        $limit = $_GET['perpage'];
                    } else {
                        if ($account->profile_perpage) {
                            $limit = $account->profile_perpage;
                        } else {
                            if ($op == 'print' || $op == 'csv') {
                                $limit = NULL;
                            } else {
                                $limit = variable_get('sopac_results_per_page', 10);
                            }
                        }
                    }
                    $pager_page_array = explode(',', $_GET['page']);
                    // Initialize the pager if need be
                    if ($pager_page_array[0]) {
                        $page = $pager_page_array[0] + 1;
                    } else {
                        $page = 1;
                    }
                    $page_offset = $limit * ($page - 1);
                    $sortopts = array('value', 'title', 'author', 'mat_code');
                    $search_term = $_GET['search'] ? $_GET['search'] : '';
                    if (array_search($_GET['sort'], $sortopts)) {
                        $list['items'] = $insurge->get_list_items($list_id, $_GET['sort'], 'ASC', $search_term);
                    } else {
                        if ($_GET['sort'] == 'date') {
                            $list['items'] = $insurge->get_list_items($list_id, 'tag_date', 'ASC', $search_term);
                        } else {
                            if ($_GET['sort'] == 'date_newest') {
                                $list['items'] = $insurge->get_list_items($list_id, 'tag_date', 'DESC', $search_term);
                            } else {
                                $list['items'] = $insurge->get_list_items($list_id, 'value', 'ASC', $search_term);
                            }
                        }
                    }
                    $list['total_items'] = count($list['items']);
                    if ($limit) {
                        $pager_total[0] = ceil($list['total_items'] / $limit);
                    }
                    // Trim list items to display
                    $list['items'] = array_slice($list['items'], $page_offset, $limit, TRUE);
                    if ($op == 'print') {
                        $output .= theme('sopac_list', $list, TRUE, 'print');
                    } else {
                        if ($op == 'csv') {
                            foreach ($list['items'] as &$item) {
                                unset($item['tid'], $item['repos_id'], $item['group_id'], $item['uid'], $item['tag'], $item['namespace'], $item['predicate'], $item['value']);
                                $item['url'] = 'http://www.aadl.org/catalog/record/' . $item['bnum'];
                            }
                            output_csv($list['items'], 'aadl-list-' . $list['list_id'] . '.csv');
                            exit(0);
                        } else {
                            $output .= theme('sopac_list', $list, TRUE);
                        }
                    }
                    $output .= theme('pager', NULL, $limit, 0, NULL, 6);
                } else {
                    $output .= '<p>You do not have permission to view this list.</p>';
                    $output .= '<ul><li class="button green">';
                    $output .= $user->uid ? l('View your lists', 'user/lists') : l('Log in to create lists', 'user', array('query' => 'destination=user/lists'));
                    $output .= '</li></ul>';
                }
            } else {
                drupal_set_message("No list with list id #{$list_id} exists");
                drupal_goto('user/lists');
            }
        } else {
            if ($user->uid) {
                $output .= "<p style=\"float: right\">" . l('See all Public Lists...', 'user/lists/public') . '</p>';
                $output .= "<h1>My Lists:</h1>";
                // display lists
                $res = db_query("SELECT * FROM {sopac_lists} WHERE uid = %d", $user->uid);
                while ($list = db_fetch_array($res)) {
                    $list['items'] = $insurge->get_list_items($list['list_id']);
                    $output .= theme('sopac_list', $list);
                }
                $output .= '<ul class="list-overview-actions"><li class="button green">' . l('Create New List', 'user/lists/edit') . '</li></ul>';
            } else {
                // Anonymous user
                drupal_set_message('You must log in to create and edit your lists');
                drupal_goto('user', drupal_get_destination());
            }
        }
    }
    return $output;
}
        
        $position++;
        $location           = $campaign->field_dw_campaign_location[0]['value']; // $campaign->title;
        list($distance,)    = split('-', $id);
        $walkers            = count(get_object_vars($pcps));
        $amount             = dw_campaigns_get_contribution_total_for_campaign($campaign);
        $campaign_id        = $campaign->nid;
        
        db_query("insert into {distance_as_$num_per_page} (position, location, distance, walkers, amount, campaign_id) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $position, $location, $distance, $walkers, $amount, $campaign_id);

    }


    $sql_count = "select count(*) from distance_as_$num_per_page";

    $result = pager_query("select * from distance_as_$num_per_page " . tablesort_sql($headers), $num_per_page, 0, $sql_count);

    $rows = array();
    while ($db_row = db_fetch_object($result)) {
        $our_campaign = node_load($db_row->campaign_id);

        $rows[] = array(
            'data' => array(
                array('data' => $db_row->position, 'class' => 'position'),
                array('data' => '<a href="/dw/walking/location/' . $db_row->campaign_id . '">' . $db_row->location . '</a>', 'class' => 'location'),
                array('data' => floor($db_row->distance) . ' ' . $units_wd, 'class' => 'distance'),
                array('data' => $db_row->walkers,  'class' => 'walkers'),
                array('data' => dw_campaigns_force_decimal($db_row->amount, $campaign->field_dw_currency['0']['value'])),
            )    
        );
    }
Ejemplo n.º 20
0
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;
}