[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/site_map/ -> site_map.theme.inc (source)

   1  <?php
   2  // $Id: site_map.theme.inc,v 1.1.2.4 2010/07/11 17:49:10 frjo Exp $
   3  
   4  /**
   5   * @file site_map.theme.inc
   6   *
   7   * Site map theme functions.
   8   */
   9  
  10  
  11  function theme_site_map_rss_legend() {
  12    $output .= '<p><strong>'. t('Legend:') .'</strong><br />';
  13    $output .= '<span class="rss">'. theme('site_map_feed_icon', NULL) .'</span> '. t('Link to a content RSS feed');
  14    $output .= '<br /><span class="rss">'. theme('site_map_feed_icon', NULL, 'comment') .'</span> '. t('Link to a comment RSS feed');
  15    $output .= '</p>';
  16  
  17    return $output;
  18  }
  19  
  20  /**
  21   * Return a themed site map box.
  22   *
  23   * @param $title
  24   *   The subject of the box.
  25   * @param $content
  26   *   The content of the box.
  27   * @param $class
  28   *   Optional extra class for the box.
  29   * @return
  30   *   A string containing the box output.
  31   */
  32  function theme_site_map_box($title, $content, $class = '') {
  33    $output = '';
  34    if ($title || $content) {
  35      $class = $class ? 'site-map-box '. $class : 'site-map-box';
  36      $output .= '<div class="'. $class .'">';
  37      if ($title) {
  38        $output .= '<h2 class="title">'. $title .'</h2>';
  39      }
  40      if ($content) {
  41        $output .= '<div class="content">'. $content .'</div>';
  42      }
  43      $output .= '</div>';
  44    }
  45  
  46    return $output;
  47  }
  48  
  49  /**
  50   * Return a themed feed icon.
  51   *
  52   * @param $url
  53   *   The feed URL.
  54   * @param $type
  55   *   The type of feed icon.
  56   * @return
  57   *   A string containing the linked image.
  58   */
  59  function theme_site_map_feed_icon($url, $type = 'node') {
  60    $output = '';
  61  
  62    switch ($type) {
  63      case 'node':
  64        $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small.png'), t('Syndicate content'), t('Syndicate content'));
  65        break;
  66      case 'comment':
  67        $output = theme('image', (drupal_get_path('module', 'site_map') .'/feed-small-comment.png'), t('Syndicate comments'), t('Syndicate comments'));
  68        break;
  69    }
  70  
  71    if ($url) {
  72      $output = l($output, $url, array('attributes' => array('class' => 'feed-link'), 'html' => TRUE));
  73    }
  74  
  75    return $output;
  76  }
  77  
  78  /**
  79   * This is a clone of the core theme_menu_tree() function with the exception of
  80   * the site_map specific class name used in the UL that also allow themers to
  81   * override the function only for the site map page.
  82   *
  83   * Generate the HTML output for a menu tree
  84   *
  85   * @ingroup themeable
  86   */
  87  function theme_site_map_menu_tree($tree) {
  88    return '<ul class="site-map-menu">'. $tree .'</ul>';
  89  }
  90  
  91  /**
  92   * This is a one by one clone of the core theme_menu_item() function that allows
  93   * custom theming of the site map page items.
  94   *
  95   * Generate the HTML output for a menu item and submenu.
  96   *
  97   * @ingroup themeable
  98   */
  99  function theme_site_map_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
 100    $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
 101    if (!empty($extra_class)) {
 102      $class .= ' '. $extra_class;
 103    }
 104    if ($in_active_trail) {
 105      $class .= ' active-trail';
 106    }
 107    return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
 108  }
 109  
 110  /**
 111   * Process variables for site-map.tpl.php.
 112   *
 113   * @see site-map.tpl.php
 114   */
 115  function template_preprocess_site_map(&$variables) {
 116    $variables['message'] = check_markup(variable_get('site_map_message', ''), variable_get('site_map_message_format', FILTER_FORMAT_DEFAULT));
 117  
 118    if ((variable_get('site_map_show_rss_links', 1) != 0) && module_exists('commentrss') && variable_get('commentrss_site', COMMENTRSS_SITE_FRONT_PAGE)) {
 119      $variables['rss_legend'] = theme('site_map_rss_legend');
 120    }
 121  
 122    if (variable_get('site_map_show_front', 1)) {
 123      $variables['front_page'] = _site_map_front_page();
 124    }
 125  
 126    if (variable_get('site_map_show_blogs', 1)) {
 127      $variables['blogs'] = _site_map_blogs();
 128    }
 129  
 130    // Compile the books trees.
 131    $variables['books'] = _site_map_books();
 132  
 133    // Compile the menu trees.
 134    $variables['menus'] = _site_map_menus();
 135  
 136    if (variable_get('site_map_show_faq', 0)) {
 137      $variables['faq'] = _site_map_faq();
 138    }
 139  
 140    // Compile the vocabulary trees.
 141    $variables['taxonomys'] = _site_map_taxonomys();
 142  
 143    // Invoke all custom modules and get themed HTML to be integrated into the site map.
 144    $additional = module_invoke_all('site_map');
 145    foreach ($additional as $themed_site_map_code) {
 146      $variables['additional'] .= $themed_site_map_code;
 147    }
 148  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7