Now all modules are in core modules folder
This commit is contained in:
parent
5ba1cdfa0b
commit
05b6a91b0c
1907 changed files with 0 additions and 0 deletions
756
modules/views/theme/theme.inc
Normal file
756
modules/views/theme/theme.inc
Normal file
|
@ -0,0 +1,756 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file theme.inc
|
||||
*
|
||||
* An array of preprocessors to fill variables for templates and helper
|
||||
* functions to make theming easier.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provide a full array of possible themes to try for a given hook.
|
||||
*
|
||||
* @param $hook
|
||||
* The hook to use. This is the base theme/template name.
|
||||
* @param $view
|
||||
* The view being rendered.
|
||||
* @param $display
|
||||
* The display being rendered, if applicable.
|
||||
*/
|
||||
function _views_theme_functions($hook, $view, $display = NULL) {
|
||||
$themes = array();
|
||||
|
||||
if ($display) {
|
||||
$themes[] = $hook . '__' . $view->name . '__' . $display->id;
|
||||
$themes[] = $hook . '__' . $display->id;
|
||||
$themes[] = $hook . '__' . preg_replace('/[^a-z0-9]/', '_', strtolower($view->tag));
|
||||
if ($display->id != $display->display_plugin) {
|
||||
$themes[] = $hook . '__' . $view->name . '__' . $display->display_plugin;
|
||||
$themes[] = $hook . '__' . $display->display_plugin;
|
||||
}
|
||||
}
|
||||
$themes[] = $hook . '__' . $view->name;
|
||||
$themes[] = $hook;
|
||||
return $themes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocess the primary theme implementation for a view.
|
||||
*/
|
||||
function template_preprocess_views_view(&$vars) {
|
||||
global $base_path;
|
||||
|
||||
$view = $vars['view'];
|
||||
|
||||
$vars['rows'] = !empty($view->result) || !empty($view->style_plugin->definition['even empty']) ? $view->style_plugin->render($view->result) : '';
|
||||
|
||||
$vars['css_name'] = views_css_safe($view->name);
|
||||
$vars['name'] = $view->name;
|
||||
$vars['display_id'] = $view->current_display;
|
||||
|
||||
// Basic classes
|
||||
$vars['classes_array'] = array();
|
||||
$vars['classes_array'][] = 'view';
|
||||
$vars['classes_array'][] = 'view-' . views_css_safe($vars['name']);
|
||||
$vars['classes_array'][] = 'view-id-' . $vars['name'];
|
||||
$vars['classes_array'][] = 'view-display-id-' . $vars['display_id'];
|
||||
|
||||
$css_class = $view->display_handler->get_option('css_class');
|
||||
if (!empty($css_class)) {
|
||||
$vars['css_class'] = preg_replace('/[^a-zA-Z0-9- ]/', '-', $css_class);
|
||||
$vars['classes_array'][] = $vars['css_class'];
|
||||
}
|
||||
|
||||
if (!$vars['rows']) {
|
||||
$vars['empty'] = $view->display_handler->render_empty();
|
||||
if (!$view->display_handler->get_option('header_empty')) {
|
||||
$vars['header'] = '';
|
||||
}
|
||||
if (!$view->display_handler->get_option('footer_empty')) {
|
||||
$vars['footer'] = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$vars['empty'] = '';
|
||||
$header = TRUE;
|
||||
}
|
||||
|
||||
$vars['exposed'] = !empty($view->exposed_widgets) ? $view->exposed_widgets : '';
|
||||
if (!isset($vars['header'])) {
|
||||
$vars['header'] = $view->display_handler->render_header();
|
||||
}
|
||||
if (!isset($vars['footer'])) {
|
||||
$vars['footer'] = $view->display_handler->render_footer();
|
||||
}
|
||||
$vars['more'] = $view->display_handler->render_more_link();
|
||||
$vars['feed_icon'] = !empty($view->feed_icon) ? $view->feed_icon : '';
|
||||
|
||||
$vars['attachment_before'] = !empty($view->attachment_before) ? $view->attachment_before : '';
|
||||
$vars['attachment_after'] = !empty($view->attachment_after) ? $view->attachment_after : '';
|
||||
|
||||
$vars['pager'] = '';
|
||||
|
||||
$exposed_input = isset($view->exposed_raw_input) ? $view->exposed_raw_input: NULL;
|
||||
if ($view->display_handler->render_pager()) {
|
||||
$pager_type = ($view->pager['use_pager'] === 'mini' ? 'views_mini_pager' : 'pager');
|
||||
$pager_theme = views_theme_functions($pager_type, $view, $view->display_handler->display);
|
||||
$vars['pager'] = theme($pager_theme, $exposed_input, $view->pager['items_per_page'], $view->pager['element']);
|
||||
}
|
||||
|
||||
// if administrator, add some links. These used to be tabs, but this is better.
|
||||
if (user_access('administer views') && module_exists('views_ui') && empty($view->hide_admin_links) && !variable_get('views_no_hover_links', FALSE)) {
|
||||
$vars['admin_links_raw'] = array(
|
||||
array(
|
||||
'title' => t('Edit'),
|
||||
'alt' => t("Edit this view"),
|
||||
'href' => "admin/build/views/edit/$view->name",
|
||||
'fragment' => 'views-tab-' . $view->current_display,
|
||||
'query' => drupal_get_destination(),
|
||||
),
|
||||
array(
|
||||
'title' => t('Export'),
|
||||
'alt' => t("Export this view"),
|
||||
'href' => "admin/build/views/export/$view->name",
|
||||
),
|
||||
array(
|
||||
'title' => t('Clone'),
|
||||
'alt' => t("Create a copy of this view"),
|
||||
'href' => "admin/build/views/clone/$view->name",
|
||||
),
|
||||
);
|
||||
|
||||
drupal_alter('views_admin_links', $vars['admin_links_raw'], $view);
|
||||
$vars['admin_links'] = theme('links', $vars['admin_links_raw']);
|
||||
}
|
||||
else {
|
||||
$vars['admin_links'] = '';
|
||||
$vars['admin_links_raw'] = array();
|
||||
}
|
||||
|
||||
// Our JavaScript needs to have some means to find the HTML belonging to this
|
||||
// view.
|
||||
//
|
||||
// It is true that the DIV wrapper has classes denoting the name of the view
|
||||
// and its display ID, but this is not enough to unequivocally match a view
|
||||
// with its HTML, because one view may appear several times on the page. So
|
||||
// we set up a running counter, $dom_id, to issue a "unique" identifier for
|
||||
// each view. This identifier is written to both Drupal.settings and the DIV
|
||||
// wrapper.
|
||||
static $dom_id = 1;
|
||||
$vars['dom_id'] = !empty($view->dom_id) ? $view->dom_id : $dom_id++;
|
||||
$vars['classes_array'][] = 'view-dom-id-' . $vars['dom_id'];
|
||||
|
||||
// If using AJAX, send identifying data about this view.
|
||||
if ($view->use_ajax) {
|
||||
$settings = array(
|
||||
'views' => array(
|
||||
'ajax_path' => url('views/ajax'),
|
||||
'ajaxViews' => array(
|
||||
array(
|
||||
'view_name' => $view->name,
|
||||
'view_display_id' => $view->current_display,
|
||||
'view_args' => check_plain(implode('/', $view->args)),
|
||||
'view_path' => check_plain($_GET['q']),
|
||||
// Pass through URL to ensure we get e.g. language prefixes.
|
||||
// 'view_base_path' => isset($view->display['page']) ? substr(url($view->display['page']->display_options['path']), strlen($base_path)) : '',
|
||||
'view_base_path' => $view->get_path(),
|
||||
'view_dom_id' => $vars['dom_id'],
|
||||
// To fit multiple views on a page, the programmer may have
|
||||
// overridden the display's pager_element.
|
||||
'pager_element' => $view->pager['element'],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
drupal_add_js($settings, 'setting');
|
||||
views_add_js('ajax_view');
|
||||
}
|
||||
// Flatten the classes to a string for the template file.
|
||||
$vars['classes'] = implode(' ', $vars['classes_array']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocess theme function to print a single record from a row, with fields
|
||||
*/
|
||||
function template_preprocess_views_view_fields(&$vars) {
|
||||
$view = $vars['view'];
|
||||
|
||||
// Loop through the fields for this view.
|
||||
$inline = FALSE;
|
||||
$vars['fields'] = array(); // ensure it's at least an empty array.
|
||||
foreach ($view->field as $id => $field) {
|
||||
// render this even if set to exclude so it can be used elsewhere.
|
||||
$field_output = $view->style_plugin->get_field($view->row_index, $id);
|
||||
$empty = $field_output !== 0 && empty($field_output);
|
||||
if (empty($field->options['exclude']) && (!$empty || (empty($field->options['hide_empty']) && empty($vars['options']['hide_empty'])))) {
|
||||
$object = new stdClass();
|
||||
|
||||
$object->content = $field_output;
|
||||
if (isset($view->field[$id]->field_alias) && isset($vars['row']->{$view->field[$id]->field_alias})) {
|
||||
$object->raw = $vars['row']->{$view->field[$id]->field_alias};
|
||||
}
|
||||
else {
|
||||
$object->raw = NULL; // make sure it exists to reduce NOTICE
|
||||
}
|
||||
$object->inline = !empty($vars['options']['inline'][$id]);
|
||||
$object->inline_html = $object->inline ? 'span' : 'div';
|
||||
if (!empty($vars['options']['separator']) && $inline && $object->inline && $object->content) {
|
||||
$object->separator = filter_xss_admin($vars['options']['separator']);
|
||||
}
|
||||
|
||||
$inline = $object->inline;
|
||||
|
||||
$object->handler = &$view->field[$id];
|
||||
$object->element_type = $object->handler->element_type();
|
||||
|
||||
$object->class = views_css_safe($id);
|
||||
$object->label = check_plain($view->field[$id]->label());
|
||||
$vars['fields'][$id] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a single views field.
|
||||
*
|
||||
* Interesting bits of info:
|
||||
* $field->field_alias says what the raw value in $row will be. Reach it like
|
||||
* this: @code { $row->{$field->field_alias} @endcode
|
||||
*/
|
||||
function theme_views_view_field($view, $field, $row) {
|
||||
// Reference safe for PHP 4:
|
||||
return $view->field[$field->options['id']]->advanced_render($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a single field within a view.
|
||||
*
|
||||
* This preprocess function isn't normally run, as a function is used by
|
||||
* default, for performance. However, by creating a template, this
|
||||
* preprocess should get picked up.
|
||||
*/
|
||||
function template_preprocess_views_view_field(&$vars) {
|
||||
$vars['output'] = $vars['field']->advanced_render($vars['row']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocess theme function to print a single record from a row, with fields
|
||||
*/
|
||||
function template_preprocess_views_view_summary(&$vars) {
|
||||
$view = $vars['view'];
|
||||
$argument = $view->argument[$view->build_info['summary_level']];
|
||||
|
||||
$url_options = array();
|
||||
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
$vars['classes'] = array();
|
||||
foreach ($vars['rows'] as $id => $row) {
|
||||
$vars['rows'][$id]->link = $argument->summary_name($row);
|
||||
$args = $view->args;
|
||||
$args[$argument->position] = $argument->summary_argument($row);
|
||||
|
||||
$base_path = NULL;
|
||||
if (!empty($argument->options['style_options']['base_path'])) {
|
||||
$base_path = $argument->options['style_options']['base_path'];
|
||||
}
|
||||
$vars['rows'][$id]->url = url($view->get_url($args, $base_path), $url_options);
|
||||
$vars['rows'][$id]->count = intval($row->{$argument->count_alias});
|
||||
if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) {
|
||||
$vars['classes'][$id] = 'active';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Template preprocess theme function to print summary basically
|
||||
* unformatted.
|
||||
*/
|
||||
function template_preprocess_views_view_summary_unformatted(&$vars) {
|
||||
$view = $vars['view'];
|
||||
$argument = $view->argument[$view->build_info['summary_level']];
|
||||
$vars['classes'] = array();
|
||||
|
||||
$url_options = array();
|
||||
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($vars['rows'] as $id => $row) {
|
||||
// only false on first time:
|
||||
if ($count++) {
|
||||
$vars['rows'][$id]->separator = filter_xss_admin($vars['options']['separator']);
|
||||
}
|
||||
$vars['rows'][$id]->link = $argument->summary_name($row);
|
||||
$args = $view->args;
|
||||
$args[$argument->position] = $argument->summary_argument($row);
|
||||
|
||||
$base_path = NULL;
|
||||
if (!empty($argument->options['style_options']['base_path'])) {
|
||||
$base_path = $argument->options['style_options']['base_path'];
|
||||
}
|
||||
$vars['rows'][$id]->url = url($view->get_url($args, $base_path), $url_options);
|
||||
$vars['rows'][$id]->count = intval($row->{$argument->count_alias});
|
||||
if ($vars['rows'][$id]->url == base_path() . $_GET['q'] || $vars['rows'][$id]->url == base_path() . drupal_get_path_alias($_GET['q'])) {
|
||||
$vars['classes'][$id] = 'active';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a view as a table style.
|
||||
*/
|
||||
function template_preprocess_views_view_table(&$vars) {
|
||||
$view = $vars['view'];
|
||||
|
||||
// We need the raw data for this grouping, which is passed in as $vars['rows'].
|
||||
// However, the template also needs to use for the rendered fields. We
|
||||
// therefore swap the raw data out to a new variable and reset $vars['rows']
|
||||
// so that it can get rebuilt.
|
||||
// Store rows so that they may be used by further preprocess functions.
|
||||
$result = $vars['result'] = $vars['rows'];
|
||||
$vars['rows'] = array();
|
||||
|
||||
$options = $view->style_plugin->options;
|
||||
$handler = $view->style_plugin;
|
||||
|
||||
$fields = &$view->field;
|
||||
$columns = $handler->sanitize_columns($options['columns'], $fields);
|
||||
|
||||
$active = !empty($handler->active) ? $handler->active : '';
|
||||
$order = !empty($handler->order) ? $handler->order : 'asc';
|
||||
|
||||
parse_str(tablesort_get_querystring(), $query);
|
||||
if (isset($view->exposed_raw_input)) {
|
||||
$query += $view->exposed_raw_input;
|
||||
}
|
||||
$query = empty($query) ? '' : '&' . http_build_query($query, '', '&');
|
||||
|
||||
$header = array();
|
||||
|
||||
// Fields must be rendered in order as of Views 2.3, so we will pre-render
|
||||
// everything.
|
||||
$renders = $handler->render_fields($result);
|
||||
|
||||
foreach ($columns as $field => $column) {
|
||||
// render the header labels
|
||||
if ($field == $column && empty($fields[$field]->options['exclude'])) {
|
||||
$label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
|
||||
if (empty($options['info'][$field]['sortable']) || !$fields[$field]->click_sortable()) {
|
||||
$vars['header'][$field] = $label;
|
||||
}
|
||||
else {
|
||||
// @todo -- make this a setting
|
||||
$initial = 'asc';
|
||||
|
||||
if ($active == $field && $order == 'asc') {
|
||||
$initial = 'desc';
|
||||
}
|
||||
|
||||
$title = t('sort by @s', array('@s' => $label));
|
||||
if ($active == $field) {
|
||||
$label .= theme('tablesort_indicator', $initial);
|
||||
}
|
||||
$link_options = array(
|
||||
'html' => true,
|
||||
'attributes' => array('title' => $title),
|
||||
'query' => 'order=' . urlencode($field) . '&sort=' . $initial . $query,
|
||||
);
|
||||
$vars['header'][$field] = l($label, $_GET['q'], $link_options);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a second variable so we can easily find what fields we have and what the
|
||||
// CSS classes should be.
|
||||
$vars['fields'][$field] = views_css_safe($field);
|
||||
if ($active == $field) {
|
||||
$vars['fields'][$field] .= ' active';
|
||||
}
|
||||
|
||||
// Render each field into its appropriate column.
|
||||
foreach ($result as $num => $row) {
|
||||
if (!empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
|
||||
$field_output = $renders[$num][$field];
|
||||
|
||||
if (!isset($vars['rows'][$num][$column])) {
|
||||
$vars['rows'][$num][$column] = '';
|
||||
}
|
||||
|
||||
// Don't bother with separators and stuff if the field does not show up.
|
||||
if ($field_output === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Place the field into the column, along with an optional separator.
|
||||
if ($vars['rows'][$num][$column] !== '') {
|
||||
if (!empty($options['info'][$column]['separator'])) {
|
||||
$vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
|
||||
}
|
||||
}
|
||||
|
||||
$vars['rows'][$num][$column] .= $field_output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($vars['rows'] as $num => $row) {
|
||||
$vars['row_classes'][$num][] = ($count++ % 2 == 0) ? 'odd' : 'even';
|
||||
}
|
||||
|
||||
$vars['row_classes'][0][] = 'views-row-first';
|
||||
$vars['row_classes'][count($vars['row_classes']) - 1][] = 'views-row-last';
|
||||
|
||||
$vars['class'] = 'views-table';
|
||||
if (!empty($options['sticky'])) {
|
||||
drupal_add_js('misc/tableheader.js');
|
||||
$vars['class'] .= " sticky-enabled";
|
||||
}
|
||||
$vars['class'] .= ' cols-' . count($vars['header']);
|
||||
|
||||
$vars['attributes'] = '';
|
||||
if (!empty($handler->options['summary'])) {
|
||||
$vars['attributes'] = drupal_attributes(array('summary' => $handler->options['summary']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a view as a grid style.
|
||||
*/
|
||||
function template_preprocess_views_view_grid(&$vars) {
|
||||
$view = $vars['view'];
|
||||
$result = $view->result;
|
||||
$options = $view->style_plugin->options;
|
||||
$handler = $view->style_plugin;
|
||||
|
||||
$columns = $options['columns'];
|
||||
|
||||
$rows = array();
|
||||
|
||||
if ($options['alignment'] == 'horizontal') {
|
||||
$row = array();
|
||||
$row_count = 0;
|
||||
foreach ($vars['rows'] as $count => $item) {
|
||||
$row[] = $item;
|
||||
$row_count++;
|
||||
if (($count + 1) % $columns == 0) {
|
||||
$rows[] = $row;
|
||||
$row = array();
|
||||
$row_count = 0;
|
||||
}
|
||||
}
|
||||
if ($row) {
|
||||
// Fill up the last line only if it's configured, but this is default.
|
||||
if (!empty($handler->options['fill_single_line']) || count($rows)) {
|
||||
for ($i = 0; $i < ($columns - $row_count); $i++) {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$num_rows = floor(count($vars['rows']) / $columns);
|
||||
// The remainders are the 'odd' columns that are slightly longer.
|
||||
$remainders = count($vars['rows']) % $columns;
|
||||
$row = 0;
|
||||
$col = 0;
|
||||
foreach ($vars['rows'] as $count => $item) {
|
||||
$rows[$row][$col] = $item;
|
||||
$row++;
|
||||
|
||||
if (!$remainders && $row == $num_rows) {
|
||||
$row = 0;
|
||||
$col++;
|
||||
}
|
||||
else if ($remainders && $row == $num_rows + 1) {
|
||||
$row = 0;
|
||||
$col++;
|
||||
$remainders--;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($rows[0]); $i++) {
|
||||
// This should be string so that's okay :)
|
||||
if (!isset($rows[count($rows) - 1][$i])) {
|
||||
$rows[count($rows) - 1][$i] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add first/last column class
|
||||
foreach ($rows as $row_number => $row) {
|
||||
foreach ($row as $column_number => $column) {
|
||||
$column_classes[$row_number][$column_number] = 'col-' . ($column_number + 1);
|
||||
if ($column_number == 0) {
|
||||
$column_classes[$row_number][$column_number] .= ' col-first';
|
||||
}
|
||||
elseif (count($rows[$row_number]) == ($column_number + 1)) {
|
||||
$column_classes[$row_number][$column_number] .= ' col-last';
|
||||
}
|
||||
}
|
||||
}
|
||||
$vars['column_classes'] = $column_classes;
|
||||
$vars['rows'] = $rows;
|
||||
$vars['class'] = 'views-view-grid col-' . $columns;
|
||||
$vars['attributes'] = '';
|
||||
if (!empty($handler->options['summary'])) {
|
||||
$vars['attributes'] = drupal_attributes(array('summary' => $handler->options['summary']));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the simple view of rows one after another
|
||||
*/
|
||||
function template_preprocess_views_view_unformatted(&$vars) {
|
||||
$view = $vars['view'];
|
||||
$rows = $vars['rows'];
|
||||
|
||||
$vars['classes'] = array();
|
||||
// Set up striping values.
|
||||
foreach ($rows as $id => $row) {
|
||||
$row_classes = array();
|
||||
$row_classes[] = 'views-row';
|
||||
$row_classes[] = 'views-row-' . ($id + 1);
|
||||
$row_classes[] = 'views-row-' . ($id % 2 ? 'even' : 'odd');
|
||||
if ($id == 0) {
|
||||
$row_classes[] = 'views-row-first';
|
||||
}
|
||||
if ($id == count($rows) -1) {
|
||||
$row_classes[] = 'views-row-last';
|
||||
}
|
||||
// Flatten the classes to a string for each row for the template file.
|
||||
$vars['classes'][$id] = implode(' ', $row_classes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the view as an HTML list element
|
||||
*/
|
||||
function template_preprocess_views_view_list(&$vars) {
|
||||
template_preprocess_views_view_unformatted($vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preprocess an RSS feed
|
||||
*/
|
||||
function template_preprocess_views_view_rss(&$vars) {
|
||||
global $base_url;
|
||||
global $language;
|
||||
|
||||
$view = &$vars['view'];
|
||||
$options = &$vars['options'];
|
||||
$items = &$vars['rows'];
|
||||
|
||||
$style = &$view->style_plugin;
|
||||
|
||||
if (!empty($options['mission_description'])) {
|
||||
$description = variable_get('site_mission', '');
|
||||
}
|
||||
else {
|
||||
$description = $options['description'];
|
||||
}
|
||||
// The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
|
||||
// We strip all HTML tags, but need to prevent double encoding from properly
|
||||
// escaped source data (such as & becoming &amp;).
|
||||
$vars['description'] = check_plain(decode_entities(strip_tags($description)));
|
||||
|
||||
if ($view->display_handler->get_option('sitename_title')) {
|
||||
$title = variable_get('site_name', 'Drupal');
|
||||
if ($slogan = variable_get('site_slogan', '')) {
|
||||
$title .= ' - ' . $slogan;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$title = $view->get_title();
|
||||
}
|
||||
$vars['title'] = check_plain($title);
|
||||
|
||||
// Figure out which display which has a path we're using for this feed. If there isn't
|
||||
// one, use the global $base_url
|
||||
$link_display_id = $view->display_handler->get_link_display();
|
||||
if ($link_display_id && !empty($view->display[$link_display_id])) {
|
||||
$path = $view->display[$link_display_id]->handler->get_path();
|
||||
}
|
||||
|
||||
if ($path) {
|
||||
$path = $view->get_url(NULL, $path);
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (!empty($view->exposed_raw_input)) {
|
||||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
||||
// Compare the link to the default home page; if it's the default home page, just use $base_url.
|
||||
if ($path == variable_get('site_frontpage', 'node')) {
|
||||
$path = '';
|
||||
}
|
||||
|
||||
$vars['link'] = check_url(url($path, $url_options));
|
||||
}
|
||||
|
||||
$vars['langcode'] = check_plain($language->language);
|
||||
$vars['namespaces'] = drupal_attributes($style->namespaces);
|
||||
$vars['items'] = $items;
|
||||
$vars['channel_elements'] = format_xml_elements($style->channel_elements);
|
||||
|
||||
drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Default theme function for all RSS rows.
|
||||
*/
|
||||
function template_preprocess_views_view_row_rss(&$vars) {
|
||||
$view = &$vars['view'];
|
||||
$options = &$vars['options'];
|
||||
$item = &$vars['row'];
|
||||
|
||||
$vars['title'] = check_plain($item->title);
|
||||
$vars['link'] = check_url($item->link);
|
||||
$vars['description'] = check_plain($item->description);
|
||||
$vars['item_elements'] = empty($item->elements) ? '' : format_xml_elements($item->elements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default theme function for all filter forms.
|
||||
*/
|
||||
function template_preprocess_views_exposed_form(&$vars) {
|
||||
$form = &$vars['form'];
|
||||
|
||||
// Put all single checkboxes together in the last spot.
|
||||
$checkboxes = '';
|
||||
|
||||
if (!empty($form['q'])) {
|
||||
$vars['q'] = drupal_render($form['q']);
|
||||
}
|
||||
|
||||
$vars['widgets'] = array();
|
||||
foreach ($form['#info'] as $id => $info) {
|
||||
// Set aside checkboxes.
|
||||
if (isset($form[$info['value']]['#type']) && $form[$info['value']]['#type'] == 'checkbox') {
|
||||
$checkboxes .= drupal_render($form[$info['value']]);
|
||||
continue;
|
||||
}
|
||||
$widget = new stdClass;
|
||||
// set up defaults so that there's always something there.
|
||||
$widget->label = $widget->operator = $widget->widget = NULL;
|
||||
|
||||
$widget->id = $form[$info['value']]['#id'];
|
||||
if (!empty($info['label'])) {
|
||||
$widget->label = $info['label'];
|
||||
}
|
||||
if (!empty($info['operator'])) {
|
||||
$widget->operator = drupal_render($form[$info['operator']]);
|
||||
}
|
||||
$widget->widget = drupal_render($form[$info['value']]);
|
||||
$vars['widgets'][$id] = $widget;
|
||||
}
|
||||
|
||||
// Wrap up all the checkboxes we set aside into a widget.
|
||||
if ($checkboxes) {
|
||||
$widget = new stdClass;
|
||||
// set up defaults so that there's always something there.
|
||||
$widget->label = $widget->operator = $widget->widget = NULL;
|
||||
$widget->widget = $checkboxes;
|
||||
$vars['widgets']['checkboxes'] = $widget;
|
||||
}
|
||||
|
||||
// Don't render these:
|
||||
unset($form['form_id']);
|
||||
unset($form['form_build_id']);
|
||||
unset($form['form_token']);
|
||||
|
||||
// This includes the submit button.
|
||||
$vars['button'] = drupal_render($form);
|
||||
}
|
||||
|
||||
function theme_views_mini_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
|
||||
global $pager_page_array, $pager_total;
|
||||
|
||||
// Calculate various markers within this pager piece:
|
||||
// Middle is used to "center" pages around the current page.
|
||||
$pager_middle = ceil($quantity / 2);
|
||||
// current is the page we are currently paged to
|
||||
$pager_current = $pager_page_array[$element] + 1;
|
||||
// max is the maximum page number
|
||||
$pager_max = $pager_total[$element];
|
||||
// End of marker calculations.
|
||||
|
||||
|
||||
$li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹‹')), $limit, $element, 1, $parameters);
|
||||
if (empty($li_previous)) {
|
||||
$li_previous = " ";
|
||||
}
|
||||
|
||||
$li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('››')), $limit, $element, 1, $parameters);
|
||||
if (empty($li_next)) {
|
||||
$li_next = " ";
|
||||
}
|
||||
|
||||
if ($pager_total[$element] > 1) {
|
||||
$items[] = array(
|
||||
'class' => 'pager-previous',
|
||||
'data' => $li_previous,
|
||||
);
|
||||
|
||||
$items[] = array(
|
||||
'class' => 'pager-current',
|
||||
'data' => t('@current of @max', array('@current' => $pager_current, '@max' => $pager_max)),
|
||||
);
|
||||
|
||||
$items[] = array(
|
||||
'class' => 'pager-next',
|
||||
'data' => $li_next,
|
||||
);
|
||||
return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @defgroup views_templates Views' template files
|
||||
* @{
|
||||
* All views templates can be overridden with a variety of names, using
|
||||
* the view, the display ID of the view, the display type of the view,
|
||||
* or some combination thereof.
|
||||
*
|
||||
* For each view, there will be a minimum of two templates used. The first
|
||||
* is used for all views: views-view.tpl.php.
|
||||
*
|
||||
* The second template is determined by the style selected for the view. Note
|
||||
* that certain aspects of the view can also change which style is used; for
|
||||
* example, arguments which provide a summary view might change the style to
|
||||
* one of the special summary styles.
|
||||
*
|
||||
* The default style for all views is views-view-unformatted.tpl.php
|
||||
*
|
||||
* Many styles will then farm out the actual display of each row to a row
|
||||
* style; the default row style is views-view-fields.tpl.php.
|
||||
*
|
||||
* Here is an example of all the templates that will be tried in the following
|
||||
* case:
|
||||
*
|
||||
* View, named foobar. Style: unformatted. Row style: Fields. Display: Page.
|
||||
*
|
||||
* - views-view--foobar--page.tpl.php
|
||||
* - views-view--page.tpl.php
|
||||
* - views-view--foobar.tpl.php
|
||||
* - views-view.tpl.php
|
||||
*
|
||||
* - views-view-unformatted--foobar--page.tpl.php
|
||||
* - views-view-unformatted--page.tpl.php
|
||||
* - views-view-unformatted--foobar.tpl.php
|
||||
* - views-view-unformatted.tpl.php
|
||||
*
|
||||
* - views-view-fields--foobar--page.tpl.php
|
||||
* - views-view-fields--page.tpl.php
|
||||
* - views-view-fields--foobar.tpl.php
|
||||
* - views-view-fields.tpl.php
|
||||
*
|
||||
* Important! When adding a new template to your theme, be sure to flush the
|
||||
* theme registry cache!
|
||||
*
|
||||
* @see _views_theme_functions
|
||||
* @}
|
||||
*/
|
47
modules/views/theme/views-exposed-form.tpl.php
Normal file
47
modules/views/theme/views-exposed-form.tpl.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-exposed-form.tpl.php
|
||||
*
|
||||
* This template handles the layout of the views exposed filter form.
|
||||
*
|
||||
* Variables available:
|
||||
* - $widgets: An array of exposed form widgets. Each widget contains:
|
||||
* - $widget->label: The visible label to print. May be optional.
|
||||
* - $widget->operator: The operator for the widget. May be optional.
|
||||
* - $widget->widget: The widget itself.
|
||||
* - $button: The submit button for the form.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php if (!empty($q)): ?>
|
||||
<?php
|
||||
// This ensures that, if clean URLs are off, the 'q' is added first so that
|
||||
// it shows up first in the URL.
|
||||
print $q;
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<div class="views-exposed-form">
|
||||
<div class="views-exposed-widgets clear-block">
|
||||
<?php foreach ($widgets as $id => $widget): ?>
|
||||
<div class="views-exposed-widget views-widget-<?php print $id; ?>">
|
||||
<?php if (!empty($widget->label)): ?>
|
||||
<label for="<?php print $widget->id; ?>">
|
||||
<?php print $widget->label; ?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($widget->operator)): ?>
|
||||
<div class="views-operator">
|
||||
<?php print $widget->operator; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="views-widget">
|
||||
<?php print $widget->widget; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="views-exposed-widget views-submit-button">
|
||||
<?php print $button; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
16
modules/views/theme/views-more.tpl.php
Normal file
16
modules/views/theme/views-more.tpl.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-more.tpl.php
|
||||
* Theme the more link
|
||||
*
|
||||
* - $more_url: the url for the more link
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="more-link">
|
||||
<a href="<?php print $more_url ?>">
|
||||
<?php print $link_text; ?>
|
||||
</a>
|
||||
</div>
|
45
modules/views/theme/views-ui-edit-item.tpl.php
Normal file
45
modules/views/theme/views-ui-edit-item.tpl.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-ui-edit-item.tpl.php
|
||||
*
|
||||
* This template handles the printing of fields/filters/sort criteria/arguments or relationships.
|
||||
*/
|
||||
?>
|
||||
<?php print $rearrange; ?>
|
||||
<?php print $add; ?>
|
||||
<div class="views-category-title<?php
|
||||
if ($overridden) {
|
||||
print ' overridden';
|
||||
}
|
||||
if ($defaulted) {
|
||||
print ' defaulted';
|
||||
}
|
||||
?>">
|
||||
<?php print $item_help_icon; ?>
|
||||
<?php print $title; ?>
|
||||
</div>
|
||||
|
||||
<div class="views-category-content<?php
|
||||
if ($overridden) {
|
||||
print ' overridden';
|
||||
}
|
||||
if ($defaulted) {
|
||||
print ' defaulted';
|
||||
}
|
||||
?>">
|
||||
<?php if (!empty($no_fields)): ?>
|
||||
<div><?php print t('The style selected does not utilize fields.'); ?></div>
|
||||
<?php elseif (empty($fields)): ?>
|
||||
<div><?php print t('None defined'); ?></div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($fields as $pid => $field): ?>
|
||||
<?php if (!empty($field['links'])): ?>
|
||||
<?php print $field['links']; ?>
|
||||
<?php endif; ?>
|
||||
<div class="<?php print $field['class']; if (!empty($field['changed'])) { print ' changed'; } ?>">
|
||||
<?php print $field['title']; ?>
|
||||
<?php print $field['info']; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
98
modules/views/theme/views-ui-edit-tab.tpl.php
Normal file
98
modules/views/theme/views-ui-edit-tab.tpl.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-ui-edit-tab.tpl.php
|
||||
* Template for the primary view editing window.
|
||||
*/
|
||||
?>
|
||||
<div class="clear-block views-display views-display-<?php print $display->id; if (!empty($display->deleted)) { print ' views-display-deleted'; }; ?>">
|
||||
<?php // top section ?>
|
||||
<?php if ($remove): ?>
|
||||
<div class="remove-display"><?php print $remove ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($clone): ?>
|
||||
<div class="clone-display"><?php print $clone ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="top">
|
||||
<div class="inside">
|
||||
<?php print $display_help_icon; ?>
|
||||
<span class="display-title">
|
||||
<?php print $title; ?>
|
||||
</span>
|
||||
<span class="display-description">
|
||||
<?php print $description; ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php // left section ?>
|
||||
<div class="left tab-section">
|
||||
<div class="inside">
|
||||
<?php // If this is the default display, add some basic stuff here. ?>
|
||||
<?php if ($default): ?>
|
||||
<div class="views-category">
|
||||
<div class="views-category-title"><?php print t('View settings'); ?></div>
|
||||
<div class="views-category-content">
|
||||
<div class="<?php $details_class; if (!empty($details_changed)) { print ' changed'; }?>">
|
||||
<?php print $details ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($categories as $category_id => $category): ?>
|
||||
<div class="views-category">
|
||||
<div class="views-category-title views-category-<?php print $category_id; ?>">
|
||||
<?php print $category['title']; ?>
|
||||
</div>
|
||||
<div class="views-category-content">
|
||||
<?php foreach ($category['data'] as $data): ?>
|
||||
<div class="<?php
|
||||
print $data['class'];
|
||||
if (!empty($data['overridden'])) {
|
||||
print ' overridden';
|
||||
}
|
||||
if (!empty($data['defaulted'])) {
|
||||
print ' defaulted';
|
||||
}
|
||||
if (!empty($data['changed'])) {
|
||||
print ' changed';
|
||||
}?>">
|
||||
<?php print $data['links'] . $data['content'] ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php // middle section ?>
|
||||
<div class="middle tab-section">
|
||||
<div class="inside">
|
||||
<div class="views-category">
|
||||
<?php print $relationships; ?>
|
||||
</div>
|
||||
<div class="views-category">
|
||||
<?php print $arguments; ?>
|
||||
</div>
|
||||
<?php if (!empty($fields)): ?>
|
||||
<div class="views-category">
|
||||
<?php print $fields; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php // right section ?>
|
||||
<div class="right tab-section">
|
||||
<div class="inside">
|
||||
<div class="views-category">
|
||||
<?php print $sorts; ?>
|
||||
</div>
|
||||
<div class="views-category">
|
||||
<?php print $filters; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
45
modules/views/theme/views-ui-edit-view.tpl.php
Normal file
45
modules/views/theme/views-ui-edit-view.tpl.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-ui-edit-view.tpl.php
|
||||
* Template for the primary view editing window.
|
||||
*/
|
||||
?>
|
||||
<div class="views-edit-view">
|
||||
<?php if ($locked): ?>
|
||||
<div class="view-locked">
|
||||
<?php print t('This view is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', array('!user' => $locked, '!age' => $lock_age, '!break' => $break)); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="views-basic-info clear-block<?php if (!empty($view->changed)) { print " changed"; }?>">
|
||||
<?php if (!is_numeric($view->vid)): ?>
|
||||
<div class="view-changed view-new"><?php print t('New view'); ?></div>
|
||||
<?php else: ?>
|
||||
<div class="view-changed"><?php print t('Changed view'); ?></div>
|
||||
<?php endif; ?>
|
||||
<div class="views-quick-links">
|
||||
<?php print $quick_links ?>
|
||||
</div>
|
||||
<?php print t('View %name, displaying items of type <strong>@base</strong>.',
|
||||
array('%name' => $view->name, '@base' => $base_table)); ?>
|
||||
</div>
|
||||
|
||||
<?php print $tabs; ?>
|
||||
|
||||
<div id="views-ajax-form">
|
||||
<div id="views-ajax-title">
|
||||
<?php // This is initially empty ?>
|
||||
</div>
|
||||
<div id="views-ajax-pad">
|
||||
<?php /* This is sent in because it is also sent out through settings and
|
||||
needs to be consistent. */ ?>
|
||||
<?php print $message; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php print $save_button ?>
|
||||
|
||||
<h2><?php print t('Live preview'); ?></h2>
|
||||
<div id='views-live-preview'>
|
||||
<?php print $preview ?>
|
||||
</div>
|
||||
</div>
|
41
modules/views/theme/views-ui-list-views.tpl.php
Normal file
41
modules/views/theme/views-ui-list-views.tpl.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Displays the list of views on the administration screen.
|
||||
*/
|
||||
?>
|
||||
<p><?php print $help; ?></p>
|
||||
<?php print $widgets; ?>
|
||||
<?php foreach ($views as $view): ?>
|
||||
<table class="views-entry <?php print $view->classes; ?>">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="view-name">
|
||||
<?php print $help_type_icon; ?>
|
||||
<?php print t('<em>@type</em> @base view: <strong>@view</strong>', array('@type' => $view->type, '@view' => $view->name, '@base' => $view->base)); ?>
|
||||
<?php if (!empty($view->tag)): ?>
|
||||
(<?php print $view->tag; ?>)
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="view-ops"><?php print $view->ops ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($view->title): ?>
|
||||
<?php print t('Title: @title', array('@title' => $view->title)); ?> <br />
|
||||
<?php endif; ?>
|
||||
<?php if ($view->path): ?>
|
||||
<?php print t('Path: !path', array('!path' => $view->path)); ?> <br />
|
||||
<?php endif; ?>
|
||||
<?php if ($view->displays): ?>
|
||||
<em><?php print $view->displays; ?> </em><br />
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td colspan="2" class="description">
|
||||
<?php print $view->description; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endforeach; ?>
|
22
modules/views/theme/views-view-field.tpl.php
Normal file
22
modules/views/theme/views-view-field.tpl.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* This template is used to print a single field in a view. It is not
|
||||
* actually used in default Views, as this is registered as a theme
|
||||
* function which has better performance. For single overrides, the
|
||||
* template is perfectly okay.
|
||||
*
|
||||
* Variables available:
|
||||
* - $view: The view object
|
||||
* - $field: The field handler object that can process the input
|
||||
* - $row: The raw SQL result that can be used
|
||||
* - $output: The processed output that will normally be used.
|
||||
*
|
||||
* When fetching output from the $row, this construct should be used:
|
||||
* $data = $row->{$field->field_alias}
|
||||
*
|
||||
* The above will guarantee that you'll always get the correct data,
|
||||
* regardless of any changes in the aliasing that might happen if
|
||||
* the view is modified.
|
||||
*/
|
||||
?>
|
||||
<?php print $output; ?>
|
38
modules/views/theme/views-view-fields.tpl.php
Normal file
38
modules/views/theme/views-view-fields.tpl.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-fields.tpl.php
|
||||
* Default simple view template to all the fields as a row.
|
||||
*
|
||||
* - $view: The view in use.
|
||||
* - $fields: an array of $field objects. Each one contains:
|
||||
* - $field->content: The output of the field.
|
||||
* - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
|
||||
* - $field->class: The safe class id to use.
|
||||
* - $field->handler: The Views field handler object controlling this field. Do not use
|
||||
* var_export to dump this object, as it can't handle the recursion.
|
||||
* - $field->inline: Whether or not the field should be inline.
|
||||
* - $field->inline_html: either div or span based on the above flag.
|
||||
* - $field->separator: an optional separator that may appear before a field.
|
||||
* - $row: The raw result object from the query, with all data it fetched.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($fields as $id => $field): ?>
|
||||
<?php if (!empty($field->separator)): ?>
|
||||
<?php print $field->separator; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<<?php print $field->inline_html;?> class="views-field-<?php print $field->class; ?>">
|
||||
<?php if ($field->label): ?>
|
||||
<label class="views-label-<?php print $field->class; ?>">
|
||||
<?php print $field->label; ?>:
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
// $field->element_type is either SPAN or DIV depending upon whether or not
|
||||
// the field is a 'block' element type or 'inline' element type.
|
||||
?>
|
||||
<<?php print $field->element_type; ?> class="field-content"><?php print $field->content; ?></<?php print $field->element_type; ?>>
|
||||
</<?php print $field->inline_html;?>>
|
||||
<?php endforeach; ?>
|
37
modules/views/theme/views-view-grid.tpl.php
Normal file
37
modules/views/theme/views-view-grid.tpl.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-grid.tpl.php
|
||||
* Default simple view template to display a rows in a grid.
|
||||
*
|
||||
* - $rows contains a nested array of rows. Each row contains an array of
|
||||
* columns.
|
||||
* - $class contains the class of the table.
|
||||
* - $attributes contains other attributes for the table.
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php if (!empty($title)) : ?>
|
||||
<h3><?php print $title; ?></h3>
|
||||
<?php endif; ?>
|
||||
<table class="<?php print $class; ?>"<?php print $attributes; ?>>
|
||||
<tbody>
|
||||
<?php foreach ($rows as $row_number => $columns): ?>
|
||||
<?php
|
||||
$row_class = 'row-' . ($row_number + 1);
|
||||
if ($row_number == 0) {
|
||||
$row_class .= ' row-first';
|
||||
}
|
||||
if (count($rows) == ($row_number + 1)) {
|
||||
$row_class .= ' row-last';
|
||||
}
|
||||
?>
|
||||
<tr class="<?php print $row_class; ?>">
|
||||
<?php foreach ($columns as $column_number => $item): ?>
|
||||
<td class="<?php print $column_classes[$row_number][$column_number]; ?>">
|
||||
<?php print $item; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
20
modules/views/theme/views-view-list.tpl.php
Normal file
20
modules/views/theme/views-view-list.tpl.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-list.tpl.php
|
||||
* Default simple view template to display a list of rows.
|
||||
*
|
||||
* - $title : The title of this group of rows. May be empty.
|
||||
* - $options['type'] will either be ul or ol.
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<div class="item-list">
|
||||
<?php if (!empty($title)) : ?>
|
||||
<h3><?php print $title; ?></h3>
|
||||
<?php endif; ?>
|
||||
<<?php print $options['type']; ?>>
|
||||
<?php foreach ($rows as $id => $row): ?>
|
||||
<li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</<?php print $options['type']; ?>>
|
||||
</div>
|
17
modules/views/theme/views-view-row-comment.tpl.php
Normal file
17
modules/views/theme/views-view-row-comment.tpl.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-row-comment.tpl.php
|
||||
* Default simple view template to display a single comment.
|
||||
*
|
||||
* Rather than doing anything with this particular template, it is more
|
||||
* efficient to use a variant of the comment.tpl.php based upon the view,
|
||||
* which will be named comment-view-VIEWNAME.tpl.php. This isn't actually
|
||||
* a views template, which is why it's not used here, but is a template
|
||||
* 'suggestion' given to the comment template, and is used exactly
|
||||
* the same as any other variant of the comment template file, such as
|
||||
* node-nodeTYPE.tpl.php
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php print $comment; ?>
|
20
modules/views/theme/views-view-row-node.tpl.php
Normal file
20
modules/views/theme/views-view-row-node.tpl.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-row-node.tpl.php
|
||||
* Default simple view template to display a single node.
|
||||
*
|
||||
* Rather than doing anything with this particular template, it is more
|
||||
* efficient to use a variant of the node.tpl.php based upon the view,
|
||||
* which will be named node-view-VIEWNAME.tpl.php. This isn't actually
|
||||
* a views template, which is why it's not used here, but is a template
|
||||
* 'suggestion' given to the node template, and is used exactly
|
||||
* the same as any other variant of the node template file, such as
|
||||
* node-NODETYPE.tpl.php
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php print $node; ?>
|
||||
<?php if ($comments): ?>
|
||||
<?php print $comments; ?>
|
||||
<?php endif; ?>
|
14
modules/views/theme/views-view-row-rss.tpl.php
Normal file
14
modules/views/theme/views-view-row-rss.tpl.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-row-rss.tpl.php
|
||||
* Default view template to display a item in an RSS feed.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<item>
|
||||
<title><?php print $title; ?></title>
|
||||
<link><?php print $link; ?></link>
|
||||
<description><?php print $description; ?></description>
|
||||
<?php print $item_elements; ?>
|
||||
</item>
|
19
modules/views/theme/views-view-rss.tpl.php
Normal file
19
modules/views/theme/views-view-rss.tpl.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-rss.tpl.php
|
||||
* Default template for feed displays that use the RSS style.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
|
||||
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>
|
||||
<channel>
|
||||
<title><?php print $title; ?></title>
|
||||
<link><?php print $link; ?></link>
|
||||
<description><?php print $description; ?></description>
|
||||
<language><?php print $langcode; ?></language>
|
||||
<?php print $channel_elements; ?>
|
||||
<?php print $items; ?>
|
||||
</channel>
|
||||
</rss>
|
19
modules/views/theme/views-view-summary-unformatted.tpl.php
Normal file
19
modules/views/theme/views-view-summary-unformatted.tpl.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-summary-unformatted.tpl.php
|
||||
* Default simple view template to display a group of summary lines
|
||||
*
|
||||
* This wraps items in a span if set to inline, or a div if not.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($rows as $id => $row): ?>
|
||||
<?php print (!empty($options['inline']) ? '<span' : '<div') . ' class="views-summary views-summary-unformatted">'; ?>
|
||||
<?php if (!empty($row->separator)) { print $row->separator; } ?>
|
||||
<a href="<?php print $row->url; ?>"<?php print !empty($classes[$id]) ? ' class="'. $classes[$id] .'"' : ''; ?>><?php print $row->link; ?></a>
|
||||
<?php if (!empty($options['count'])): ?>
|
||||
(<?php print $row->count; ?>)
|
||||
<?php endif; ?>
|
||||
<?php print !empty($options['inline']) ? '</span>' : '</div>'; ?>
|
||||
<?php endforeach; ?>
|
19
modules/views/theme/views-view-summary.tpl.php
Normal file
19
modules/views/theme/views-view-summary.tpl.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-summary.tpl.php
|
||||
* Default simple view template to display a list of summary lines
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<div class="item-list">
|
||||
<ul class="views-summary">
|
||||
<?php foreach ($rows as $id => $row): ?>
|
||||
<li><a href="<?php print $row->url; ?>"<?php print !empty($classes[$id]) ? ' class="'. $classes[$id] .'"' : ''; ?>><?php print $row->link; ?></a>
|
||||
<?php if (!empty($options['count'])): ?>
|
||||
(<?php print $row->count?>)
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
41
modules/views/theme/views-view-table.tpl.php
Normal file
41
modules/views/theme/views-view-table.tpl.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-table.tpl.php
|
||||
* Template to display a view as a table.
|
||||
*
|
||||
* - $title : The title of this group of rows. May be empty.
|
||||
* - $header: An array of header labels keyed by field id.
|
||||
* - $fields: An array of CSS IDs to use for each field id.
|
||||
* - $class: A class or classes to apply to the table, based on settings.
|
||||
* - $row_classes: An array of classes to apply to each row, indexed by row
|
||||
* number. This matches the index in $rows.
|
||||
* - $rows: An array of row items. Each row is an array of content.
|
||||
* $rows are keyed by row number, fields within rows are keyed by field ID.
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<table class="<?php print $class; ?>"<?php print $attributes; ?>>
|
||||
<?php if (!empty($title)) : ?>
|
||||
<caption><?php print $title; ?></caption>
|
||||
<?php endif; ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($header as $field => $label): ?>
|
||||
<th class="views-field views-field-<?php print $fields[$field]; ?>">
|
||||
<?php print $label; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($rows as $count => $row): ?>
|
||||
<tr class="<?php print implode(' ', $row_classes[$count]); ?>">
|
||||
<?php foreach ($row as $field => $content): ?>
|
||||
<td class="views-field views-field-<?php print $fields[$field]; ?>">
|
||||
<?php print $content; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
16
modules/views/theme/views-view-unformatted.tpl.php
Normal file
16
modules/views/theme/views-view-unformatted.tpl.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view-unformatted.tpl.php
|
||||
* Default simple view template to display a list of rows.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php if (!empty($title)): ?>
|
||||
<h3><?php print $title; ?></h3>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($rows as $id => $row): ?>
|
||||
<div class="<?php print $classes[$id]; ?>">
|
||||
<?php print $row; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
91
modules/views/theme/views-view.tpl.php
Normal file
91
modules/views/theme/views-view.tpl.php
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/**
|
||||
* @file views-view.tpl.php
|
||||
* Main view template
|
||||
*
|
||||
* Variables available:
|
||||
* - $classes_array: An array of classes determined in
|
||||
* template_preprocess_views_view(). Default classes are:
|
||||
* .view
|
||||
* .view-[css_name]
|
||||
* .view-id-[view_name]
|
||||
* .view-display-id-[display_name]
|
||||
* .view-dom-id-[dom_id]
|
||||
* - $classes: A string version of $classes_array for use in the class attribute
|
||||
* - $css_name: A css-safe version of the view name.
|
||||
* - $css_class: The user-specified classes names, if any
|
||||
* - $header: The view header
|
||||
* - $footer: The view footer
|
||||
* - $rows: The results of the view query, if any
|
||||
* - $empty: The empty text to display if the view is empty
|
||||
* - $pager: The pager next/prev links to display, if any
|
||||
* - $exposed: Exposed widget form/info to display
|
||||
* - $feed_icon: Feed icon to display, if any
|
||||
* - $more: A link to view more, if any
|
||||
* - $admin_links: A rendered list of administrative links
|
||||
* - $admin_links_raw: A list of administrative links suitable for theme('links')
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<div class="<?php print $classes; ?>">
|
||||
<?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">
|
||||
<?php print $exposed; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($attachment_before): ?>
|
||||
<div class="attachment attachment-before">
|
||||
<?php print $attachment_before; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($rows): ?>
|
||||
<div class="view-content">
|
||||
<?php print $rows; ?>
|
||||
</div>
|
||||
<?php elseif ($empty): ?>
|
||||
<div class="view-empty">
|
||||
<?php print $empty; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($pager): ?>
|
||||
<?php print $pager; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($attachment_after): ?>
|
||||
<div class="attachment attachment-after">
|
||||
<?php print $attachment_after; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($more): ?>
|
||||
<?php print $more; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($footer): ?>
|
||||
<div class="view-footer">
|
||||
<?php print $footer; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($feed_icon): ?>
|
||||
<div class="feed-icon">
|
||||
<?php print $feed_icon; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div> <?php /* class view */ ?>
|
Reference in a new issue