コード例 #1
0
function get_the_course_details($args = NULL)
{
    $defaults = array('course_id' => get_the_ID());
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $precourse = get_post_meta($course_id, 'vibe_pre_course', true);
    $maximum = get_post_meta($course_id, 'vibe_max_students', true);
    $badge = get_post_meta($course_id, 'vibe_course_badge', true);
    $certificate = get_post_meta($course_id, 'vibe_course_certificate', true);
    $level = vibe_get_option('level');
    if (isset($level) && $level) {
        $levels = get_the_term_list($course_id, 'level', '', ', ', '');
    }
    $course_details = array('price' => '<li>' . bp_course_get_course_credits('course_id=' . $course_id) . '</li>', 'precourse' => isset($precourse) && $precourse != '' ? '<li><i class="icon-clipboard-1"></i> ' . __('* REQUIRES', 'vibe') . ' <a href="' . get_permalink($precourse) . '">' . get_the_title($precourse) . '</a></li>' : '', 'time' => '<li><i class="icon-clock"></i><span class="tongthoigiankhoahoc">' . tongthoigianvideokhoahoc(get_the_ID()) . '</span></li>', 'level' => isset($level) && $level && strlen($levels) > 5 ? '<li><i class="icon-bars"></i> ' . $levels . '</li>' : '', 'seats' => isset($maximum) && is_numeric($maximum) && $maximum < 9999 ? '<li><i class="icon-users"></i> ' . $maximum . ' ' . __('SEATS', 'vibe') . '</li>' : '', 'badge' => isset($badge) && $badge && $badge != ' ' ? '<li><i class="icon-award-stroke"></i> ' . __('Course Badge', 'vibe') . '</li>' : '', 'certificate' => vibe_validate($certificate) ? '<li><i class="icon-certificate-file"></i>  ' . __('Course Certificate', 'vibe') . '</li>' : '');
    $course_details = apply_filters('wplms_course_details_widget', $course_details);
    global $post;
    $return = '<div class="course_details">
              <ul>';
    foreach ($course_details as $course_detail) {
        if (isset($course_detail) && strlen($course_detail) > 5) {
            $return .= $course_detail;
        }
    }
    $return .= '</ul>
            </div>';
    return apply_filters('wplms_course_front_details', $return);
}
コード例 #2
0
ファイル: front.php プロジェクト: songlequang/myclass
                         </div>
                         <div>
                             <?php 
 echo __('Học viên: ') . $students;
 ?>
                         </div>
                     </div>
                     <div class="col-md-4">
                         <div>
     <span>
         <i class="iconthongtinchungkhoahoc icon-clock"></i>
     </span>
                         </div>
                         <div>
                             <?php 
 echo __('Thời gian: ') . tongthoigianvideokhoahoc(get_the_ID());
 ?>
                         </div>
                     </div>
                     <div class="col-md-4">
                         <div>
     <span>
         <i class="iconthongtinchungkhoahoc icon-text-document"></i>
     </span>
                         </div>
                         <div>
                             <?php 
 echo __('Bài học: ') . count($units);
 ?>
                         </div>
                     </div>
コード例 #3
0
ファイル: functions.php プロジェクト: songlequang/myclass
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;
}
コード例 #4
0
ファイル: jsoncourseapi.php プロジェクト: songlequang/myclass
    //lấy giá khóa học
    $price_course = get_post_meta($course_id, "vibe_mycred_points", true) . ".000 VNĐ";
    //lấy chức vụ giảng viên
    $field = vibe_get_option('instructor_field');
    $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id);
    //lấy đánh giá
    $reviews = get_post_meta(get_the_ID(), 'average_rating', true);
    $count = get_post_meta(get_the_ID(), 'rating_count', true);
    //lấy hình giảng viên
    $avatar_instructor = get_avatar($instructor_id);
    $regex = '/(^.*src="|" w.*$)/';
    $avatar_instructor = preg_replace($regex, '', $avatar_instructor);
    $avatar_link = bp_core_get_user_domain($instructor_id);
    //lấy link khóa học
    $link_course = get_permalink($course_id);
    //lấy số lượng video khóa học
    $total_time = tongthoigianvideokhoahoc($course_id);
    $content = array("title" => $course_title, "img" => $course_avatar, "amount_students" => $amount_student, "name_instructor" => $instructor_name, "price_course" => $price_course, "special" => $special, "reviews" => $reviews, "reviews_count" => $count, "avatar" => $avatar_instructor, "link_course" => $link_course, "total_time" => "{$total_time}", "total_video" => "{$dem1}", "link_user" => $avatar_link);
    $JSon = json_encode($content);
    if ($wp_query->post_count == $dem) {
        echo $JSon;
    } else {
        echo $JSon . ',';
    }
    $dem++;
}
echo ']}';
wp_reset_postdata();
?>