to print out one level menu navigation * * @param Array Array of pages * * @return String HTML UL formatted string * */ if( ! function_exists('get_navigation')) { function get_navigation($items) { $nav = ''; foreach($items as $key => $page) { $active = ( ! empty($page['active_class'])) ? ' class="'.$page['active_class'].'" ' : ''; $title = ($page['nav_title'] != '') ? $page['nav_title'] : $page['title']; // Adds the suffix if defined in /application/config.php // if ( config_item('url_suffix') != '' ) $url .= config_item('url_suffix'); $nav .= ''.$title. ''; } return $nav; } } /** * Returns a HTML UL formatted nested tree menu from a pages nested array * Used by to print out a nested navigation * * @param Array Array of pages * @param Array Array of container UL (first one) attributes. Can contains 'id' and 'class' * * @return String HTML UL formatted string * */ if( ! function_exists('get_tree_navigation')) { function get_tree_navigation($items, $id = NULL, $class = NULL, $first_class = NULL, $last_class = NULL) { // HTML Attributes $id = ( ! is_null($id) ) ? ' id="' . $id . '" ' : ''; $class = ( ! is_null($class) ) ? ' class="' . $class . '" ' : ''; log_message('error', $class); $tree = ''; foreach($items as $key => $page) { if ($key !== 'articles') { $class = array(); if (( ! empty($page['active_class']))) $class[] = $page['active_class']; if ($key == 0 && ! is_null($first_class)) $class[] = $first_class; if ($key == (count($items) - 1) && ! is_null($last_class)) $class[] = $last_class; if (! empty($page['children'])) $class[] = 'dropdown'; $class = ( ! empty($class)) ? ' class="'.implode(' ', $class).'"' : ''; $title = ($page['nav_title'] != '') ? $page['nav_title'] : $page['title']; // BLS Bootstrap 3 separator if($page['subtitle'] == 'separator-first') { $tree .= ' '; } else if($page['subtitle'] == 'separator') { $tree .= ' '; } else { $tree .= '' . $title . ((! empty($page['children'])) ? ' ' : '') . ''; } if (!empty($page['children'])) $tree .= get_tree_navigation($page['children']); if (!empty($page['articles'])) { $tree .= ''; foreach($page['articles'] as $article) { $class = array(); if (( ! empty($article['active_class']))) $class[] = $article['active_class']; if ($key == 0 && ! is_null($first_class)) $class[] = $first_class; if ($key == (count($page['articles']) - 1) && ! is_null($last_class)) $class[] = $last_class; $class = ( ! empty($class)) ? ' class="'.implode(' ', $class).'"' : ''; $tree .= ''.$article['title']. ''; } $tree .= ''; } $tree .= ''; } } if ( ! empty($items['articles'])) { foreach($items['articles'] as $article) { $class = array(); if (( ! empty($article['active_class']))) $class[] = $article['active_class']; if ($key == 0 && ! is_null($first_class)) $class[] = $first_class; if ($key == (count($items['articles']) - 1) && ! is_null($last_class)) $class[] = $last_class; $class = ( ! empty($class)) ? ' class="'.implode(' ', $class).'"' : ''; $tree .= ''.$article['title']. ''; } } $tree .= ''; return $tree; } } if( ! function_exists('get_language_navigation')) { /** * Returns a HTML UL formatted nested tree menu from a pages nested array * Used by to print out the languages menu * * @deprecated * * @param Array Array of pages * @param Array Array of container UL (first one) attributes. Can contains 'id' and 'class' * * @return String HTML UL formatted string * */ function get_language_navigation($items) { $nav = ''; foreach($items as $lang) { $active = ( ! empty($lang['active_class'])) ? ' class="'.$lang['active_class'].'" ' : ''; $nav .= '' . $lang['name']. ''; } return $nav; } } if( ! function_exists('get_next_prev_page')) { /** * Returns the previous / next page enclosed in the given tag * * @deprecated Use the and tags * * @param $page * @param $prefix * * @return string */ function get_next_prev_page($page, $prefix) { $prefix = (lang($prefix) != '#'.$prefix ) ? lang($prefix) : $prefix; $title = ($page['nav_title'] != '') ? $page['nav_title'] : $page['title']; $link = $prefix. '' . $title . ''; return $link; } } if( ! function_exists('get_next_prev_article')) { /** * Returns the previous / next article enclosed in the given tag * * @deprecated Use the and tags * */ function get_next_prev_article($article, $prefix) { $prefix = (lang($prefix) != '#'.$prefix ) ? lang($prefix) : $prefix; $link = $prefix. '' . $article['title']. ''; return $link; } } /* End of file navigation_helper.php */ /* Location: .application/helpers/navigation_helper.php */