708 lines
23 KiB
PHP
708 lines
23 KiB
PHP
<?php
|
||
|
||
/**
|
||
* Returns HTML for a query pager.
|
||
*
|
||
* Menu callbacks that display paged query results should call theme('pager') to
|
||
* retrieve a pager control so that users can view other results. Format a list
|
||
* of nearby pages with additional query results.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - tags: An array of labels for the controls in the pager.
|
||
* - element: An optional integer to distinguish between multiple pagers on
|
||
* one page.
|
||
* - parameters: An associative array of query string parameters to append to
|
||
* the pager links.
|
||
* - quantity: The number of pages in the list.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_pager($variables) {
|
||
$tags = $variables['tags'];
|
||
$element = $variables['element'];
|
||
$parameters = $variables['parameters'];
|
||
$quantity = $variables['quantity'];
|
||
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;
|
||
// first is the first page listed by this pager piece (re quantity)
|
||
$pager_first = $pager_current - $pager_middle + 1;
|
||
// last is the last page listed by this pager piece (re quantity)
|
||
$pager_last = $pager_current + $quantity - $pager_middle;
|
||
// max is the maximum page number
|
||
$pager_max = $pager_total[$element];
|
||
// End of marker calculations.
|
||
|
||
// Prepare for generation loop.
|
||
$i = $pager_first;
|
||
if ($pager_last > $pager_max) {
|
||
// Adjust "center" if at end of query.
|
||
$i = $i + ($pager_max - $pager_last);
|
||
$pager_last = $pager_max;
|
||
}
|
||
if ($i <= 0) {
|
||
// Adjust "center" if at start of query.
|
||
$pager_last = $pager_last + (1 - $i);
|
||
$i = 1;
|
||
}
|
||
// End of generation loop preparation.
|
||
|
||
$li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('‹‹')), 'element' => $element, 'parameters' => $parameters));
|
||
$li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
|
||
$li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
|
||
$li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('››')), 'element' => $element, 'parameters' => $parameters));
|
||
|
||
if ($pager_total[$element] > 1) {
|
||
if ($li_first) {
|
||
$items[] = array(
|
||
'class' => array('pager-first'),
|
||
'data' => $li_first,
|
||
);
|
||
}
|
||
if ($li_previous) {
|
||
$items[] = array(
|
||
'class' => array('pager-previous'),
|
||
'data' => $li_previous,
|
||
);
|
||
}
|
||
|
||
// When there is more than one page, create the pager list.
|
||
if ($i != $pager_max) {
|
||
if ($i > 1) {
|
||
$items[] = array(
|
||
'class' => array('pager-ellipsis'),
|
||
'data' => '…',
|
||
);
|
||
}
|
||
// Now generate the actual pager piece.
|
||
for (; $i <= $pager_last && $i <= $pager_max; $i++) {
|
||
if ($i < $pager_current) {
|
||
$items[] = array(
|
||
'class' => array('pager-item'),
|
||
'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)),
|
||
);
|
||
}
|
||
if ($i == $pager_current) {
|
||
$items[] = array(
|
||
'class' => array('pager-current'),
|
||
'data' => $i,
|
||
);
|
||
}
|
||
if ($i > $pager_current) {
|
||
$items[] = array(
|
||
'class' => array('pager-item'),
|
||
'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)),
|
||
);
|
||
}
|
||
}
|
||
if ($i < $pager_max) {
|
||
$items[] = array(
|
||
'class' => array('pager-ellipsis'),
|
||
'data' => '…',
|
||
);
|
||
}
|
||
}
|
||
// End generation.
|
||
if ($li_next) {
|
||
$items[] = array(
|
||
'class' => array('pager-next'),
|
||
'data' => $li_next,
|
||
);
|
||
}
|
||
if ($li_last) {
|
||
$items[] = array(
|
||
'class' => array('pager-last'),
|
||
'data' => $li_last,
|
||
);
|
||
}
|
||
return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . theme('item_list', array(
|
||
'items' => $items,
|
||
'attributes' => array('class' => array('pager')),
|
||
));
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* Theme the loggedinblock that shows for logged-in users.
|
||
*/
|
||
function materiobasetheme_lt_loggedinblock($variables){
|
||
global $user;
|
||
// return theme('username', array('account' => $variables['account'], 'link_path'=>'user/'.$user->uid.'/edit')) .' | ' . l(t('Log out'), 'user/logout');
|
||
return l('<i class="fi-torso large"></i><span class="account">' . $user->mail . '</span> ', 'user/'.$user->uid.'/edit', array('html'=>true))
|
||
. l('<i class="fi-power"></i><span class="logout">' . t('Log out') . '</span>', 'user/logout', array('html' => true));
|
||
}
|
||
|
||
function materiobasetheme_links__locale_block(&$vars) {
|
||
global $language;
|
||
foreach ($vars['links'] as $lang => $link) {
|
||
$vars['links'][$lang]['title'] = $lang;
|
||
if($lang == $language->language)
|
||
unset($vars['link'][$lang]);
|
||
}
|
||
$content = theme_links($vars);
|
||
return $content;
|
||
}
|
||
|
||
/**
|
||
* Returns HTML for an image field formatter.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - item: Associative array of image data, which may include "uri", "alt",
|
||
* "width", "height", "title" and "attributes".
|
||
* - image_style: An optional image style.
|
||
* - path: An array containing the link 'path' and link 'options'.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_image_formatter($variables) {
|
||
// dsm($variables, 'image_formatter');
|
||
$item = $variables['item'];
|
||
$image = array(
|
||
'path' => $item['uri'],
|
||
);
|
||
|
||
if (array_key_exists('alt', $item)) {
|
||
$image['alt'] = $item['alt'];
|
||
}
|
||
|
||
if (isset($item['attributes'])) {
|
||
$image['attributes'] = $item['attributes'];
|
||
}
|
||
|
||
if (isset($item['width']) && isset($item['height'])) {
|
||
$image['width'] = $item['width'];
|
||
$image['height'] = $item['height'];
|
||
}
|
||
|
||
// Do not output an empty 'title' attribute.
|
||
if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
|
||
$image['title'] = $item['title'];
|
||
}
|
||
|
||
#added
|
||
if(isset($item['delta'])) {
|
||
$image['delta'] = $item['delta'];
|
||
}
|
||
|
||
if ($variables['image_style']) {
|
||
$image['style_name'] = $variables['image_style'];
|
||
$output = theme('image_style', $image);
|
||
}
|
||
else {
|
||
$output = theme('image', $image);
|
||
}
|
||
|
||
// The link path and link options are both optional, but for the options to be
|
||
// processed, the link path must at least be an empty string.
|
||
if (isset($variables['path']['path'])) {
|
||
$path = $variables['path']['path'];
|
||
$options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
|
||
// When displaying an image inside a link, the html option must be TRUE.
|
||
$options['html'] = TRUE;
|
||
$output = l($output, $path, $options);
|
||
}
|
||
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Returns HTML for an image using a specific image style.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - style_name: The name of the style to be used to alter the original image.
|
||
* - path: The path of the image file relative to the Drupal files directory.
|
||
* This function does not work with images outside the files directory nor
|
||
* with remotely hosted images. This should be in a format such as
|
||
* 'images/image.jpg', or using a stream wrapper such as
|
||
* 'public://images/image.jpg'.
|
||
* - width: The width of the source image (if known).
|
||
* - height: The height of the source image (if known).
|
||
* - alt: The alternative text for text-based browsers.
|
||
* - title: The title text is displayed when the image is hovered in some
|
||
* popular browsers.
|
||
* - attributes: Associative array of attributes to be placed in the img tag.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_image_style($variables) {
|
||
// dsm($variables, 'image_style');
|
||
// Determine the dimensions of the styled image.
|
||
$fig_dimensions = "";
|
||
if(isset($variables['width']) || $variables['height']){
|
||
$dimensions = array(
|
||
'width' => $variables['width'],
|
||
'height' => $variables['height'],
|
||
);
|
||
|
||
image_style_transform_dimensions($variables['style_name'], $dimensions);
|
||
|
||
$variables['width'] = $dimensions['width'];
|
||
$variables['height'] = $dimensions['height'];
|
||
|
||
$fig_dimensions = 'width:'.$dimensions['width'].'px;height:'.$dimensions['height'].'px;';
|
||
}
|
||
|
||
// Determine the url for the styled image.
|
||
$variables['path'] = image_style_url($variables['style_name'], $variables['path']);
|
||
|
||
if(!isset($variables['attributes']))
|
||
$variables['attributes'] = array();
|
||
|
||
if(!isset($variables['attributes']['class']))
|
||
$variables['attributes']['class'] = array();
|
||
|
||
# hide title and alt for non adherent users
|
||
global $user;
|
||
if(isset($user->roles[1]) || isset($user->roles[7])){
|
||
unset($variables['title']);
|
||
unset($variables['alt']);
|
||
}
|
||
|
||
$figure = '<figure style="'.$fig_dimensions.'" ' . (isset($variables['title']) ? 'title="'.$variables['title'].'"' : '') . '>';
|
||
// lazyload
|
||
$excluded_styles = array('pdf', 'card-bookmark', 'content_full', 'content_teaser', 'didactique_page', 'publications-home', 'publication-couv');
|
||
if(!in_array($variables['style_name'], $excluded_styles) && ( (isset($variables['delta']) && $variables['delta'] > 0) || !isset($variables['delta']) ) ){
|
||
|
||
// store the real path
|
||
$real_path = $variables['path'];
|
||
$variables['attributes']['data-original'] = file_create_url($real_path);
|
||
|
||
// add Class lazy for JS
|
||
$variables['attributes']['class'][] = "lazy";
|
||
|
||
// replace the image by a blank
|
||
$variables['path'] = drupal_get_path('theme', 'materiobasetheme') . '/img/blank.gif';
|
||
|
||
$figure .= theme('image', $variables);
|
||
|
||
}else{
|
||
# without lazyload
|
||
$figure .= theme('image', $variables);
|
||
}
|
||
$figure .= '</figure>';
|
||
|
||
return $figure;
|
||
}
|
||
|
||
/**
|
||
* Returns HTML for a list or nested list of items.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - items: An array of items to be displayed in the list. If an item is a
|
||
* string, then it is used as is. If an item is an array, then the "data"
|
||
* element of the array is used as the contents of the list item. If an item
|
||
* is an array with a "children" element, those children are displayed in a
|
||
* nested list. All other elements are treated as attributes of the list
|
||
* item element.
|
||
* - title: The title of the list.
|
||
* - type: The type of list to return (e.g. "ul", "ol").
|
||
* - attributes: The attributes applied to the list element.
|
||
*/
|
||
function materiobasetheme_item_list($variables) {
|
||
$items = $variables['items'];
|
||
$title = $variables['title'];
|
||
$type = $variables['type'];
|
||
$attributes = $variables['attributes'];
|
||
// Only output the list container and title, if there are any list items.
|
||
// Check to see whether the block title exists before adding a header.
|
||
// Empty headers are not semantic and present accessibility challenges.
|
||
$output = '';
|
||
if (isset($title) && $title !== '') {
|
||
$output .= '<div class="item-list">';
|
||
$output .= '<h3>' . $title . '</h3>';
|
||
}
|
||
|
||
if (!empty($items)) {
|
||
$output .= "<$type" . drupal_attributes($attributes) . '>';
|
||
$num_items = count($items);
|
||
foreach ($items as $i => $item) {
|
||
$attributes = array();
|
||
$children = array();
|
||
$data = '';
|
||
if (is_array($item)) {
|
||
foreach ($item as $key => $value) {
|
||
if ($key == 'data') {
|
||
$data = $value;
|
||
}
|
||
elseif ($key == 'children') {
|
||
$children = $value;
|
||
}
|
||
else {
|
||
$attributes[$key] = $value;
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
$data = $item;
|
||
}
|
||
if (count($children) > 0) {
|
||
// Render nested list.
|
||
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
|
||
}
|
||
if ($i == 0) {
|
||
$attributes['class'][] = 'first';
|
||
}
|
||
if ($i == $num_items - 1) {
|
||
$attributes['class'][] = 'last';
|
||
}
|
||
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
|
||
}
|
||
$output .= "</$type>";
|
||
}
|
||
if (isset($title) && $title !== '') {
|
||
$output .= '</div>';
|
||
}
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Returns HTML for a link to a file.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - file: A file object to which the link will be created.
|
||
* - icon_directory: (optional) A path to a directory of icons to be used for
|
||
* files. Defaults to the value of the "file_icon_directory" variable.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_file_link($variables) {
|
||
$file = $variables['file'];
|
||
$icon_directory = $variables['icon_directory'];
|
||
|
||
$url = file_create_url($file->uri);
|
||
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
|
||
|
||
// Set options as per anchor format described at
|
||
// http://microformats.org/wiki/file-format-examples
|
||
$options = array(
|
||
'attributes' => array(
|
||
'type' => $file->filemime . '; length=' . $file->filesize,
|
||
'target' => '_blank',
|
||
),
|
||
);
|
||
|
||
// Use the description as the link text if available.
|
||
if (empty($file->description)) {
|
||
$link_text = $file->filename;
|
||
}
|
||
else {
|
||
$link_text = $file->description;
|
||
$options['attributes']['title'] = check_plain($file->filename);
|
||
}
|
||
|
||
return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
|
||
}
|
||
|
||
|
||
/**
|
||
* Implements hook_form_alter().
|
||
*/
|
||
function materiobasetheme_form_alter(&$form, &$form_state, $form_id) {
|
||
// dsm($form_id, 'form_id');
|
||
if($form_id == "user_login_block"){
|
||
// dsm($form, 'form');
|
||
unset($form['links']);
|
||
// $items = array();
|
||
|
||
$newpass = l(t('Lost my password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
|
||
$form['newpass'] = array(
|
||
'#prefix' => '<div class="newpass">',
|
||
'#markup' => $newpass,
|
||
'#suffix' => '</div>',
|
||
);
|
||
|
||
// if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
|
||
// $form['actions']['#weight'] = 10;
|
||
// $register = l(t('Get a free account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
|
||
// $form['register'] = array(
|
||
// '#prefix' => '<div class="register">',
|
||
// '#markup' => $register,
|
||
// '#suffix' => '</div>',
|
||
// '#weight' => 15,
|
||
// );
|
||
// }
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Implements hook_block_view_alter().
|
||
*/
|
||
function materiobasetheme_block_view_alter(&$data, $block) {
|
||
// dsm($block, 'block');
|
||
if ($block->module == 'menu' && $block->delta == 'menu-top-menu') {
|
||
// dsm($block, 'block');
|
||
// dsm($data, 'data');
|
||
$data['subject'] = '<i class="icon-align-justify"></i><span class="menu-title">' . $data['subject'] . '</span>';
|
||
}
|
||
if ($block->module == 'materio_flag' && $block->delta == 'materio_flag_mylists_nav') {
|
||
// dsm($block, 'block');
|
||
// dsm($data, 'data');
|
||
$data['subject'] = '<i class="fi-folder"></i><span class="menu-title">' . $data['subject'] . '</span>';
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Themes the checkout review order page.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - form: A render element representing the form, that by default includes
|
||
* the 'Back' and 'Submit order' buttons at the bottom of the review page.
|
||
* - panes: An associative array for each checkout pane that has information
|
||
* to add to the review page, keyed by the pane title:
|
||
* - <pane title>: The data returned for that pane or an array of returned
|
||
* data.
|
||
*
|
||
* @return
|
||
* A string of HTML for the page contents.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_uc_cart_checkout_review($variables) {
|
||
$panes = $variables['panes'];
|
||
$form = $variables['form'];
|
||
|
||
drupal_add_css(drupal_get_path('module', 'uc_cart') . '/uc_cart.css');
|
||
|
||
$output = '<div id="review-instructions">' . filter_xss_admin(t(variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')))) . '</div>';
|
||
|
||
$output .= '<table class="order-review-table">';
|
||
|
||
foreach ($panes as $title => $data) {
|
||
$output .= '<tr class="pane-title-row">';
|
||
$output .= '<td colspan="2">' . $title . '</td>';
|
||
$output .= '</tr>';
|
||
if (is_array($data)) {
|
||
foreach ($data as $row) {
|
||
if (is_array($row)) {
|
||
if (isset($row['border'])) {
|
||
$border = ' class="row-border-' . $row['border'] . '"';
|
||
}
|
||
else {
|
||
$border = '';
|
||
}
|
||
$output .= '<tr' . $border . '>';
|
||
$output .= '<td class="title-col">' . $row['title'] . ':</td>';
|
||
$output .= '<td class="data-col">' . $row['data'] . '</td>';
|
||
$output .= '</tr>';
|
||
}
|
||
else {
|
||
$output .= '<tr><td colspan="2">' . $row . '</td></tr>';
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
$output .= '<tr><td colspan="2">' . $data . '</td></tr>';
|
||
}
|
||
}
|
||
|
||
$output .= '<tr class="review-button-row">';
|
||
$output .= '<td colspan="2">' . drupal_render($form) . '</td>';
|
||
$output .= '</tr>';
|
||
|
||
$output .= '</table>';
|
||
|
||
return $output;
|
||
}
|
||
|
||
/**
|
||
* Default theme function for the checkout form.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - form: A render element representing the form.
|
||
*
|
||
* @see uc_cart_checkout_form()
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_uc_cart_checkout_form($variables) {
|
||
$form = $variables['form'];
|
||
// dsm($variables, "variables");
|
||
// dsm($form, "form");
|
||
|
||
// $form['panes']['cart']['#title'] = null;
|
||
// $form['panes']['customer']['#title'] = null;
|
||
$form['panes']['coupon']['#description'] = null;
|
||
|
||
$bf = array("#type"=>"fieldset", "#collapsible"=>false);
|
||
|
||
$layout = array(
|
||
"first-row" => $bf + array(
|
||
"#id"=>"first-row",
|
||
"#attributes"=>array("class"=>array("form-row")),
|
||
"column-left" =>$bf + array(
|
||
"#id"=>"first-row-column-left",
|
||
"#attributes"=>array("class"=>array("form-column", "form-column-left")),
|
||
"customer"=>"#", "billing"=>"#",
|
||
),
|
||
"column-right" =>$bf + array(
|
||
"#id"=>"first-row-column-right",
|
||
"#attributes"=>array("class"=>array("form-column", "form-column-right")),
|
||
"cart"=>"#", "coupon_automatic"=>"#", "coupon"=>"#", "payment"=>"#",
|
||
),
|
||
),
|
||
// "sec-row" => $bf + array(
|
||
// "#id"=>"sec-row",
|
||
// "#attributes"=>array("class"=>array("form-row")),
|
||
// "column-left" =>$bf + array(
|
||
// "#id"=>"sec-row-column-left",
|
||
// "#attributes"=>array("class"=>array("form-column", "form-column-left")),
|
||
// ),
|
||
// "column-right" =>$bf + array(
|
||
// "#id"=>"sec-row-column-right",
|
||
// "#attributes"=>array("class"=>array("form-column", "form-column-right")),
|
||
// ),
|
||
// ),
|
||
);
|
||
|
||
foreach ($layout as $rowkey => $row) {
|
||
foreach ($row as $collkey => $coll) {
|
||
if($collkey[0] != "#"){
|
||
foreach ($coll as $panekey => $pane) {
|
||
if($panekey[0] != "#" && isset($form['panes'][$panekey])){
|
||
$layout[$rowkey][$collkey][$panekey] = $form['panes'][$panekey];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// dsm($layout, 'layout');
|
||
|
||
$form = $layout + $form;
|
||
unset($form['panes']);
|
||
|
||
return drupal_render_children($form);
|
||
}
|
||
|
||
function materiobasetheme_uc_coupon_automatic_discounts($variables) {
|
||
$form = $variables['form'];
|
||
// dsm($form, 'auto discount form');
|
||
if( isset($form['discounts']['#items'])){
|
||
|
||
}
|
||
return drupal_render_children($form);
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* Formats the cart contents table on the checkout page.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - show_subtotal: TRUE or FALSE indicating if you want a subtotal row
|
||
* displayed in the table.
|
||
* - items: An associative array of cart item information containing:
|
||
* - qty: Quantity in cart.
|
||
* - title: Item title.
|
||
* - price: Item price.
|
||
* - desc: Item description.
|
||
*
|
||
* @return
|
||
* The HTML output for the cart review table.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_uc_cart_review_table($variables) {
|
||
$items = $variables['items'];
|
||
$show_subtotal = $variables['show_subtotal'];
|
||
|
||
$subtotal = 0;
|
||
|
||
// Set up table header.
|
||
// $header = array(
|
||
// array('data' => theme('uc_qty_label'), 'class' => array('qty')),
|
||
// array('data' => t('Products'), 'class' => array('products')),
|
||
// array('data' => t('Price'), 'class' => array('price')),
|
||
// );
|
||
|
||
// Set up table rows.
|
||
$display_items = uc_order_product_view_multiple($items);
|
||
if (!empty($display_items['uc_order_product'])) {
|
||
foreach (element_children($display_items['uc_order_product']) as $key) {
|
||
$display_item = $display_items['uc_order_product'][$key];
|
||
$subtotal += $display_item['total']['#price'];
|
||
$rows[] = array(
|
||
// array('data' => $display_item['qty'], 'class' => array('qty')),
|
||
array('data' => $display_item['product'], 'class' => array('products')),
|
||
array('data' => $display_item['total'], 'class' => array('price')),
|
||
);
|
||
}
|
||
}
|
||
|
||
// Add the subtotal as the final row.
|
||
if ($show_subtotal) {
|
||
$rows[] = array(
|
||
'data' => array(
|
||
// One cell
|
||
array(
|
||
// 'data' => array(
|
||
// '#theme' => 'uc_price',
|
||
// '#prefix' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
|
||
// '#price' => $subtotal,
|
||
// ),
|
||
'data'=>'<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
|
||
// Cell attributes
|
||
// 'colspan' => 2,
|
||
'class' => array('subtotal'),
|
||
),
|
||
array(
|
||
'data'=>array(
|
||
'#theme' => 'uc_price',
|
||
'#price' => $subtotal,
|
||
),
|
||
'class' => array('price'),
|
||
)
|
||
),
|
||
// Row attributes
|
||
'class' => array('subtotal'),
|
||
);
|
||
}
|
||
|
||
// return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
|
||
return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
|
||
}
|
||
|
||
/**
|
||
* Themes cart items on the checkout review order page.
|
||
*
|
||
* @param $variables
|
||
* An associative array containing:
|
||
* - items: An associative array of cart item information containing:
|
||
* - qty: Quantity in cart.
|
||
* - title: Item title.
|
||
* - price: Item price.
|
||
* - desc: Item description.
|
||
*
|
||
* @return
|
||
* A string of HTML for the page contents.
|
||
*
|
||
* @ingroup themeable
|
||
*/
|
||
function materiobasetheme_uc_checkout_pane_cart_review($variables) {
|
||
$rows = array();
|
||
$items = uc_order_product_view_multiple($variables['items']);
|
||
|
||
foreach (element_children($items['uc_order_product']) as $key) {
|
||
$item = $items['uc_order_product'][$key];
|
||
$rows[] = array(
|
||
array('data' => $item['qty'], 'class' => array('qty')),
|
||
array('data' => $item['product'], 'class' => array('products')),
|
||
array('data' => $item['total'], 'class' => array('price')),
|
||
);
|
||
}
|
||
|
||
return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));;
|
||
}
|