template.theme-overrides.inc 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  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="fi-torso large"></i><span class="account">' . $user->mail . '</span> ', 'user/'.$user->uid.'/edit', array('html'=>true))
  130. . l('<i class="fi-power"></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[10]) // student
  239. && !isset($user->roles[11]) // alphatesteur
  240. && !isset($user->roles[6]) // adherent
  241. && !isset($user->roles[8]) // premium
  242. && !isset($user->roles[12]) // translator
  243. && !isset($user->roles[13]) // admin showroom
  244. && !isset($user->roles[3]) // admin
  245. && !isset($user->roles[4]) // root
  246. ){
  247. unset($variables['title']);
  248. unset($variables['alt']);
  249. }
  250. $figure = '<figure style="'.$fig_dimensions.'" ' . (isset($variables['title']) ? 'title="'.$variables['title'].'"' : '') . '>';
  251. // lazyload
  252. $excluded_styles = array('pdf', 'card-bookmark', 'content_full', 'content_teaser', 'didactique_page', 'publications-home', 'publication-couv');
  253. if(!in_array($variables['style_name'], $excluded_styles) && ( (isset($variables['delta']) && $variables['delta'] > 0) || !isset($variables['delta']) ) ){
  254. // store the real path
  255. $real_path = $variables['path'];
  256. $variables['attributes']['data-original'] = file_create_url($real_path);
  257. // add Class lazy for JS
  258. $variables['attributes']['class'][] = "lazy";
  259. // replace the image by a blank
  260. $variables['path'] = drupal_get_path('theme', 'materiobasetheme') . '/img/blank.gif';
  261. $figure .= theme('image', $variables);
  262. }else{
  263. # without lazyload
  264. $figure .= theme('image', $variables);
  265. }
  266. $figure .= '</figure>';
  267. return $figure;
  268. }
  269. /**
  270. * Returns HTML for a list or nested list of items.
  271. *
  272. * @param $variables
  273. * An associative array containing:
  274. * - items: An array of items to be displayed in the list. If an item is a
  275. * string, then it is used as is. If an item is an array, then the "data"
  276. * element of the array is used as the contents of the list item. If an item
  277. * is an array with a "children" element, those children are displayed in a
  278. * nested list. All other elements are treated as attributes of the list
  279. * item element.
  280. * - title: The title of the list.
  281. * - type: The type of list to return (e.g. "ul", "ol").
  282. * - attributes: The attributes applied to the list element.
  283. */
  284. function materiobasetheme_item_list($variables) {
  285. $items = $variables['items'];
  286. $title = $variables['title'];
  287. $type = $variables['type'];
  288. $attributes = $variables['attributes'];
  289. // Only output the list container and title, if there are any list items.
  290. // Check to see whether the block title exists before adding a header.
  291. // Empty headers are not semantic and present accessibility challenges.
  292. $output = '';
  293. if (isset($title) && $title !== '') {
  294. $output .= '<div class="item-list">';
  295. $output .= '<h3>' . $title . '</h3>';
  296. }
  297. if (!empty($items)) {
  298. $output .= "<$type" . drupal_attributes($attributes) . '>';
  299. $num_items = count($items);
  300. foreach ($items as $i => $item) {
  301. $attributes = array();
  302. $children = array();
  303. $data = '';
  304. if (is_array($item)) {
  305. foreach ($item as $key => $value) {
  306. if ($key == 'data') {
  307. $data = $value;
  308. }
  309. elseif ($key == 'children') {
  310. $children = $value;
  311. }
  312. else {
  313. $attributes[$key] = $value;
  314. }
  315. }
  316. }
  317. else {
  318. $data = $item;
  319. }
  320. if (count($children) > 0) {
  321. // Render nested list.
  322. $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
  323. }
  324. if ($i == 0) {
  325. $attributes['class'][] = 'first';
  326. }
  327. if ($i == $num_items - 1) {
  328. $attributes['class'][] = 'last';
  329. }
  330. $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
  331. }
  332. $output .= "</$type>";
  333. }
  334. if (isset($title) && $title !== '') {
  335. $output .= '</div>';
  336. }
  337. return $output;
  338. }
  339. /**
  340. * Returns HTML for a link to a file.
  341. *
  342. * @param $variables
  343. * An associative array containing:
  344. * - file: A file object to which the link will be created.
  345. * - icon_directory: (optional) A path to a directory of icons to be used for
  346. * files. Defaults to the value of the "file_icon_directory" variable.
  347. *
  348. * @ingroup themeable
  349. */
  350. function materiobasetheme_file_link($variables) {
  351. $file = $variables['file'];
  352. $icon_directory = $variables['icon_directory'];
  353. $url = file_create_url($file->uri);
  354. $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
  355. // Set options as per anchor format described at
  356. // http://microformats.org/wiki/file-format-examples
  357. $options = array(
  358. 'attributes' => array(
  359. 'type' => $file->filemime . '; length=' . $file->filesize,
  360. 'target' => '_blank',
  361. ),
  362. );
  363. // Use the description as the link text if available.
  364. if (empty($file->description)) {
  365. $link_text = $file->filename;
  366. }
  367. else {
  368. $link_text = $file->description;
  369. $options['attributes']['title'] = check_plain($file->filename);
  370. }
  371. return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
  372. }
  373. /**
  374. * Implements hook_form_alter().
  375. */
  376. function materiobasetheme_form_alter(&$form, &$form_state, $form_id) {
  377. // dsm($form_id, 'form_id');
  378. if($form_id == "user_login_block"){
  379. // dsm($form, 'form');
  380. unset($form['links']);
  381. // $items = array();
  382. $newpass = l(t('Lost my password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
  383. $form['newpass'] = array(
  384. '#prefix' => '<div class="newpass">',
  385. '#markup' => $newpass,
  386. '#suffix' => '</div>',
  387. );
  388. // if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
  389. // $form['actions']['#weight'] = 10;
  390. // $register = l(t('Get a free account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
  391. // $form['register'] = array(
  392. // '#prefix' => '<div class="register">',
  393. // '#markup' => $register,
  394. // '#suffix' => '</div>',
  395. // '#weight' => 15,
  396. // );
  397. // }
  398. }
  399. }
  400. /**
  401. * Implements hook_block_view_alter().
  402. */
  403. function materiobasetheme_block_view_alter(&$data, $block) {
  404. // dsm($block, 'block');
  405. if ($block->module == 'menu' && $block->delta == 'menu-top-menu') {
  406. // dsm($block, 'block');
  407. // dsm($data, 'data');
  408. $data['subject'] = '<i class="icon-align-justify"></i><span class="menu-title">' . $data['subject'] . '</span>';
  409. }
  410. if ($block->module == 'materio_flag' && $block->delta == 'materio_flag_mylists_nav') {
  411. // dsm($block, 'block');
  412. // dsm($data, 'data');
  413. $data['subject'] = '<i class="fi-folder"></i><span class="menu-title">' . $data['subject'] . '</span>';
  414. }
  415. }
  416. /**
  417. * Themes the checkout review order page.
  418. *
  419. * @param $variables
  420. * An associative array containing:
  421. * - form: A render element representing the form, that by default includes
  422. * the 'Back' and 'Submit order' buttons at the bottom of the review page.
  423. * - panes: An associative array for each checkout pane that has information
  424. * to add to the review page, keyed by the pane title:
  425. * - <pane title>: The data returned for that pane or an array of returned
  426. * data.
  427. *
  428. * @return
  429. * A string of HTML for the page contents.
  430. *
  431. * @ingroup themeable
  432. */
  433. function materiobasetheme_uc_cart_checkout_review($variables) {
  434. $panes = $variables['panes'];
  435. $form = $variables['form'];
  436. drupal_add_css(drupal_get_path('module', 'uc_cart') . '/uc_cart.css');
  437. $output = '<div id="review-instructions">' . filter_xss_admin(t(variable_get('uc_checkout_review_instructions', uc_get_message('review_instructions')))) . '</div>';
  438. $output .= '<table class="order-review-table">';
  439. foreach ($panes as $title => $data) {
  440. $output .= '<tr class="pane-title-row">';
  441. $output .= '<td colspan="2">' . $title . '</td>';
  442. $output .= '</tr>';
  443. if (is_array($data)) {
  444. foreach ($data as $row) {
  445. if (is_array($row)) {
  446. if (isset($row['border'])) {
  447. $border = ' class="row-border-' . $row['border'] . '"';
  448. }
  449. else {
  450. $border = '';
  451. }
  452. $output .= '<tr' . $border . '>';
  453. $output .= '<td class="title-col">' . $row['title'] . ':</td>';
  454. $output .= '<td class="data-col">' . $row['data'] . '</td>';
  455. $output .= '</tr>';
  456. }
  457. else {
  458. $output .= '<tr><td colspan="2">' . $row . '</td></tr>';
  459. }
  460. }
  461. }
  462. else {
  463. $output .= '<tr><td colspan="2">' . $data . '</td></tr>';
  464. }
  465. }
  466. $output .= '<tr class="review-button-row">';
  467. $output .= '<td colspan="2">' . drupal_render($form) . '</td>';
  468. $output .= '</tr>';
  469. $output .= '</table>';
  470. return $output;
  471. }
  472. /**
  473. * Default theme function for the checkout form.
  474. *
  475. * @param $variables
  476. * An associative array containing:
  477. * - form: A render element representing the form.
  478. *
  479. * @see uc_cart_checkout_form()
  480. * @ingroup themeable
  481. */
  482. function materiobasetheme_uc_cart_checkout_form($variables) {
  483. $form = $variables['form'];
  484. // dsm($variables, "variables");
  485. // dsm($form, "form");
  486. // $form['panes']['cart']['#title'] = null;
  487. // $form['panes']['customer']['#title'] = null;
  488. $form['panes']['coupon']['#description'] = null;
  489. $bf = array("#type"=>"fieldset", "#collapsible"=>false);
  490. $layout = array(
  491. "first-row" => $bf + array(
  492. "#id"=>"first-row",
  493. "#attributes"=>array("class"=>array("form-row")),
  494. "column-left" =>$bf + array(
  495. "#id"=>"first-row-column-left",
  496. "#attributes"=>array("class"=>array("form-column", "form-column-left")),
  497. "customer"=>"#", "billing"=>"#",
  498. ),
  499. "column-right" =>$bf + array(
  500. "#id"=>"first-row-column-right",
  501. "#attributes"=>array("class"=>array("form-column", "form-column-right")),
  502. "cart"=>"#", "coupon_automatic"=>"#", "coupon"=>"#", "payment"=>"#",
  503. ),
  504. ),
  505. // "sec-row" => $bf + array(
  506. // "#id"=>"sec-row",
  507. // "#attributes"=>array("class"=>array("form-row")),
  508. // "column-left" =>$bf + array(
  509. // "#id"=>"sec-row-column-left",
  510. // "#attributes"=>array("class"=>array("form-column", "form-column-left")),
  511. // ),
  512. // "column-right" =>$bf + array(
  513. // "#id"=>"sec-row-column-right",
  514. // "#attributes"=>array("class"=>array("form-column", "form-column-right")),
  515. // ),
  516. // ),
  517. );
  518. foreach ($layout as $rowkey => $row) {
  519. foreach ($row as $collkey => $coll) {
  520. if($collkey[0] != "#"){
  521. foreach ($coll as $panekey => $pane) {
  522. if($panekey[0] != "#" && isset($form['panes'][$panekey])){
  523. $layout[$rowkey][$collkey][$panekey] = $form['panes'][$panekey];
  524. }
  525. }
  526. }
  527. }
  528. }
  529. // dsm($layout, 'layout');
  530. $form = $layout + $form;
  531. unset($form['panes']);
  532. return drupal_render_children($form);
  533. }
  534. function materiobasetheme_uc_coupon_automatic_discounts($variables) {
  535. $form = $variables['form'];
  536. // dsm($form, 'auto discount form');
  537. if( isset($form['discounts']['#items'])){
  538. }
  539. return drupal_render_children($form);
  540. }
  541. /**
  542. * Formats the cart contents table on the checkout page.
  543. *
  544. * @param $variables
  545. * An associative array containing:
  546. * - show_subtotal: TRUE or FALSE indicating if you want a subtotal row
  547. * displayed in the table.
  548. * - items: An associative array of cart item information containing:
  549. * - qty: Quantity in cart.
  550. * - title: Item title.
  551. * - price: Item price.
  552. * - desc: Item description.
  553. *
  554. * @return
  555. * The HTML output for the cart review table.
  556. *
  557. * @ingroup themeable
  558. */
  559. function materiobasetheme_uc_cart_review_table($variables) {
  560. $items = $variables['items'];
  561. $show_subtotal = $variables['show_subtotal'];
  562. $subtotal = 0;
  563. // Set up table header.
  564. // $header = array(
  565. // array('data' => theme('uc_qty_label'), 'class' => array('qty')),
  566. // array('data' => t('Products'), 'class' => array('products')),
  567. // array('data' => t('Price'), 'class' => array('price')),
  568. // );
  569. // Set up table rows.
  570. $display_items = uc_order_product_view_multiple($items);
  571. if (!empty($display_items['uc_order_product'])) {
  572. foreach (element_children($display_items['uc_order_product']) as $key) {
  573. $display_item = $display_items['uc_order_product'][$key];
  574. $subtotal += $display_item['total']['#price'];
  575. $rows[] = array(
  576. // array('data' => $display_item['qty'], 'class' => array('qty')),
  577. array('data' => $display_item['product'], 'class' => array('products')),
  578. array('data' => $display_item['total'], 'class' => array('price')),
  579. );
  580. }
  581. }
  582. // Add the subtotal as the final row.
  583. if ($show_subtotal) {
  584. $rows[] = array(
  585. 'data' => array(
  586. // One cell
  587. array(
  588. // 'data' => array(
  589. // '#theme' => 'uc_price',
  590. // '#prefix' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
  591. // '#price' => $subtotal,
  592. // ),
  593. 'data'=>'<span id="subtotal-title">' . t('Subtotal:') . '</span> ',
  594. // Cell attributes
  595. // 'colspan' => 2,
  596. 'class' => array('subtotal'),
  597. ),
  598. array(
  599. 'data'=>array(
  600. '#theme' => 'uc_price',
  601. '#price' => $subtotal,
  602. ),
  603. 'class' => array('price'),
  604. )
  605. ),
  606. // Row attributes
  607. 'class' => array('subtotal'),
  608. );
  609. }
  610. // return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
  611. return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));
  612. }
  613. /**
  614. * Themes cart items on the checkout review order page.
  615. *
  616. * @param $variables
  617. * An associative array containing:
  618. * - items: An associative array of cart item information containing:
  619. * - qty: Quantity in cart.
  620. * - title: Item title.
  621. * - price: Item price.
  622. * - desc: Item description.
  623. *
  624. * @return
  625. * A string of HTML for the page contents.
  626. *
  627. * @ingroup themeable
  628. */
  629. function materiobasetheme_uc_checkout_pane_cart_review($variables) {
  630. $rows = array();
  631. $items = uc_order_product_view_multiple($variables['items']);
  632. foreach (element_children($items['uc_order_product']) as $key) {
  633. $item = $items['uc_order_product'][$key];
  634. $rows[] = array(
  635. array('data' => $item['qty'], 'class' => array('qty')),
  636. array('data' => $item['product'], 'class' => array('products')),
  637. array('data' => $item['total'], 'class' => array('price')),
  638. );
  639. }
  640. return theme('table', array('rows' => $rows, 'attributes' => array('class' => array('cart-review'))));;
  641. }