function education_pager($vars) { if (drupal_is_front_page() && theme_get_setting('hide_pager_frontpage')) { return ''; } return theme_pager($vars); }
/** * Overrides theme_pager() and alters the default quantity of pager items. * * @param array $tags * Labels for the controls in the pager. * @param int $limit * The number of query results to display per page. * @param int $element * An optional ID to distinguish between multiple pagers on one page. * @param array $parameters * An mapping of query string parameters to append to the pager links. * @param int $quantity * The number of page items to show in the pager. If this value is zero (0), * the item count specified by the theme setting nitobe_pager_page_count will * be used (5 if not set). * * @return string * The HTML that generates the query pager. */ function nitobe_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 0) { if ($quantity == 0) { $quantity = theme_get_setting("nitobe_pager_page_count"); $quantity = empty($quantity) ? 5 : $quantity; } return theme_pager($tags, $limit, $element, $parameters, $quantity); }
/** * Format a query pager. * * Menu callbacks that display paged query results should call theme('pager') to retrieve a pager control so that users can view * other results. Format a list of nearby pages with additional query results. * * Adds HTML hooks for making the pager appear in a horizontal bar */ function deco_pager($variables) { $output = theme_pager($variables); if (!empty($variables)) { $output = '<div class="content-bar"><div class="left">' . $output . '</div></div>'; } return $output; }
/** * Format a query pager. * * Menu callbacks that display paged query results should call theme('pager') to retrieve a pager control so that users can view * other results. Format a list of nearby pages with additional query results. * * Adds HTML hooks for making the pager appear in a horizontal bar */ function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) { $output = theme_pager($tags, $limit, $element, $parameters, $quantity); if (!empty($output)) { $output = '<div class="content-bar"><div class="left">' . $output . '</div></div>'; } return $output; }
/** * 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; }
/** * Implements theme_pager(). */ function osha_frontend_pager($variables) { // Overwrite pager links. $variables['tags'][0] = '«'; $variables['tags'][1] = '‹'; $variables['tags'][3] = '›'; $variables['tags'][4] = '»'; return theme_pager($variables); }
function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $attributes = array()) { $pager = is_file(path_to_theme() . 'pager.tpl.php') ? _phptemplate_callback('comment_form', array('tags' => $tags, 'limit' => $limit, 'element' => $element, 'attributes' => $attributes)) : theme_pager($tags, $limit, $element, $attributes); return _is_forum() ? '<tr><td colspan="2">' . $pager . '</td></tr>' : $pager; }
/** * Implements theme_pager() */ function okcdesign_pager($variables) { $html = theme_plugins_invoke(__FUNCTION__, $variables); if ($html) { return $html; } return theme_pager($variables); }
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... }
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; }
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; }