Beispiel #1
0
function hienthikhoahoctrangchu()
{
    $term_id = $_POST['term_id'];
    $name_term = $_POST['name_term'];
    $language_id = $_POST['name_term_language'];
    $level_id = $_POST['name_term_level'];
    $page = $_POST['page_ajax_term'];
    $name_term_language_text = $_POST['name_term_language_text'];
    $name_term_level_text = $_POST['name_term_level_text'];
    if ($language_id == 0 && $level_id == 0) {
        $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'paged' => $page, 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => "DESC"));
    } else {
        if ($level_id != 0 && $language_id == 0) {
            $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'level', 'terms' => $level_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC'));
        } else {
            if ($level_id == 0 && $language_id != 0) {
                $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'language-category', 'terms' => $language_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC'));
            } else {
                if ($level_id != 0 && $language_id != 0) {
                    $arg = array('post_type' => 'course', 'posts_per_page' => 6, 'tax_query' => array(array('taxonomy' => 'language-category', 'terms' => $language_id, 'field' => 'term_id'), array('taxonomy' => 'course-cat', 'terms' => $term_id, 'field' => 'term_id'), array('taxonomy' => 'level', 'terms' => $level_id, 'field' => 'term_id'), 'orderby' => 'id', 'order' => 'DESC'));
                }
            }
        }
    }
    echo '<ul class="breadcrumb-trangchu"><li><span class="breadcrumb-trangchu-dskhoahoc">Danh sách khóa học</span></li></ul>';
    //    echo '<ul class="breadcrumb-trangchu"><li><a href="'.get_home_url().'">Tất cả khóa học</a> > <a class="danhmuckhoahoc"><span data-id="'.$term_id.'">'.$name_term.'</span></a></li></ul>';
    echo '<ul class="breadcrumb-level">';
    //    if($name_term_level_text=="Tất cả" && $name_term_language_text=="Tất cả"){
    //        echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>';
    ////        if($name_term == "Tất cả"){
    ////            echo '<li>Danh mục: <span>'.$name_term.'</span></li>';
    ////        }else{
    //            echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>';
    ////        }
    //        echo '<li>Cấp độ: <span>Tất cả</span></li>';
    //        echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>';
    //    }else if($name_term_level_text!="Tất cả" && $name_term_language_text=="Tất cả"){
    //        echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>';
    ////        if($name_term == "Tất cả"){
    ////            echo '<li>Danh mục: <span>'.$name_term.'</span></li>';
    ////        }else{
    //            echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>';
    ////        }
    //        echo '<li>Cấp độ: <span>'.$name_term_level_text.'</span><i class="icon-x"></i></li>';
    //        echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>';
    //    }else if($name_term_level_text=="Tất cả" && $name_term_language_text!="Tất cả"){
    //        echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>';
    ////        if($name_term == "Tất cả"){
    ////            echo '<li>Danh mục: <span>'.$name_term.'</span></li>';
    ////        }else{
    //            echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>';
    ////        }
    //        echo '<li>Cấp độ: <span>Tất cả</span></li>';
    //        echo '<li>Ngôn ngữ lập trình: <span>'.$name_term_language_text.'</span><i class="icon-x"></i></li>';
    //    }else{
    //        echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>';
    ////        if($name_term == "Tất cả"){
    ////            echo '<li>Danh mục: <span>'.$name_term.'</span></li>';
    ////        }else{
    //            echo '<li>Danh mục: <span>'.$name_term.'</span><i class="icon-x"></i></li>';
    ////        }
    //        echo '<li>Cấp độ: <span>'.$name_term_level_text.'</span><i class="icon-x"></i></li>';
    //        echo '<li>Ngôn ngữ lập trình: <span>'.$name_term_language_text.'</span><i class="icon-x"></i></li>';
    //    }
    echo '<li class="breadcrumb-trangchu-boloc">Đang lọc theo:</li>';
    echo '<li>Danh mục: <span>' . $name_term . '</span><i class="icon-x" data-id="1"></i></li>';
    if ($level_id == 0) {
        echo '<li>Cấp độ: <span>Tất cả</span></li>';
    } else {
        echo '<li>Cấp độ: <span>' . $name_term_level_text . '</span><i class="icon-x" data-id="2"></i></li>';
    }
    if ($language_id == 0) {
        echo '<li>Ngôn ngữ lập trình: <span>Tất cả</span></li>';
    } else {
        echo '<li>Ngôn ngữ lập trình: <span>' . $name_term_language_text . '</span><i class="icon-x" data-id="3"></i></li>';
    }
    echo '</ul>';
    $wp_query = new WP_Query($arg);
    $countcourse = count($wp_query);
    if ($countcourse == 0) {
        echo "Không tìm thấy khóa học";
    } else {
        echo '<ul class="grid">';
        while ($wp_query->have_posts()) {
            $wp_query->the_post();
            $course_id = get_the_ID();
            $course_curriculum = vibe_sanitize(get_post_meta($course_id, 'vibe_course_curriculum', false));
            $dem = 0;
            if (isset($course_curriculum)) {
                foreach ($course_curriculum as $item) {
                    if (isset($item)) {
                        $dem++;
                    }
                }
            }
            echo '<li class="clear3 col-md-4">';
            echo '<div class="block courseitem">';
            echo '<div class="block_media">';
            echo bp_course_avatar();
            echo '<div class="avatar-list"><div class="hinhgiangvien">' . bp_course_get_instructor_avatar() . '</div><div class="tongbaihoc">' . $dem . ' bài học</div>' . '<div class="thoiluongvideo">Video ' . tongthoigianvideokhoahoc($course_id) . '</div>' . '</div>';
            echo nuthanhtoan();
            echo '</div>';
            echo '<div class="block_content">';
            echo '<h4 class="block_title">';
            echo bp_course_title();
            echo '</h4>';
            echo '<div class="item-meta">';
            echo bp_course_meta();
            echo '</div>';
            //            echo '<div class="item-credits">';
            //            echo bp_course_credits();
            //            echo '</div>';
            echo '<div class="item-instructor">';
            echo bp_course_instructor();
            echo '</div>';
            echo '<div class="item-action">';
            echo bp_course_action();
            echo '</div>';
            echo '<div class="item_process">';
            echo '</div>';
            echo do_action('bp_directory_course_item');
            echo '<div class="clear"></div>';
            echo '<div class="item-credits" style="width:100%; padding-top:12px; border-top:1px solid #EEE">';
            echo bp_course_credits();
            echo '</div>';
            echo '</div>';
            echo '<div class="clear"></div>';
            echo '</div>';
            echo '</li>';
        }
        echo '</ul><p></p>';
        wp_reset_postdata();
        echo '<div class="clear"></div>';
        // phân trang trang chủ
        $num_page = $wp_query->max_num_pages;
        // echo '<div><ul class="sophantrang">';
        // if(empty($page)){
        // for($i=1; $i<6; $i++){
        // if($i <= $num_page){
        // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$i.'"><span>'.$i.'</span></a></li>';
        // }else{
        // return  die();
        // }
        // }
        // echo '<li><span>...</span></li>';
        // }else{
        // if($page !=1){
        // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="1"><span> << Trang đầu</span></a></li>';
        // echo '<li><span>...</span></li>';
        // }
        // for($i=$page; $i<$page+5; $i++){
        // if($i <= $num_page){
        // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$i.'"><span>'.$i.'</span></a></li>';
        // }else{
        // return  die();
        // }
        // }
        // if($page+5 <= $num_page){
        // echo '<li><span>...</span></li>';
        // }
        // }
        // echo '<li><a class="sotrangajax" data-name="'.$name_term.'" data-term="'.$term_id.'" data-id="'.$num_page.'"><span>Trang cuối >></span></a></li>';
        // echo '</ul></div>';
        echo '<div><ul class="sophantrang">';
        if (empty($page)) {
            for ($i = 1; $i < 6; $i++) {
                if ($i <= $num_page) {
                    if ($i == 1) {
                        echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange"><span>' . $i . '</span></li></a>';
                    } else {
                        echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>';
                    }
                } else {
                    return die;
                }
            }
            echo '<li><span>...</span></li>';
        } else {
            if ($page % 6 == 0) {
                echo '<a class="sotrang" data-id="1"><li><span> << Trang đầu</span></li></a>';
                echo '<li><span>...</span></li>';
                for ($i = $page; $i < $page + 5; $i++) {
                    if ($i <= $num_page) {
                        if ($i == $page) {
                            echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange" ><span>' . $i . '</span></li></a>';
                        } else {
                            echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>';
                        }
                    } else {
                        return die;
                    }
                }
            } else {
                for ($i = 1; $i < $page + 5; $i++) {
                    if ($i <= $num_page) {
                        if ($i == $page) {
                            echo '<a class="sotrang" data-id="' . $i . '"><li style="background-color: orange" ><span>' . $i . '</span></li></a>';
                        } else {
                            echo '<a class="sotrang" data-id="' . $i . '"><li><span>' . $i . '</span></li></a>';
                        }
                    } else {
                        return die;
                    }
                }
            }
            if ($page + 5 <= $num_page) {
                echo '<li><span>...</span></li>';
            }
        }
        echo '<a class="sotrang" data-id="' . $num_page . '"><li><span>Trang cuối >></span></li></a>';
        echo '</ul></div>';
    }
    die;
}
Beispiel #2
0
</a>
                    </li>
                    <li class="tab-btn btn-review">
                        <a href="#review"><?php 
_e('Đánh giá', 'vibe');
?>
</a>
                    </li>
                </ul>
            </div>

            <div class="col-md-4 col-sm-4">
                <div class="row button-hoc">
                    <div class="btn-hoc col-md-6 col-sm-6">
                        <?php 
nuthanhtoan();
?>
                    </div>

                    <div class="gia-hidenmenu col-md-6 col-sm-6">
                        <?php 
bp_course_credits();
?>
                    </div>
                </div>
            </div>
        </div>
    </div>
	    <div class="container">
	        <div class="row">
            </div>