uc_catalog.theme.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * @file
  4. * Theme functions for the uc_catalog module.
  5. */
  6. /**
  7. * Themes the catalog block.
  8. *
  9. * @see theme_uc_catalog_item()
  10. *
  11. * @ingroup themeable
  12. */
  13. function theme_uc_catalog_block($variables) {
  14. $menu_tree = $variables['menu_tree'];
  15. $output = '<ul class="catalog menu">';
  16. foreach ($menu_tree->children as $branch) {
  17. list($inpath, $html) = _uc_catalog_navigation($branch);
  18. $output .= $html;
  19. }
  20. $output .= '</ul>';
  21. return $output;
  22. }
  23. /**
  24. * Displays a formatted link in the catalog block.
  25. *
  26. * @ingroup themeable
  27. */
  28. function theme_uc_catalog_item($variables) {
  29. $here = $variables['here'];
  30. $link = $variables['link'];
  31. $lis = $variables['lis'];
  32. $expand = $variables['expand'];
  33. $inpath = $variables['inpath'];
  34. $count_children = $variables['count_children'];
  35. $output = '';
  36. if ($expand || $count_children) {
  37. if ($here) {
  38. $output = '<li class="expanded"><span class="trail">' . $link . "</span>\n";
  39. if (count($lis)) {
  40. $output .= '<ul class="menu">';
  41. foreach ($lis as $li) {
  42. $output .= $li . "\n";
  43. }
  44. $output .= "</ul>\n";
  45. }
  46. $output .= "</li>";
  47. }
  48. elseif ($expand || $inpath) {
  49. $output = '<li class="expanded"><span class="trail">' . $link . "</span>\n";
  50. if (count($lis)) {
  51. $output .= '<ul class="menu">';
  52. foreach ($lis as $li) {
  53. $output .= $li;
  54. }
  55. $output .= "</ul>\n";
  56. }
  57. $output .= "</li>";
  58. }
  59. else {
  60. $output = '<li class="collapsed">' . $link . "</li>\n";
  61. }
  62. }
  63. else {
  64. $output = '<li class="leaf">' . ($inpath ? '<span class="trail">' : '') . $link . ($inpath ? '</span>' : '') . "</li>\n";
  65. }
  66. return $output;
  67. }