Exemplo n.º 1
0
            bp_course_desc();
            ?>
</div>
                        <div class="item-credits">
                            <?php 
            bp_course_credits();
            ?>
                        </div>

                        <div class="item-instructor">
                            <?php 
            bp_course_instructor();
            ?>
                        </div>
                        <div class="item-action"><?php 
            bp_course_action();
            ?>
</div>
                        <div class="item_process">
                            <?php 
            $course_id = $post->ID;
            $unit_id = wplms_get_course_unfinished_unit($post->ID);
            do_action('child_wplms_course_start_after_time', $course_id, $unit_id);
            ?>

                        </div>
                        <?php 
            do_action('bp_directory_course_item');
            ?>

                    </div>
Exemplo n.º 2
0
function child_course_filter()
{
    global $bp;
    $args = array('post_type' => BP_COURSE_CPT);
    if (isset($_POST['filter'])) {
        $filter = $_POST['filter'];
        switch ($filter) {
            case 'popular':
                $args['orderby'] = 'meta_value';
                $args['meta_key'] = 'vibe_students';
                break;
            case 'newest':
                $args['orderby'] = 'date';
                break;
            case 'rated':
                $args['orderby'] = 'meta_value';
                $args['meta_key'] = 'average_rating';
                break;
            case 'alphabetical':
                $args['orderby'] = 'title';
                $args['order'] = 'ASC';
                break;
            default:
                $args['orderby'] = '';
                break;
        }
    }
    if (isset($_POST['search_terms']) && $_POST['search_terms']) {
        $args['search_terms'] = $_POST['search_terms'];
    }
    if (isset($_POST['page'])) {
        $args['paged'] = $_POST['page'];
    }
    if (isset($_POST['scope']) && $_POST['scope'] == 'personal') {
        $uid = get_current_user_id();
        $args['meta_query'] = array(array('key' => $uid, 'compare' => 'EXISTS'));
    }
    if (isset($_POST['scope']) && $_POST['scope'] == 'instructor') {
        $uid = get_current_user_id();
        $args['instructor'] = $uid;
    }
    if (isset($_POST['extras'])) {
        $extras = json_decode(stripslashes($_POST['extras']));
        $course_categories = array();
        $course_levels = array();
        $type = array();
        if (is_array($extras)) {
            foreach ($extras as $extra) {
                switch ($extra->type) {
                    case 'course-cat':
                        $course_categories[] = $extra->value;
                        break;
                    case 'free':
                        $type = $extra->value;
                        break;
                    case 'level':
                        $course_levels[] = $extra->value;
                        break;
                }
            }
        }
        $args['tax_query'] = array();
        if (count($course_categories)) {
            $args['tax_query']['relation'] = 'AND';
            $args['tax_query'][] = array('taxonomy' => 'course-cat', 'terms' => $course_categories, 'field' => 'slug');
        }
        if ($type) {
            switch ($type) {
                case 'free':
                    $args['meta_query']['relation'] = 'AND';
                    $args['meta_query'][] = array('key' => 'vibe_course_free', 'value' => 'S', 'compare' => '=');
                    break;
                case 'paid':
                    $args['meta_query']['relation'] = 'AND';
                    $args['meta_query'][] = array('key' => 'vibe_course_free', 'value' => 'H', 'compare' => '=');
                    break;
            }
        }
        if (count($course_levels)) {
            $args['tax_query']['relation'] = 'AND';
            $args['tax_query'][] = array('taxonomy' => 'level', 'field' => 'slug', 'terms' => $course_levels);
        }
    }
    $loop_number = vibe_get_option('loop_number');
    isset($loop_number) ? $loop_number : ($loop_number = 5);
    $args['per_page'] = $loop_number;
    ?>

    <?php 
    do_action('bp_before_course_loop');
    ?>

    <?php 
    if (bp_course_has_items($args)) {
        ?>

        <div id="pag-top" class="pagination ">

            <div class="pag-count" id="course-dir-count-top">

                <?php 
        bp_course_pagination_count();
        ?>

            </div>

            <div class="pagination-links" id="course-dir-pag-top">

                <?php 
        bp_course_item_pagination();
        ?>

            </div>

        </div>

        <?php 
        do_action('bp_before_directory_course_list');
        $cookie = urldecode($_POST['cookie']);
        if (stripos($cookie, 'course_directory=grid')) {
            $class = 'grid';
        }
        ?>
        <ul id="course-list" class="item-list <?php 
        echo $class;
        ?>
" role="main">

            <?php 
        while (bp_course_has_items()) {
            bp_course_the_item();
            ?>

                <li>
                    <div class="item-avatar">
                        <?php 
            bp_course_avatar();
            ?>

                    </div>

                    <div class="item">
                        <div class="item-title"><?php 
            bp_course_title();
            ?>
</div>
                        <div class="item-meta"><?php 
            bp_course_meta();
            ?>
</div>
                        <div class="item-desc"><?php 
            bp_course_desc();
            ?>
</div>
                        <div class="item-credits">
                            <?php 
            bp_course_credits();
            ?>
                        </div>
                        <div class="item-instructor">
                            <?php 
            bp_course_instructor();
            ?>
                        </div>
                        <div class="item-action"><?php 
            bp_course_action();
            ?>
</div>
                        <?php 
            if ($_POST['scope'] == "personal") {
                ?>
                            <div class="item_process">
                                <?php 
                $course_id = get_the_ID();
                $unit_id = wplms_get_course_unfinished_unit($course_id);
                do_action('child_wplms_course_start_after_time', $course_id, $unit_id);
                ?>

                            </div>
                        <?php 
            }
            ?>
                        <?php 
            do_action('bp_directory_course_item');
            ?>

                    </div>

                    <div class="clear"></div>
                </li>

            <?php 
        }
        ?>

        </ul>

        <?php 
        do_action('bp_after_directory_course_list');
        ?>

        <div id="pag-bottom" class="pagination">

            <div class="pag-count" id="course-dir-count-bottom">

                <?php 
        bp_course_pagination_count();
        ?>

            </div>

            <div class="pagination-links" id="course-dir-pag-bottom">

                <?php 
        bp_course_item_pagination();
        ?>

            </div>

        </div>

    <?php 
    } else {
        ?>

        <div id="message" class="info">
            <p><?php 
        _e('No Courses found.', 'vibe');
        ?>
</p>
        </div>

    <?php 
    }
    ?>


    <?php 
    do_action('bp_after_course_loop');
    ?>
    <?php 
    die;
}
    function bp_course_item_view()
    {
        $filter = apply_filters('bp_course_single_item_view', 0);
        if ($filter) {
            return;
        }
        $course_classes = apply_filters('bp_course_single_item', 'course_single_item', get_the_ID());
        ?>
	
   		<li class="<?php 
        echo $course_classes;
        ?>
">
			<div class="item-avatar" data-id="<?php 
        echo get_the_ID();
        ?>
">
				<?php 
        bp_course_avatar();
        ?>
			</div>

			<div class="item">
				<div class="item-title"><?php 
        bp_course_title();
        if (get_post_status() != 'publish') {
            echo '<i> ( ' . get_post_status() . ' ) </i>';
        }
        ?>
</div>
				<div class="item-meta"><?php 
        bp_course_meta();
        ?>
</div>
				<div class="item-desc"><?php 
        bp_course_desc();
        ?>
</div>
				<div class="item-credits">
					<?php 
        bp_course_credits();
        ?>
				</div>
				<div class="item-instructor">
					<?php 
        bp_course_instructor();
        ?>
				</div>
				<div class="item-action"><?php 
        bp_course_action();
        ?>
</div>
				<?php 
        do_action('bp_directory_course_item');
        ?>

			</div>
			<div class="clear"></div>
		</li>	
   	<?php 
    }
