template.theme-overrides.inc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. <?php
  2. /**
  3. * Returns HTML for a query pager.
  4. *
  5. * Menu callbacks that display paged query results should call theme('pager') to
  6. * retrieve a pager control so that users can view other results. Format a list
  7. * of nearby pages with additional query results.
  8. *
  9. * @param $variables
  10. * An associative array containing:
  11. * - tags: An array of labels for the controls in the pager.
  12. * - element: An optional integer to distinguish between multiple pagers on
  13. * one page.
  14. * - parameters: An associative array of query string parameters to append to
  15. * the pager links.
  16. * - quantity: The number of pages in the list.
  17. *
  18. * @ingroup themeable
  19. */
  20. function materiobasetheme_pager($variables) {
  21. $tags = $variables['tags'];
  22. $element = $variables['element'];
  23. $parameters = $variables['parameters'];
  24. $quantity = $variables['quantity'];
  25. global $pager_page_array, $pager_total;
  26. // Calculate various markers within this pager piece:
  27. // Middle is used to "center" pages around the current page.
  28. $pager_middle = ceil($quantity / 2);
  29. // current is the page we are currently paged to
  30. $pager_current = $pager_page_array[$element] + 1;
  31. // first is the first page listed by this pager piece (re quantity)
  32. $pager_first = $pager_current - $pager_middle + 1;
  33. // last is the last page listed by this pager piece (re quantity)
  34. $pager_last = $pager_current + $quantity - $pager_middle;
  35. // max is the maximum page number
  36. $pager_max = $pager_total[$element];
  37. // End of marker calculations.
  38. // Prepare for generation loop.
  39. $i = $pager_first;
  40. if ($pager_last > $pager_max) {
  41. // Adjust "center" if at end of query.
  42. $i = $i + ($pager_max - $pager_last);
  43. $pager_last = $pager_max;
  44. }
  45. if ($i <= 0) {
  46. // Adjust "center" if at start of query.
  47. $pager_last = $pager_last + (1 - $i);
  48. $i = 1;
  49. }
  50. // End of generation loop preparation.
  51. $li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('‹‹')), 'element' => $element, 'parameters' => $parameters));
  52. $li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  53. $li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  54. $li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('››')), 'element' => $element, 'parameters' => $parameters));
  55. if ($pager_total[$element] > 1) {
  56. if ($li_first) {
  57. $items[] = array(
  58. 'class' => array('pager-first'),
  59. 'data' => $li_first,
  60. );
  61. }
  62. if ($li_previous) {
  63. $items[] = array(
  64. 'class' => array('pager-previous'),
  65. 'data' => $li_previous,
  66. );
  67. }
  68. // When there is more than one page, create the pager list.
  69. if ($i != $pager_max) {
  70. if ($i > 1) {
  71. $items[] = array(
  72. 'class' => array('pager-ellipsis'),
  73. 'data' => '…',
  74. );
  75. }
  76. // Now generate the actual pager piece.
  77. for (; $i <= $pager_last && $i <= $pager_max; $i++) {
  78. if ($i < $pager_current) {
  79. $items[] = array(
  80. 'class' => array('pager-item'),
  81. 'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)),
  82. );
  83. }
  84. if ($i == $pager_current) {
  85. $items[] = array(
  86. 'class' => array('pager-current'),
  87. 'data' => $i,
  88. );
  89. }
  90. if ($i > $pager_current) {
  91. $items[] = array(
  92. 'class' => array('pager-item'),
  93. 'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)),
  94. );
  95. }
  96. }
  97. if ($i < $pager_max) {
  98. $items[] = array(
  99. 'class' => array('pager-ellipsis'),
  100. 'data' => '…',
  101. );
  102. }
  103. }
  104. // End generation.
  105. if ($li_next) {
  106. $items[] = array(
  107. 'class' => array('pager-next'),
  108. 'data' => $li_next,
  109. );
  110. }
  111. if ($li_last) {
  112. $items[] = array(
  113. 'class' => array('pager-last'),
  114. 'data' => $li_last,
  115. );
  116. }
  117. return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . theme('item_list', array(
  118. 'items' => $items,
  119. 'attributes' => array('class' => array('pager')),
  120. ));
  121. }
  122. }
  123. /**
  124. * Theme the loggedinblock that shows for logged-in users.
  125. */
  126. function materiobasetheme_lt_loggedinblock($variables){
  127. global $user;
  128. // return theme('username', array('account' => $variables['account'], 'link_path'=>'user/'.$user->uid.'/edit')) .' | ' . l(t('Log out'), 'user/logout');
  129. return l('<i class="icon-user"></i><span class="account">' . $user->mail . '</span> ', 'user/'.$user->uid.'/edit', array('html'=>true))
  130. . l('<i class="icon-off"></i><span class="logout">' . t('Log out') . '</span>', 'user/logout', array('html' => true));
  131. }
  132. function materiobasetheme_links__locale_block(&$vars) {
  133. // global $language;
  134. foreach ($vars['links'] as $lang => $link) {
  135. // $vars['links'][$lang]['title'] = $lang;
  136. // if($lang == $language->language)
  137. // unset($vars['link'][$lang]);
  138. }
  139. $content = theme_links($vars);
  140. return $content;
  141. }
  142. /**
  143. * Returns HTML for an image field formatter.
  144. *
  145. * @param $variables
  146. * An associative array containing:
  147. * - item: Associative array of image data, which may include "uri", "alt",
  148. * "width", "height", "title" and "attributes".
  149. * - image_style: An optional image style.
  150. * - path: An array containing the link 'path' and link 'options'.
  151. *
  152. * @ingroup themeable
  153. */
  154. function materiobasetheme_image_formatter($variables) {
  155. // dsm($variables, 'image_formatter');
  156. $item = $variables['item'];
  157. $image = array(
  158. 'path' => $item['uri'],
  159. );
  160. if (array_key_exists('alt', $item)) {
  161. $image['alt'] = $item['alt'];
  162. }
  163. if (isset($item['attributes'])) {
  164. $image['attributes'] = $item['attributes'];
  165. }
  166. if (isset($item['width']) && isset($item['height'])) {
  167. $image['width'] = $item['width'];
  168. $image['height'] = $item['height'];
  169. }
  170. // Do not output an empty 'title' attribute.
  171. if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
  172. $image['title'] = $item['title'];
  173. }
  174. #added
  175. if(isset($item['delta'])) {
  176. $image['delta'] = $item['delta'];
  177. }
  178. if ($variables['image_style']) {
  179. $image['style_name'] = $variables['image_style'];
  180. $output = theme('image_style', $image);
  181. }
  182. else {
  183. $output = theme('image', $image);
  184. }
  185. // The link path and link options are both optional, but for the options to be
  186. // processed, the link path must at least be an empty string.
  187. if (isset($variables['path']['path'])) {
  188. $path = $variables['path']['path'];
  189. $options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
  190. // When displaying an image inside a link, the html option must be TRUE.
  191. $options['html'] = TRUE;
  192. $output = l($output, $path, $options);
  193. }
  194. return $output;
  195. }
  196. /**
  197. * Returns HTML for an image using a specific image style.
  198. *
  199. * @param $variables
  200. * An associative array containing:
  201. * - style_name: The name of the style to be used to alter the original image.
  202. * - path: The path of the image file relative to the Drupal files directory.
  203. * This function does not work with images outside the files directory nor
  204. * with remotely hosted images. This should be in a format such as
  205. * 'images/image.jpg', or using a stream wrapper such as
  206. * 'public://images/image.jpg'.
  207. * - width: The width of the source image (if known).
  208. * - height: The height of the source image (if known).
  209. * - alt: The alternative text for text-based browsers.
  210. * - title: The title text is displayed when the image is hovered in some
  211. * popular browsers.
  212. * - attributes: Associative array of attributes to be placed in the img tag.
  213. *
  214. * @ingroup themeable
  215. */
  216. function materiobasetheme_image_style($variables) {
  217. // dsm($variables, 'image_style');
  218. // Determine the dimensions of the styled image.
  219. $fig_dimensions = "";
  220. if(isset($variables['width']) || $variables['height']){
  221. $dimensions = array(
  222. 'width' => $variables['width'],
  223. 'height' => $variables['height'],
  224. );
  225. image_style_transform_dimensions($variables['style_name'], $dimensions);
  226. $variables['width'] = $dimensions['width'];
  227. $variables['height'] = $dimensions['height'];
  228. $fig_dimensions = 'width:'.$dimensions['width'].'px;height:'.$dimensions['height'].'px;';
  229. }
  230. // Determine the url for the styled image.
  231. $variables['path'] = image_style_url($variables['style_name'], $variables['path']);
  232. if(!isset($variables['attributes']))
  233. $variables['attributes'] = array();
  234. if(!isset($variables['attributes']['class']))
  235. $variables['attributes']['class'] = array();
  236. # hide title and alt for non adherent users
  237. global $user;
  238. if(isset($user->roles[1]) || isset($user->roles[7])){
  239. unset($variables['title']);
  240. unset($variables['alt']);
  241. }
  242. $figure = '<figure style="'.$fig_dimensions.'" ' . (isset($variables['title']) ? 'title="'.$variables['title'].'"' : '') . '>';
  243. // lazyload
  244. $excluded_styles = array('pdf', 'card-bookmark', 'content_full', 'content_teaser', 'didactique_page');
  245. if(!in_array($variables['style_name'], $excluded_styles) && ( (isset($variables['delta']) && $variables['delta'] > 0) || !isset($variables['delta']) ) ){
  246. // store the real path
  247. $real_path = $variables['path'];
  248. $variables['attributes']['data-original'] = file_create_url($real_path);
  249. // add Class lazy for JS
  250. $variables['attributes']['class'][] = "lazy";
  251. // replace the image by a blank
  252. $variables['path'] = drupal_get_path('theme', 'materiobasetheme') . '/img/blank.gif';
  253. $figure .= theme('image', $variables);
  254. }else{
  255. # without lazyload
  256. $figure .= theme('image', $variables);
  257. }
  258. $figure .= '</figure>';
  259. return $figure;
  260. }
  261. /**
  262. * Returns HTML for a list or nested list of items.
  263. *
  264. * @param $variables
  265. * An associative array containing:
  266. * - items: An array of items to be displayed in the list. If an item is a
  267. * string, then it is used as is. If an item is an array, then the "data"
  268. * element of the array is used as the contents of the list item. If an item
  269. * is an array with a "children" element, those children are displayed in a
  270. * nested list. All other elements are treated as attributes of the list
  271. * item element.
  272. * - title: The title of the list.
  273. * - type: The type of list to return (e.g. "ul", "ol").
  274. * - attributes: The attributes applied to the list element.
  275. */
  276. function materiobasetheme_item_list($variables) {
  277. $items = $variables['items'];
  278. $title = $variables['title'];
  279. $type = $variables['type'];
  280. $attributes = $variables['attributes'];
  281. // Only output the list container and title, if there are any list items.
  282. // Check to see whether the block title exists before adding a header.
  283. // Empty headers are not semantic and present accessibility challenges.
  284. $output = '';
  285. if (isset($title) && $title !== '') {
  286. $output .= '<div class="item-list">';
  287. $output .= '<h3>' . $title . '</h3>';
  288. }
  289. if (!empty($items)) {
  290. $output .= "<$type" . drupal_attributes($attributes) . '>';
  291. $num_items = count($items);
  292. foreach ($items as $i => $item) {
  293. $attributes = array();
  294. $children = array();
  295. $data = '';
  296. if (is_array($item)) {
  297. foreach ($item as $key => $value) {
  298. if ($key == 'data') {
  299. $data = $value;
  300. }
  301. elseif ($key == 'children') {
  302. $children = $value;
  303. }
  304. else {
  305. $attributes[$key] = $value;
  306. }
  307. }
  308. }
  309. else {
  310. $data = $item;
  311. }
  312. if (count($children) > 0) {
  313. // Render nested list.
  314. $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
  315. }
  316. if ($i == 0) {
  317. $attributes['class'][] = 'first';
  318. }
  319. if ($i == $num_items - 1) {
  320. $attributes['class'][] = 'last';
  321. }
  322. $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
  323. }
  324. $output .= "</$type>";
  325. }
  326. if (isset($title) && $title !== '') {
  327. $output .= '</div>';
  328. }
  329. return $output;
  330. }
  331. /**
  332. * Returns HTML for a link to a file.
  333. *
  334. * @param $variables
  335. * An associative array containing:
  336. * - file: A file object to which the link will be created.
  337. * - icon_directory: (optional) A path to a directory of icons to be used for
  338. * files. Defaults to the value of the "file_icon_directory" variable.
  339. *
  340. * @ingroup themeable
  341. */
  342. function materiobasetheme_file_link($variables) {
  343. $file = $variables['file'];
  344. $icon_directory = $variables['icon_directory'];
  345. $url = file_create_url($file->uri);
  346. $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
  347. // Set options as per anchor format described at
  348. // http://microformats.org/wiki/file-format-examples
  349. $options = array(
  350. 'attributes' => array(
  351. 'type' => $file->filemime . '; length=' . $file->filesize,
  352. 'target' => '_blank',
  353. ),
  354. );
  355. // Use the description as the link text if available.
  356. if (empty($file->description)) {
  357. $link_text = $file->filename;
  358. }
  359. else {
  360. $link_text = $file->description;
  361. $options['attributes']['title'] = check_plain($file->filename);
  362. }
  363. return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
  364. }
  365. /**
  366. * Implements hook_form_alter().
  367. */
  368. function materiobasetheme_form_alter(&$form, &$form_state, $form_id) {
  369. // dsm($form_id, 'form_id');
  370. if($form_id == "user_login_block"){
  371. // dsm($form, 'form');
  372. unset($form['links']);
  373. // $items = array();
  374. $newpass = l(t('Lost my password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  375. $form['newpass'] = array(
  376. '#prefix' => '<div class="newpass">',
  377. '#markup' => $newpass,
  378. '#suffix' => '</div>',
  379. );
  380. // if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
  381. // $form['actions']['#weight'] = 10;
  382. // $register = l(t('Get a free account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  383. // $form['register'] = array(
  384. // '#prefix' => '<div class="register">',
  385. // '#markup' => $register,
  386. // '#suffix' => '</div>',
  387. // '#weight' => 15,
  388. // );
  389. // }
  390. }
  391. }
  392. /**
  393. * Implements hook_block_view_alter().
  394. */
  395. function materiobasetheme_block_view_alter(&$data, $block) {
  396. // dsm($block, 'block');
  397. if ($block->module == 'menu' && $block->delta == 'menu-top-menu') {
  398. // dsm($block, 'block');
  399. // dsm($data, 'data');
  400. $data['subject'] = '<i class="icon-align-justify"></i><span class="menu-title">' . $data['subject'] . '</span>';
  401. }
  402. if ($block->module == 'materio_flag' && $block->delta == 'materio_flag_mylists_nav') {
  403. // dsm($block, 'block');
  404. // dsm($data, 'data');
  405. $data['subject'] = '<i class="icon-folder-open"></i><span class="menu-title">' . $data['subject'] . '</span>';
  406. }
  407. }
  408. /**
  409. * Themes the checkout review order page.
  410. *
  411. * @param $variables
  412. * An associative array containing:
  413. * - form: A render element representing the form, that by default includes
  414. * the 'Back' and 'Submit order' buttons at the bottom of the review page.
  415. * - panes: An associative array for each checkout pane that has information
  416. * to add to the review page, keyed by the pane title:
  417. * - <pane title>: The data returned for that pane or an array of returned
  418. * data.
  419. *
  420. * @return
  421. * A string of HTML for the page contents.
  422. *
  423. * @ingroup themeable
  424. */
  425. function materiobasetheme_uc_cart_checkout_review($variables) {
  426. $panes = $variables['panes'];
  427. $form = $variables['form'];
  428. drupal_add_css(drupal_get_path('module', 'uc_cart') . '/uc_cart.css');
  429. $output = '<div id="review-instructions">' . filter_xss_admin(t(variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')))) . '</div>';
  430. $output .= '<table class="order-review-table">';
  431. foreach ($panes as $title => $data) {
  432. $output .= '<tr class="pane-title-row">';
  433. $output .= '<td colspan="2">' . $title . '</td>';
  434. $output .= '</tr>';
  435. if (is_array($data)) {
  436. foreach ($data as $row) {
  437. if (is_array($row)) {
  438. if (isset($row['border'])) {
  439. $border = ' class="row-border-' . $row['border'] . '"';
  440. }
  441. else {
  442. $border = '';
  443. }
  444. $output .= '<tr' . $border . '>';
  445. $output .= '<td class="title-col">' . $row['title'] . ':</td>';
  446. $output .= '<td class="data-col">' . $row['data'] . '</td>';
  447. $output .= '</tr>';
  448. }
  449. else {
  450. $output .= '<tr><td colspan="2">' . $row . '</td></tr>';
  451. }
  452. }
  453. }
  454. else {
  455. $output .= '<tr><td colspan="2">' . $data . '</td></tr>';
  456. }
  457. }
  458. $output .= '<tr class="review-button-row">';
  459. $output .= '<td colspan="2">' . drupal_render($form) . '</td>';
  460. $output .= '</tr>';
  461. $output .= '</table>';
  462. return $output;
  463. }
  464. /**
  465. * Default theme function for the checkout form.
  466. *
  467. * @param $variables
  468. * An associative array containing:
  469. * - form: A render element representing the form.
  470. *
  471. * @see uc_cart_checkout_form()
  472. * @ingroup themeable
  473. */
  474. function materiobasetheme_uc_cart_checkout_form($variables) {
  475. $form = $variables['form'];
  476. // dsm($variables, "variables");
  477. // dsm($form, "form");
  478. // $form['panes']['cart']['#title'] = null;
  479. // $form['panes']['customer']['#title'] = null;
  480. $form['panes']['coupon']['#description'] = null;
  481. $bf = array("#type"=>"fieldset", "#collapsible"=>false);
  482. $layout = array(
  483. "first-row" => $bf + array(
  484. "#id"=>"first-row",
  485. "#attributes"=>array("class"=>array("form-row")),
  486. "column-left" =>$bf + array(
  487. "#id"=>"first-row-column-left",
  488. "#attributes"=>array("class"=>array("form-column", "form-column-left")),
  489. "customer"=>"#", "billing"=>"#",
  490. ),
  491. "column-right" =>$bf + array(
  492. "#id"=>"first-row-column-right",
  493. "#attributes"=>array("class"=>array("form-column", "form-column-right")),
  494. "cart"=>"#", "coupon_automatic"=>"#", "coupon"=>"#", "payment"=>"#",
  495. ),
  496. ),
  497. // "sec-row" => $bf + array(
  498. // "#id"=>"sec-row",
  499. // "#attributes"=>array("class"=>array("form-row")),
  500. // "column-left" =>$bf + array(
  501. // "#id"=>"sec-row-column-left",
  502. // "#attributes"=>array("class"=>array("form-column", "form-column-left")),
  503. // ),
  504. // "column-right" =>$bf + array(
  505. // "#id"=>"sec-row-column-right",
  506. // "#attributes"=>array("class"=>array("form-column", "form-column-right")),
  507. // ),
  508. // ),
  509. );
  510. foreach ($layout as $rowkey => $row) {
  511. foreach ($row as $collkey => $coll) {
  512. if($collkey[0] != "#"){
  513. foreach ($coll as $panekey => $pane) {
  514. if($panekey[0] != "#" && isset($form['panes'][$panekey])){
  515. $layout[$rowkey][$collkey][$panekey] = $form['panes'][$panekey];
  516. }
  517. }
  518. }
  519. }
  520. }
  521. // dsm($layout, 'layout');
  522. $form = $layout + $form;
  523. unset($form['panes']);
  524. return drupal_render_children($form);
  525. }
  526. function materiobasetheme_uc_coupon_automatic_discounts($variables) {
  527. $form = $variables['form'];
  528. // dsm($form, 'auto discount form');
  529. if( isset($form['discounts']['#items'])){
  530. }
  531. return drupal_render_children($form);
  532. }
  533. /**
  534. * Formats the cart contents table on the checkout page.
  535. *
  536. * @param $variables
  537. * An associative array containing:
  538. * - show_subtotal: TRUE or FALSE indicating if you want a subtotal row
  539. * displayed in the table.
  540. * - items: An associative array of cart item information containing:
  541. * - qty: Quantity in cart.
  542. * - title: Item title.
  543. * - price: Item price.
  544. * - desc: Item description.
  545. *
  546. * @return
  547. * The HTML output for the cart review table.
  548. *
  549. * @ingroup themeable
  550. */
  551. function materiobasetheme_uc_cart_review_table($variables) {
  552. $items = $variables['items'];
  553. $show_subtotal = $variables['show_subtotal'];
  554. $subtotal = 0;
  555. // Set up table header.
  556. // $header = array(
  557. // array('data' => theme('uc_qty_label'), 'class' => array('qty')),
  558. // array('data' => t('Products'), 'class' => array('products')),
  559. // array('data' => t('Price'), 'class' => array('price')),
  560. // );
  561. // Set up table rows.
  562. $display_items = uc_order_product_view_multiple($items);
  563. if (!empty($display_items['uc_order_product'])) {
  564. foreach (element_children($display_items['uc_order_product']) as $key) {
  565. $display_item = $display_items['uc_order_product'][$key];
  566. $subtotal += $display_item['total']['#price'];
  567. $rows[] = array(
  568. // array('data' => $display_item['qty'], 'class' => array('qty')),
  569. array('data' => $display_item['product'], 'class' => array('products')),
  570. array('data' => $display_item['total'], 'class' => array('price')),
  571. );
  572. }
  573. }
  574. // Add the subtotal as the final row.
  575. if ($show_subtotal) {
  576. $rows[] = array(
  577. 'data' => array(
  578. // One cell
  579. array(
  580. // 'data' => array(
  581. // '#theme' => 'uc_price',
  582. // '#prefix' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
  583. // '#price' => $subtotal,
  584. // ),
  585. 'data'=>'<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
  586. // Cell attributes
  587. // 'colspan' => 2,
  588. 'class' => array('subtotal'),
  589. ),
  590. array(
  591. 'data'=>array(
  592. '#theme' => 'uc_price',
  593. '#price' => $subtotal,
  594. ),
  595. 'class' => array('price'),
  596. )
  597. ),
  598. // Row attributes
  599. 'class' => array('subtotal'),
  600. );
  601. }
  602. // return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
  603. return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
  604. }
  605. /**
  606. * Themes cart items on the checkout review order page.
  607. *
  608. * @param $variables
  609. * An associative array containing:
  610. * - items: An associative array of cart item information containing:
  611. * - qty: Quantity in cart.
  612. * - title: Item title.
  613. * - price: Item price.
  614. * - desc: Item description.
  615. *
  616. * @return
  617. * A string of HTML for the page contents.
  618. *
  619. * @ingroup themeable
  620. */
  621. function materiobasetheme_uc_checkout_pane_cart_review($variables) {
  622. $rows = array();
  623. $items = uc_order_product_view_multiple($variables['items']);
  624. foreach (element_children($items['uc_order_product']) as $key) {
  625. $item = $items['uc_order_product'][$key];
  626. $rows[] = array(
  627. array('data' => $item['qty'], 'class' => array('qty')),
  628. array('data' => $item['product'], 'class' => array('products')),
  629. array('data' => $item['total'], 'class' => array('price')),
  630. );
  631. }
  632. return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));;
  633. }