uc_catalog.theme.inc 1.7 KB

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