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