[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/theme/ -> theme.inc (source)

   1  <?php
   2  // $Id: theme.inc,v 1.84.2.14.2.1 2010/12/15 05:24:41 merlinofchaos Exp $
   3  
   4  /**
   5   * @file theme.inc
   6   *
   7   * An array of preprocessors to fill variables for templates and helper
   8   * functions to make theming easier.
   9   */
  10  
  11  /**
  12   * Provide a full array of possible themes to try for a given hook.
  13   *
  14   * @param $hook
  15   *   The hook to use. This is the base theme/template name.
  16   * @param $view
  17   *   The view being rendered.
  18   * @param $display
  19   *   The display being rendered, if applicable.
  20   */
  21  function _views_theme_functions($hook, $view, $display = NULL) {
  22    $themes = array();
  23  
  24    if ($display) {
  25      $themes[] = $hook . '__' . $view->name . '__' . $display->id;
  26      $themes[] = $hook . '__' . $display->id;
  27      $themes[] = $hook . '__' . preg_replace('/[^a-z0-9]/', '-', strtolower($view->tag));
  28      if ($display->id != $display->display_plugin) {
  29        $themes[] = $hook . '__' . $view->name . '__' . $display->display_plugin;
  30        $themes[] = $hook . '__' . $display->display_plugin;
  31      }
  32    }
  33    $themes[] = $hook . '__' . $view->name;
  34    $themes[] = $hook;
  35    return $themes;
  36  }
  37  
  38  /**
  39   * Preprocess the primary theme implementation for a view.
  40   */
  41  function template_preprocess_views_view(&$vars) {
  42    global $base_path;
  43  
  44    $view = $vars['view'];
  45  
  46    $vars['rows']       = !empty($view->result) || !empty($view->style_plugin->definition['even empty']) ? $view->style_plugin->render($view->result) : '';
  47  
  48    $vars['css_name']   = views_css_safe($view->name);
  49    $vars['name']       = $view->name;
  50    $vars['display_id'] = $view->current_display;
  51  
  52    // Basic classes
  53    $vars['classes_array'] = array();
  54    $vars['classes_array'][] = 'view';
  55    $vars['classes_array'][] = 'view-' . views_css_safe($vars['name']);
  56    $vars['classes_array'][] = 'view-id-' . $vars['name'];
  57    $vars['classes_array'][] = 'view-display-id-' . $vars['display_id'];
  58  
  59    $css_class = $view->display_handler->get_option('css_class');
  60    if (!empty($css_class)) {
  61      $vars['css_class'] = preg_replace('/[^a-zA-Z0-9- ]/', '-', $css_class);
  62      $vars['classes_array'][] = $vars['css_class'];
  63    }
  64  
  65    if (!$vars['rows']) {
  66      $vars['empty']    = $view->display_handler->render_empty();
  67      if (!$view->display_handler->get_option('header_empty')) {
  68        $vars['header'] = '';
  69      }
  70      if (!$view->display_handler->get_option('footer_empty')) {
  71        $vars['footer'] = '';
  72      }
  73    }
  74    else {
  75      $vars['empty']    = '';
  76      $header = TRUE;
  77    }
  78  
  79    $vars['exposed']    = !empty($view->exposed_widgets) ? $view->exposed_widgets : '';
  80    if (!isset($vars['header'])) {
  81      $vars['header']   = $view->display_handler->render_header();
  82    }
  83    if (!isset($vars['footer'])) {
  84      $vars['footer']   = $view->display_handler->render_footer();
  85    }
  86    $vars['more']       = $view->display_handler->render_more_link();
  87    $vars['feed_icon']  = !empty($view->feed_icon) ? $view->feed_icon : '';
  88  
  89    $vars['attachment_before'] = !empty($view->attachment_before) ? $view->attachment_before : '';
  90    $vars['attachment_after'] = !empty($view->attachment_after) ? $view->attachment_after : '';
  91  
  92    $vars['pager']      = '';
  93  
  94    $exposed_input = isset($view->exposed_data_raw) ? $view->exposed_data_raw : NULL;
  95    if ($view->display_handler->render_pager()) {
  96      $pager_type = ($view->pager['use_pager'] === 'mini' ? 'views_mini_pager' : 'pager');
  97      $pager_theme = views_theme_functions($pager_type, $view, $view->display_handler->display);
  98      $vars['pager']    = theme($pager_theme, $exposed_input, $view->pager['items_per_page'], $view->pager['element']);
  99    }
 100  
 101    // if administrator, add some links. These used to be tabs, but this is better.
 102    if (user_access('administer views') && module_exists('views_ui') && empty($view->hide_admin_links) && !variable_get('views_no_hover_links', FALSE)) {
 103      $vars['admin_links_raw'] = array(
 104        array(
 105          'title' => t('Edit'),
 106          'alt' => t("Edit this view"),
 107          'href' => "admin/build/views/edit/$view->name",
 108          'fragment' => 'views-tab-' . $view->current_display,
 109          'query' => drupal_get_destination(),
 110        ),
 111        array(
 112          'title' => t('Export'),
 113          'alt' => t("Export this view"),
 114          'href' => "admin/build/views/export/$view->name",
 115        ),
 116        array(
 117          'title' => t('Clone'),
 118          'alt' => t("Create a copy of this view"),
 119          'href' => "admin/build/views/clone/$view->name",
 120        ),
 121      );
 122  
 123      drupal_alter('views_admin_links', $vars['admin_links_raw'], $view);
 124      $vars['admin_links'] = theme('links', $vars['admin_links_raw']);
 125    }
 126    else {
 127      $vars['admin_links'] = '';
 128      $vars['admin_links_raw'] = array();
 129    }
 130  
 131    // Our JavaScript needs to have some means to find the HTML belonging to this
 132    // view.
 133    //
 134    // It is true that the DIV wrapper has classes denoting the name of the view
 135    // and its display ID, but this is not enough to unequivocally match a view
 136    // with its HTML, because one view may appear several times on the page. So
 137    // we set up a running counter, $dom_id, to issue a "unique" identifier for
 138    // each view. This identifier is written to both Drupal.settings and the DIV
 139    // wrapper.
 140    static $dom_id = 1;
 141    $vars['dom_id'] = !empty($view->dom_id) ? $view->dom_id : $dom_id++;
 142    $vars['classes_array'][] = 'view-dom-id-' . $vars['dom_id'];
 143  
 144    // If using AJAX, send identifying data about this view.
 145    if ($view->use_ajax) {
 146      $settings = array(
 147        'views' => array(
 148          'ajax_path' => url('views/ajax'),
 149          'ajaxViews' => array(
 150            array(
 151              'view_name' => $view->name,
 152              'view_display_id' => $view->current_display,
 153              'view_args' => check_plain(implode('/', $view->args)),
 154              'view_path' => check_plain($_GET['q']),
 155              // Pass through URL to ensure we get e.g. language prefixes.
 156  //            'view_base_path' => isset($view->display['page']) ? substr(url($view->display['page']->display_options['path']), strlen($base_path)) : '',
 157              'view_base_path' => $view->get_path(),
 158              'view_dom_id' => $vars['dom_id'],
 159              // To fit multiple views on a page, the programmer may have
 160              // overridden the display's pager_element.
 161              'pager_element' => $view->pager['element'],
 162            ),
 163          ),
 164        ),
 165      );
 166  
 167      drupal_add_js($settings, 'setting');
 168      views_add_js('ajax_view');
 169    }
 170    // Flatten the classes to a string for the template file.
 171    $vars['classes'] = implode(' ', $vars['classes_array']);
 172  }
 173  
 174  /**
 175   * Preprocess theme function to print a single record from a row, with fields
 176   */
 177  function template_preprocess_views_view_fields(&$vars) {
 178    $view = $vars['view'];
 179  
 180    // Loop through the fields for this view.
 181    $inline = FALSE;
 182    $vars['fields'] = array(); // ensure it's at least an empty array.
 183    foreach ($view->field as $id => $field) {
 184      // render this even if set to exclude so it can be used elsewhere.
 185      $field_output = $view->style_plugin->get_field($view->row_index, $id);
 186      $empty = $field_output !== 0 && empty($field_output);
 187      if (empty($field->options['exclude']) && (!$empty || empty($field->options['hide_empty']))) {
 188        $object = new stdClass();
 189  
 190        $object->content = $field_output;
 191        if (isset($view->field[$id]->field_alias) && isset($vars['row']->{$view->field[$id]->field_alias})) {
 192          $object->raw = $vars['row']->{$view->field[$id]->field_alias};
 193        }
 194        else {
 195          $object->raw = NULL; // make sure it exists to reduce NOTICE
 196        }
 197        $object->inline = !empty($vars['options']['inline'][$id]);
 198        $object->inline_html = $object->inline ? 'span' : 'div';
 199        if (!empty($vars['options']['separator']) && $inline && $object->inline && $object->content) {
 200          $object->separator = filter_xss_admin($vars['options']['separator']);
 201        }
 202  
 203        $inline = $object->inline;
 204  
 205        $object->handler = &$view->field[$id];
 206        $object->element_type = $object->handler->element_type();
 207  
 208        $object->class = views_css_safe($id);
 209        $object->label = check_plain($view->field[$id]->label());
 210        $vars['fields'][$id] = $object;
 211      }
 212    }
 213  
 214  }
 215  
 216  /**
 217   * Display a single views field.
 218   *
 219   * Interesting bits of info:
 220   * $field->field_alias says what the raw value in $row will be. Reach it like
 221   * this: @code { $row->{$field->field_alias} @endcode
 222   */
 223  function theme_views_view_field($view, $field, $row) {
 224    // Reference safe for PHP 4:
 225    return $view->field[$field->options['id']]->advanced_render($row);
 226  }
 227  
 228  /**
 229   * Process a single field within a view.
 230   *
 231   * This preprocess function isn't normally run, as a function is used by
 232   * default, for performance. However, by creating a template, this
 233   * preprocess should get picked up.
 234   */
 235  function template_preprocess_views_view_field(&$vars) {
 236    $vars['output'] = $vars['field']->advanced_render($vars['row']);
 237  }
 238  
 239  /**
 240   * Preprocess theme function to print a single record from a row, with fields
 241   */
 242  function template_preprocess_views_view_summary(&$vars) {
 243    $view     = $vars['view'];
 244    $argument = $view->argument[$view->build_info['summary_level']];
 245  
 246    $url_options = array();
 247  
 248    if (!empty($view->exposed_raw_input)) {
 249      $url_options['query'] = $view->exposed_raw_input;
 250    }
 251    $vars['classes'] = array();
 252    foreach ($vars['rows'] as $id => $row) {
 253      $vars['rows'][$id]->link = $argument->summary_name($row);
 254      $args = $view->args;
 255      $args[$argument->position] = $argument->summary_argument($row);
 256  
 257      $vars['rows'][$id]->url = url($view->get_url($args), $url_options);
 258      $vars['rows'][$id]->count = intval($row->{$argument->count_alias});
 259      if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) {
 260        $vars['classes'][$id] = 'active';
 261      }
 262    }
 263  }
 264  
 265  /**
 266   * Template preprocess theme function to print summary basically
 267   * unformatted.
 268   */
 269  function template_preprocess_views_view_summary_unformatted(&$vars) {
 270    $view     = $vars['view'];
 271    $argument = $view->argument[$view->build_info['summary_level']];
 272    $vars['classes'] = array();
 273  
 274    $url_options = array();
 275  
 276    if (!empty($view->exposed_raw_input)) {
 277      $url_options['query'] = $view->exposed_raw_input;
 278    }
 279  
 280    $count = 0;
 281    foreach ($vars['rows'] as $id => $row) {
 282      // only false on first time:
 283      if ($count++) {
 284        $vars['rows'][$id]->separator = filter_xss_admin($vars['options']['separator']);
 285      }
 286      $vars['rows'][$id]->link = $argument->summary_name($row);
 287      $args = $view->args;
 288      $args[$argument->position] = $argument->summary_argument($row);
 289  
 290      $vars['rows'][$id]->url = url($view->get_url($args), $url_options);
 291      $vars['rows'][$id]->count = intval($row->{$argument->count_alias});
 292      if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) {
 293        $vars['classes'][$id] = 'active';
 294      }
 295    }
 296  }
 297  
 298  /**
 299   * Display a view as a table style.
 300   */
 301  function template_preprocess_views_view_table(&$vars) {
 302    $view     = $vars['view'];
 303  
 304    // We need the raw data for this grouping, which is passed in as $vars['rows'].
 305    // However, the template also needs to use for the rendered fields.  We
 306    // therefore swap the raw data out to a new variable and reset $vars['rows']
 307    // so that it can get rebuilt.
 308    // Store rows so that they may be used by further preprocess functions.
 309    $result   = $vars['result'] = $vars['rows'];
 310    $vars['rows'] = array();
 311  
 312    $options  = $view->style_plugin->options;
 313    $handler  = $view->style_plugin;
 314  
 315    $fields   = &$view->field;
 316    $columns  = $handler->sanitize_columns($options['columns'], $fields);
 317  
 318    $active   = !empty($handler->active) ? $handler->active : '';
 319    $order    = !empty($handler->order) ? $handler->order : 'asc';
 320  
 321    $query    = tablesort_get_querystring();
 322    if ($query) {
 323      $query = '&' . $query;
 324    }
 325  
 326    // Fields must be rendered in order as of Views 2.3, so we will pre-render
 327    // everything.
 328    $renders = $handler->render_fields($result);
 329  
 330    foreach ($columns as $field => $column) {
 331      // render the header labels
 332      if ($field == $column && empty($fields[$field]->options['exclude'])) {
 333        $label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
 334        if (empty($options['info'][$field]['sortable']) || !$fields[$field]->click_sortable()) {
 335          $vars['header'][$field] = $label;
 336        }
 337        else {
 338          // @todo -- make this a setting
 339          $initial = 'asc';
 340  
 341          if ($active == $field && $order == 'asc') {
 342            $initial = 'desc';
 343          }
 344  
 345          $title = t('sort by @s', array('@s' => $label));
 346          if ($active == $field) {
 347            $label .= theme('tablesort_indicator', $initial);
 348          }
 349          $link_options = array(
 350            'html' => true,
 351            'attributes' => array('title' => $title),
 352            'query' => 'order=' . urlencode($field) . '&sort=' . $initial . $query,
 353          );
 354          $vars['header'][$field] = l($label, $_GET['q'], $link_options);
 355        }
 356      }
 357  
 358      // Create a second variable so we can easily find what fields we have and what the
 359      // CSS classes should be.
 360      $vars['fields'][$field] = views_css_safe($field);
 361      if ($active == $field) {
 362        $vars['fields'][$field] .= ' active';
 363      }
 364  
 365      // Render each field into its appropriate column.
 366      foreach ($result as $num => $row) {
 367        if (!empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
 368          $field_output = $renders[$num][$field];
 369  
 370          if (!isset($vars['rows'][$num][$column])) {
 371            $vars['rows'][$num][$column] = '';
 372          }
 373  
 374          // Don't bother with separators and stuff if the field does not show up.
 375          if ($field_output === '') {
 376            continue;
 377          }
 378  
 379          // Place the field into the column, along with an optional separator.
 380          if ($vars['rows'][$num][$column] !== '') {
 381            if (!empty($options['info'][$column]['separator'])) {
 382              $vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
 383            }
 384          }
 385  
 386          $vars['rows'][$num][$column] .= $field_output;
 387        }
 388      }
 389    }
 390  
 391    $count = 0;
 392    foreach ($vars['rows'] as $num => $row) {
 393      $vars['row_classes'][$num][] = ($count++ % 2 == 0) ? 'odd' : 'even';
 394    }
 395  
 396    $vars['row_classes'][0][] = 'views-row-first';
 397    $vars['row_classes'][count($vars['row_classes']) - 1][] = 'views-row-last';
 398  
 399    $vars['class'] = 'views-table';
 400    if (!empty($options['sticky'])) {
 401      drupal_add_js('misc/tableheader.js');
 402      $vars['class'] .= " sticky-enabled";
 403    }
 404    $vars['class'] .= ' cols-'. count($vars['rows']);
 405  }
 406  
 407  /**
 408   * Display a view as a grid style.
 409   */
 410  function template_preprocess_views_view_grid(&$vars) {
 411    $view     = $vars['view'];
 412    $result   = $view->result;
 413    $options  = $view->style_plugin->options;
 414    $handler  = $view->style_plugin;
 415  
 416    $columns  = $options['columns'];
 417  
 418    $rows = array();
 419  
 420    if ($options['alignment'] == 'horizontal') {
 421      $row = array();
 422      $row_count = 0;
 423      foreach ($vars['rows'] as $count => $item) {
 424        $row[] = $item;
 425        $row_count++;
 426        if (($count + 1) % $columns == 0) {
 427          $rows[] = $row;
 428          $row = array();
 429          $row_count = 0;
 430        }
 431      }
 432      if ($row) {
 433        // Fill up the last line only if it's configured, but this is default.
 434        if (!empty($handler->options['fill_single_line']) || count($rows)) {
 435          for ($i = 0; $i < ($columns - $row_count); $i++) {
 436            $row[] = '';
 437          }
 438        }
 439        $rows[] = $row;
 440      }
 441    }
 442    else {
 443      $num_rows = floor(count($vars['rows']) / $columns);
 444      // The remainders are the 'odd' columns that are slightly longer.
 445      $remainders = count($vars['rows']) % $columns;
 446      $row = 0;
 447      $col = 0;
 448      foreach ($vars['rows'] as $count => $item) {
 449        $rows[$row][$col] = $item;
 450        $row++;
 451  
 452        if (!$remainders && $row == $num_rows) {
 453          $row = 0;
 454          $col++;
 455        }
 456        else if ($remainders && $row == $num_rows + 1) {
 457          $row = 0;
 458          $col++;
 459          $remainders--;
 460        }
 461      }
 462      for ($i = 0; $i < count($rows[0]); $i++) {
 463        // This should be string so that's okay :)
 464        if (!isset($rows[count($rows) - 1][$i])) {
 465          $rows[count($rows) - 1][$i] = '';
 466        }
 467      }
 468    }
 469    $vars['rows'] = $rows;
 470  }
 471  
 472  /**
 473   * Display the simple view of rows one after another
 474   */
 475  function template_preprocess_views_view_unformatted(&$vars) {
 476    $view     = $vars['view'];
 477    $rows     = $vars['rows'];
 478  
 479    $vars['classes'] = array();
 480    // Set up striping values.
 481    foreach ($rows as $id => $row) {
 482      $row_classes = array();
 483      $row_classes[] = 'views-row';
 484      $row_classes[] = 'views-row-' . ($id + 1);
 485      $row_classes[] = 'views-row-' . ($id % 2 ? 'even' : 'odd');
 486      if ($id == 0) {
 487        $row_classes[] = 'views-row-first';
 488      }
 489      if ($id == count($rows) -1) {
 490        $row_classes[] = 'views-row-last';
 491      }
 492      // Flatten the classes to a string for each row for the template file.
 493      $vars['classes'][$id] = implode(' ', $row_classes);
 494    }
 495  }
 496  
 497  /**
 498   * Display the view as an HTML list element
 499   */
 500  function template_preprocess_views_view_list(&$vars) {
 501    template_preprocess_views_view_unformatted($vars);
 502  }
 503  
 504  /**
 505   * Preprocess an RSS feed
 506   */
 507  function template_preprocess_views_view_rss(&$vars) {
 508    global $base_url;
 509    global $language;
 510  
 511    $view     = &$vars['view'];
 512    $options  = &$vars['options'];
 513    $items    = &$vars['rows'];
 514  
 515    $style    = &$view->style_plugin;
 516  
 517    if (!empty($options['mission_description'])) {
 518      $description = variable_get('site_mission', '');
 519    }
 520    else {
 521      $description = $options['description'];
 522    }
 523    // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
 524    // We strip all HTML tags, but need to prevent double encoding from properly
 525    // escaped source data (such as &amp becoming &amp;amp;).
 526    $vars['description'] = check_plain(decode_entities(strip_tags($description)));
 527  
 528    if ($view->display_handler->get_option('sitename_title')) {
 529      $title = variable_get('site_name', 'Drupal');
 530      if ($slogan = variable_get('site_slogan', '')) {
 531        $title .= ' - ' . $slogan;
 532      }
 533    }
 534    else {
 535      $title = $view->get_title();
 536    }
 537    $vars['title'] = check_plain($title);
 538  
 539    // Figure out which display which has a path we're using for this feed. If there isn't
 540    // one, use the global $base_url
 541    $link_display_id = $view->display_handler->get_link_display();
 542    if ($link_display_id && !empty($view->display[$link_display_id])) {
 543      $path = $view->display[$link_display_id]->handler->get_path();
 544    }
 545  
 546    if ($path) {
 547      $path = $view->get_url(NULL, $path);
 548      $url_options = array('absolute' => TRUE);
 549      if (!empty($view->exposed_raw_input)) {
 550        $url_options['query'] = $view->exposed_raw_input;
 551      }
 552  
 553      // Compare the link to the default home page; if it's the default home page, just use $base_url.
 554      if ($path == variable_get('site_frontpage', 'node')) {
 555        $path = '';
 556      }
 557  
 558      $vars['link'] = check_url(url($path, $url_options));
 559    }
 560  
 561    $vars['langcode'] = check_plain($language->language);
 562    $vars['namespaces'] = drupal_attributes($style->namespaces);
 563    $vars['items'] = $items;
 564    $vars['channel_elements'] = format_xml_elements($style->channel_elements);
 565  
 566    drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
 567  }
 568  
 569  /**
 570   * Default theme function for all RSS rows.
 571   */
 572  function template_preprocess_views_view_row_rss(&$vars) {
 573    $view     = &$vars['view'];
 574    $options  = &$vars['options'];
 575    $item     = &$vars['row'];
 576  
 577    $vars['title'] = check_plain($item->title);
 578    $vars['link'] = check_url($item->link);
 579    $vars['description'] = check_plain($item->description);
 580    $vars['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
 581  }
 582  
 583  /**
 584   * Default theme function for all filter forms.
 585   */
 586  function template_preprocess_views_exposed_form(&$vars) {
 587    $form = &$vars['form'];
 588  
 589    // Put all single checkboxes together in the last spot.
 590    $checkboxes = '';
 591  
 592    if (!empty($form['q'])) {
 593      $vars['q'] = drupal_render($form['q']);
 594    }
 595  
 596    $vars['widgets'] = array();
 597    foreach ($form['#info'] as $id => $info) {
 598      // Set aside checkboxes.
 599      if (isset($form[$info['value']]['#type']) && $form[$info['value']]['#type'] == 'checkbox') {
 600        $checkboxes .= drupal_render($form[$info['value']]);
 601        continue;
 602      }
 603      $widget = new stdClass;
 604      // set up defaults so that there's always something there.
 605      $widget->label = $widget->operator = $widget->widget = NULL;
 606  
 607      $widget->id = $form[$info['value']]['#id'];
 608      if (!empty($info['label'])) {
 609        $widget->label = $info['label'];
 610      }
 611      if (!empty($info['operator'])) {
 612        $widget->operator = drupal_render($form[$info['operator']]);
 613      }
 614      $widget->widget = drupal_render($form[$info['value']]);
 615      $vars['widgets'][$id] = $widget;
 616    }
 617  
 618    // Wrap up all the checkboxes we set aside into a widget.
 619    if ($checkboxes) {
 620      $widget = new stdClass;
 621      // set up defaults so that there's always something there.
 622      $widget->label = $widget->operator = $widget->widget = NULL;
 623      $widget->widget = $checkboxes;
 624      $vars['widgets']['checkboxes'] = $widget;
 625    }
 626  
 627    // Don't render these:
 628    unset($form['form_id']);
 629    unset($form['form_build_id']);
 630    unset($form['form_token']);
 631  
 632    // This includes the submit button.
 633    $vars['button'] = drupal_render($form);
 634  }
 635  
 636  function theme_views_mini_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
 637    global $pager_page_array, $pager_total;
 638  
 639    // Calculate various markers within this pager piece:
 640    // Middle is used to "center" pages around the current page.
 641    $pager_middle = ceil($quantity / 2);
 642    // current is the page we are currently paged to
 643    $pager_current = $pager_page_array[$element] + 1;
 644    // max is the maximum page number
 645    $pager_max = $pager_total[$element];
 646    // End of marker calculations.
 647  
 648  
 649    $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹‹')), $limit, $element, 1, $parameters);
 650    if (empty($li_previous)) {
 651      $li_previous = "&nbsp;";
 652    }
 653  
 654    $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('››')), $limit, $element, 1, $parameters);
 655    if (empty($li_next)) {
 656      $li_next = "&nbsp;";
 657    }
 658  
 659    if ($pager_total[$element] > 1) {
 660      $items[] = array(
 661        'class' => 'pager-previous',
 662        'data' => $li_previous,
 663      );
 664  
 665      $items[] = array(
 666        'class' => 'pager-current',
 667        'data' => t('@current of @max', array('@current' => $pager_current, '@max' => $pager_max)),
 668      );
 669  
 670      $items[] = array(
 671        'class' => 'pager-next',
 672        'data' => $li_next,
 673      );
 674      return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
 675    }
 676  }
 677  
 678  /**
 679   * @defgroup views_templates Views' template files
 680   * @{
 681   * All views templates can be overridden with a variety of names, using
 682   * the view, the display ID of the view, the display type of the view,
 683   * or some combination thereof.
 684   *
 685   * For each view, there will be a minimum of two templates used. The first
 686   * is used for all views: views-view.tpl.php.
 687   *
 688   * The second template is determined by the style selected for the view. Note
 689   * that certain aspects of the view can also change which style is used; for
 690   * example, arguments which provide a summary view might change the style to
 691   * one of the special summary styles.
 692   *
 693   * The default style for all views is views-view-unformatted.tpl.php
 694   *
 695   * Many styles will then farm out the actual display of each row to a row
 696   * style; the default row style is views-view-fields.tpl.php.
 697   *
 698   * Here is an example of all the templates that will be tried in the following
 699   * case:
 700   *
 701   * View, named foobar. Style: unformatted. Row style: Fields. Display: Page.
 702   *
 703   * - views-view--foobar--page.tpl.php
 704   * - views-view--page.tpl.php
 705   * - views-view--foobar.tpl.php
 706   * - views-view.tpl.php
 707   *
 708   * - views-view-unformatted--foobar--page.tpl.php
 709   * - views-view-unformatted--page.tpl.php
 710   * - views-view-unformatted--foobar.tpl.php
 711   * - views-view-unformatted.tpl.php
 712   *
 713   * - views-view-fields--foobar--page.tpl.php
 714   * - views-view-fields--page.tpl.php
 715   * - views-view-fields--foobar.tpl.php
 716   * - views-view-fields.tpl.php
 717   *
 718   * Important! When adding a new template to your theme, be sure to flush the
 719   * theme registry cache!
 720   *
 721   * @see _views_theme_functions
 722   * @}
 723   */


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7