Exemplo n.º 4
0
    function bp_course_item_view()
    {
        $filter = apply_filters('bp_course_single_item_view', 0);
        if ($filter) {
            return;
        }
        $course_classes = apply_filters('bp_course_single_item', 'course_single_item', get_the_ID());
        ?>
	
   		<li class="<?php 
        echo $course_classes;
        ?>
" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
			<div class="item-avatar" itemprop="photo">
				<?php 
        bp_course_avatar();
        ?>
			</div>

			<div class="item">
				<div class="item-title"  itemprop="itemreviewed"><?php 
        bp_course_title();
        if (get_post_status() != 'publish') {
            echo '<i> ( ' . get_post_status() . ' ) </i>';
        }
        ?>
</div>
				<div class="item-meta"><?php 
        bp_course_meta();
        ?>
</div>
				<div class="item-desc"><?php 
        bp_course_desc();
        ?>
</div>
				<div class="item-credits">
					<?php 
        bp_course_credits();
        ?>
				</div>
				<div class="item-instructor">
					<?php 
        bp_course_instructor();
        ?>
				</div>
				<div class="item-action"><?php 
        bp_course_action();
        ?>
</div>
				<?php 
        do_action('bp_directory_course_item');
        ?>

			</div>
			<div class="clear"></div>
		</li>	
   	<?php 
    }