You are here

function theme_cctags_level in cctags 7

Same name and namespace in other branches
  1. 8 cctags.module \theme_cctags_level()
  2. 6 cctags.module \theme_cctags_level()
2 theme calls to theme_cctags_level()
cctags_page in ./cctags.page.inc
@file
theme_cctags_block in ./cctags.module

File

./cctags.module, line 560

Code

function theme_cctags_level($variables) {
  $terms = $variables['terms'];
  $amount = $variables['amount'];
  $page = $variables['page'];
  $mode = $variables['mode'];
  $vocname = $variables['vocname'];
  $out = $variables['out'];
  $output = '';
  $start_term = $amount * $page;
  $end_term = $start_term + $amount;
  $cur_term = 0;
  $is_out = array();
  $term_out = '';
  $vocname_out = '';
  foreach ($terms as $voc => $tags) {
    if (is_numeric($voc)) {
      $is_out[$voc] = 0;
      foreach ($tags as $term) {
        if (is_object($term) && $term->tid) {
          if ($cur_term >= $start_term && $cur_term < $end_term || $amount == 0) {
            $is_out[$voc] = 1;
            $term_out .= theme('cctags_term', array(
              'term' => $term,
              'mode' => $out,
            ));
          }
          $cur_term++;
        }
      }
      if ($out == 'page') {
        $vn = NULL;
        if ($vocname) {
          $vn = $terms[$voc]['vocname'];
        }
        $vocname_out = theme('cctags_vocname', array(
          'vocname' => $vn,
          'vid' => $terms[$voc]['vid'],
          'terms' => $terms[$voc]['terms'],
          'mode' => $mode,
          'is_out' => $is_out,
        ));
      }
      $output .= $vocname_out . $term_out;
      $term_out = '';
    }
  }
  return $output;
}