예제 #1
0
/**
 * bp_course_nav_menu()
 * Navigation menu for BuddyPress course
 */
function bp_course_nav_menu()
{
    $nav = bp_course_get_nav_permalinks();
    $defaults = array('' => array('id' => 'home', 'label' => __('Home', 'vibe'), 'action' => '', 'link' => bp_get_course_permalink()), 'curriculum' => array('id' => 'curriculum', 'label' => __('Curriculum', 'vibe'), 'can_view' => 1, 'action' => empty($nav['curriculum_slug']) ? __('curriculum', 'vibe') : $nav['curriculum_slug'], 'link' => bp_get_course_permalink()), 'members' => array('id' => 'members', 'label' => __('Members', 'vibe'), 'can_view' => 1, 'action' => empty($nav['members_slug']) ? __('members', 'vibe') : $nav['members_slug'], 'link' => bp_get_course_permalink()), 'activity' => array('id' => 'activity', 'label' => __('Activity', 'vibe'), 'can_view' => 1, 'action' => empty($nav['activity_slug']) ? __('activity', 'vibe') : $nav['activity_slug'], 'link' => bp_get_course_permalink()));
    global $post;
    if ($post->post_type == 'course') {
        if (function_exists('bp_is_active') && bp_is_active('groups')) {
            $vgroup = get_post_meta(get_the_ID(), 'vibe_group', true);
            if (!empty($vgroup)) {
                $group = groups_get_group(array('group_id' => $vgroup));
                $defaults['group'] = array('id' => 'group', 'label' => __('Group', 'vibe'), 'action' => 'group', 'can_view' => 1, 'link' => bp_get_group_permalink($group), 'external' => true);
            }
        }
        if (in_array('bbpress/bbpress.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('bbpress/bbpress.php')) {
            $forum = get_post_meta(get_the_ID(), 'vibe_forum', true);
            if (!empty($forum)) {
                $defaults['forum'] = array('id' => 'forum', 'label' => __('Forum', 'vibe'), 'action' => 'forum', 'can_view' => 1, 'link' => get_permalink($forum), 'external' => true);
            }
        }
    }
    $nav_menu = apply_filters('wplms_course_nav_menu', $defaults);
    global $bp;
    $action = bp_current_action();
    if (empty($action)) {
        !empty($_GET['action']) ? $action = $_GET['action'] : ($action = '');
    }
    if (is_array($nav_menu)) {
        foreach ($nav_menu as $key => $menu_item) {
            $menu_item['action'] = str_replace('/', '', $menu_item['action']);
            if ($key == $action) {
                $class = 'class="current"';
            } else {
                $class = '';
            }
            global $wp_query;
            if (!empty($nav[$menu_item['id'] . '_slug'])) {
                echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (isset($menu_item['action']) && !isset($menu_item['external']) ? $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
            } else {
                echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (!empty($menu_item['action']) && !isset($menu_item['external']) ? (strpos($menu_item['link'], '?') ? '&' : '?') . 'action=' . $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
            }
        }
    }
    if (is_super_admin() || is_instructor()) {
        $admin_slug = empty($nav['admin_slug']) ? _x('admin', 'course admin slug', 'vibe') : $nav['admin_slug'];
        $admin_slug = apply_filters('wplms_course_admin_slug', str_replace('/', '', $admin_slug));
        ?>
      <li id="admin" class="<?php 
        echo !empty($action) && ($action == 'admin' || $action == 'submission' || $action == 'stats') ? 'selected current' : '';
        ?>
"><a href="<?php 
        bp_course_permalink();
        echo $admin_slug;
        ?>
"><?php 
        _e('Admin', 'vibe');
        ?>
</a></li>
      <?php 
    }
}
예제 #2
0
 function wplms_eventon_link($nav_menu)
 {
     $permalinks = get_option('vibe_course_permalinks');
     $events_slug = $permalinks['events_slug'] ? $permalinks['events_slug'] : 'events';
     $nav_menu['events'] = array('id' => 'events', 'label' => __('Events ', 'wplms-eventon'), 'action' => $events_slug, 'link' => bp_get_course_permalink());
     return $nav_menu;
 }
예제 #3
0
 function wplms_course_news_menu($links)
 {
     if (function_exists('vibe_get_option')) {
         $show_news = vibe_get_option('show_news');
         if (isset($show_news) && $show_news) {
             $links['news'] = array('id' => 'news', 'label' => __('News', 'wplms-dashboard'), 'action' => 'news', 'link' => bp_get_course_permalink());
         }
     }
     return $links;
 }
/**
 * bp_course_nav_menu()
 * Navigation menu for BuddyPress course
 */
function bp_course_nav_menu()
{
    $defaults = array('Home' => array('id' => 'home', 'label' => __('Home', 'vibe'), 'action' => '', 'link' => bp_get_course_permalink()), 'curriculum' => array('id' => 'curriculum', 'label' => __('Curriculum', 'vibe'), 'action' => 'curriculum', 'link' => bp_get_course_permalink()), 'members' => array('id' => 'members', 'label' => __('Members', 'vibe'), 'action' => 'members', 'link' => bp_get_course_permalink()));
    $nav_menu = apply_filters('wplms_course_nav_menu', $defaults);
    isset($_GET['action']) ? $action = $_GET['action'] : ($action = '');
    if (is_array($nav_menu)) {
        foreach ($nav_menu as $menu_item) {
            echo '<li id="' . $menu_item['id'] . '" class="' . ($menu_item['action'] == $action ? 'current' : '') . '"><a href="' . $menu_item['link'] . '' . (isset($menu_item['action']) ? (strpos($menu_item['link'], '?') ? '&' : '?') . 'action=' . $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>';
        }
    }
}
function bp_course_permalink($course = false)
{
    echo bp_get_course_permalink($course);
}
 function wplms_events_menu_link($nav_menu)
 {
     $nav_menu['events'] = array('id' => 'events', 'label' => __('Events ', 'wplms-events'), 'action' => 'events', 'link' => bp_get_course_permalink());
     return $nav_menu;
 }
예제 #7
0
 function course_drive_link($nav)
 {
     if (empty($this->permalinks)) {
         $this->permalinks = get_option('vibe_course_permalinks');
     }
     $drive_slug = $this->permalinks['drive_slug'] ? $this->permalinks['drive_slug'] : 'drive';
     $flag = apply_filters('wplms_course_drive_access', 1);
     if (!empty($flag)) {
         $nav['drive'] = array('id' => 'drive', 'label' => __('Drive ', 'vibe'), 'action' => $drive_slug, 'can_view' => 1, 'link' => bp_get_course_permalink());
     }
     return $nav;
 }