当前位置: 首页>>代码示例>>PHP>>正文


PHP WooThemes_Sensei_Utils::user_completed_course方法代码示例

本文整理汇总了PHP中WooThemes_Sensei_Utils::user_completed_course方法的典型用法代码示例。如果您正苦于以下问题:PHP WooThemes_Sensei_Utils::user_completed_course方法的具体用法?PHP WooThemes_Sensei_Utils::user_completed_course怎么用?PHP WooThemes_Sensei_Utils::user_completed_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WooThemes_Sensei_Utils的用法示例。


在下文中一共展示了WooThemes_Sensei_Utils::user_completed_course方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setup_course_query

 /**
  * Sets up the object course query
  * that will be used int he render method.
  *
  * @since 1.9.0
  */
 protected function setup_course_query()
 {
     $status_query = array('user_id' => get_current_user_id(), 'type' => 'sensei_course_status');
     $course_statuses = WooThemes_Sensei_Utils::sensei_check_for_activity($status_query, true);
     // User may only be on 1 Course
     if (!is_array($course_statuses)) {
         $course_statuses = array($course_statuses);
     }
     $completed_ids = $active_ids = array();
     foreach ($course_statuses as $course_status) {
         if (WooThemes_Sensei_Utils::user_completed_course($course_status, get_current_user_id())) {
             $completed_ids[] = $course_status->comment_post_ID;
         } else {
             $active_ids[] = $course_status->comment_post_ID;
         }
     }
     if ('completed' == $this->status) {
         $included_courses = $completed_ids;
     } elseif ('active' == $this->status) {
         $included_courses = $active_ids;
     } else {
         $included_courses = array_merge($active_ids, $completed_ids);
     }
     // course query parameters
     $query_args = array('post_type' => 'course', 'post_status' => 'publish', 'orderby' => $this->orderby, 'order' => $this->order, 'posts_per_page' => $this->number, 'post__in' => $included_courses);
     $this->query = new WP_Query($query_args);
 }
开发者ID:RiaanKnoetze,项目名称:sensei,代码行数:33,代码来源:class-sensei-shortcode-user-courses.php

示例2: savedquest_options


//.........这里部分代码省略.........
                        echo '<br />';
                    }
                    // End For Loop
                    echo "</td>";
                    echo "<td>";
                    echo $diftime;
                    echo "</td>";
                    echo "</tr>";
                    //echo $course->post_title." (".$course_status_update['percent'][0]."% Complete) (". $incomplete . "% incomplete) (". $course_user_grade . "% Competent)<br />";
                    $i++;
                }
            }
        }
        echo "</table>";
    } elseif ($tab == "threshold") {
        //declare the wpdb for custom query
        global $wpdb;
        //check for submitted data
        if (isset($_POST['submittreshold']) && ($_POST['submittreshold'] = "submit")) {
            // declare users and variables
            $allUsers = get_users();
            $modules_completed = $_POST['completionpermonth'];
            $courseid = $_POST['course'];
            $course_name = get_the_title($courseid);
            $array_to_csv = array(array('Student Name', 'Course Name '));
            //user loop ----- loop user get the groups and course the course they take
            foreach ($allUsers as $user) {
                //declare course function calls
                $course_user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($courseid, $user->ID);
                $user_course_status = WooThemes_Sensei_Utils::user_course_status($courseid, $user->ID);
                $course_status_info = get_comment_meta($user_course_status->comment_ID);
                $started_course = WooThemes_Sensei_Utils::user_started_course($courseid, $user->ID);
                $course_status = WooThemes_Sensei_Utils::sensei_user_course_status_message($courseid, $user->ID);
                $completed_course = WooThemes_Sensei_Utils::user_completed_course($user_course_status);
                //get the user groups
                $useringroup = new Groups_User($user->ID);
                $user_groups = $useringroup->__get('groups');
                $displayed_lessons = array();
                //declare and get module values
                $modules = Sensei()->modules->get_course_modules(intval($courseid));
                $modules_content = Sensei()->modules->course_module_content(intval($courseid));
                //echo "<pre>";
                //echo $user->user_email."<br />";
                //echo "sensei_user_course_status_message: ";
                //print_r($course_status);
                //echo "<br />";
                //echo "started_course: "."<br />";
                $course_status_info['start'][0];
                $datenow = date('Y-m-d h:i:s');
                $date1 = date_create($course_status_info['start'][0]);
                $date2 = date_create($datenow);
                $diff = date_diff($date1, $date2);
                $diftime = $diff->format("%m");
                if ($diftime < 1) {
                    $diftime = 1;
                }
                //echo "</pre>";
                //module loop per user
                foreach ($modules as $module) {
                    $args = array('post_type' => 'lesson', 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_lesson_course', 'value' => intval($courseid), 'compare' => '=')), 'tax_query' => array(array('taxonomy' => Sensei()->modules->taxonomy, 'field' => 'id', 'terms' => intval($module->term_id))), 'meta_key' => '_order_module_' . $module->term_id, 'orderby' => 'meta_value_num date', 'order' => 'ASC', 'suppress_filters' => 0);
                    $lessons = get_posts($args);
                    $num_of_lesson = count($lessons);
                    //lessson loop per user
                    foreach ($lessons as $lesson_item) {
                        $is_lesson_completed = WooThemes_Sensei_Utils::user_completed_lesson($lesson_item->ID, $user->ID);
                        if ($is_lesson_completed == 1) {
开发者ID:Ezyva2015,项目名称:opendooronline.com.au,代码行数:67,代码来源:fp-sensei-extended-function.php

示例3: check_user_permissions

 /**
  * check_user_permissions function.
  *
  * @access public
  * @param string $page (default: '')
  * @param array $data (default: array())
  * @return void
  */
 public function check_user_permissions($page = '', $data = array())
 {
     // REFACTOR
     global $current_user, $post;
     if (!isset($current_user)) {
         return;
     }
     // Get User Meta
     get_currentuserinfo();
     $user_allowed = false;
     switch ($page) {
         case 'course-single':
             // check for prerequisite course or lesson,
             $course_prerequisite_id = (int) get_post_meta($post->ID, '_course_prerequisite', true);
             $update_course = $this->woocommerce_course_update($post->ID);
             // Count completed lessons
             if (0 < absint($course_prerequisite_id)) {
                 $prerequisite_complete = WooThemes_Sensei_Utils::user_completed_course($course_prerequisite_id, $current_user->ID);
             } else {
                 $prerequisite_complete = true;
             }
             // End If Statement
             // Handles restrictions
             if (!$prerequisite_complete && 0 < absint($course_prerequisite_id)) {
                 $this->permissions_message['title'] = get_the_title($post->ID) . ': ' . __('Restricted Access', 'woothemes-sensei');
                 $course_link = '<a href="' . esc_url(get_permalink($course_prerequisite_id)) . '">' . __('course', 'woothemes-sensei') . '</a>';
                 $this->permissions_message['message'] = sprintf(__('Please complete the previous %1$s before taking this course.', 'woothemes-sensei'), $course_link);
             } else {
                 $user_allowed = true;
             }
             // End If Statement
             break;
         case 'lesson-single':
             // Check for WC purchase
             $lesson_course_id = get_post_meta($post->ID, '_lesson_course', true);
             $update_course = $this->woocommerce_course_update($lesson_course_id);
             $is_preview = WooThemes_Sensei_Utils::is_preview_lesson($post->ID);
             if ($this->access_settings() && WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID)) {
                 $user_allowed = true;
             } elseif ($this->access_settings() && false == $is_preview) {
                 $user_allowed = true;
             } else {
                 $this->permissions_message['title'] = get_the_title($post->ID) . ': ' . __('Restricted Access', 'woothemes-sensei');
                 $course_link = '<a href="' . esc_url(get_permalink($lesson_course_id)) . '">' . __('course', 'woothemes-sensei') . '</a>';
                 $wc_post_id = get_post_meta($lesson_course_id, '_course_woocommerce_product', true);
                 if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated() && 0 < $wc_post_id) {
                     if ($is_preview) {
                         $this->permissions_message['message'] = sprintf(__('This is a preview lesson. Please purchase the %1$s to access all lessons.', 'woothemes-sensei'), $course_link);
                     } else {
                         $this->permissions_message['message'] = apply_filters('sensei_please_purchase_course_text', sprintf(__('Please purchase the %1$s before starting this Lesson.', 'woothemes-sensei'), $course_link));
                     }
                 } else {
                     if ($is_preview) {
                         $this->permissions_message['message'] = sprintf(__('This is a preview lesson. Please sign up for the %1$s to access all lessons.', 'woothemes-sensei'), $course_link);
                     } else {
                         /** This filter is documented in class-woothemes-sensei-frontend.php */
                         $this->permissions_message['message'] = apply_filters('sensei_please_sign_up_text', sprintf(__('Please sign up for the %1$s before starting the lesson.', 'woothemes-sensei'), $course_link));
                     }
                 }
                 // End If Statement
             }
             // End If Statement
             break;
         case 'quiz-single':
             $lesson_id = get_post_meta($post->ID, '_quiz_lesson', true);
             $lesson_course_id = get_post_meta($lesson_id, '_lesson_course', true);
             $update_course = $this->woocommerce_course_update($lesson_course_id);
             if ($this->access_settings() && WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID) || sensei_all_access()) {
                 // Check for prerequisite lesson for this quiz
                 $lesson_prerequisite_id = (int) get_post_meta($lesson_id, '_lesson_prerequisite', true);
                 $user_lesson_prerequisite_complete = WooThemes_Sensei_Utils::user_completed_lesson($lesson_prerequisite_id, $current_user->ID);
                 // Handle restrictions
                 if (sensei_all_access()) {
                     $user_allowed = true;
                 } else {
                     if (0 < absint($lesson_prerequisite_id) && !$user_lesson_prerequisite_complete) {
                         $this->permissions_message['title'] = get_the_title($post->ID) . ': ' . __('Restricted Access', 'woothemes-sensei');
                         $lesson_link = '<a href="' . esc_url(get_permalink($lesson_prerequisite_id)) . '">' . __('lesson', 'woothemes-sensei') . '</a>';
                         $this->permissions_message['message'] = sprintf(__('Please complete the previous %1$s before taking this Quiz.', 'woothemes-sensei'), $lesson_link);
                     } else {
                         $user_allowed = true;
                     }
                     // End If Statement
                 }
                 // End If Statement
             } elseif ($this->access_settings()) {
                 // Check if the user has started the course
                 if (is_user_logged_in() && !WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID) && (isset($this->settings->settings['access_permission']) && true == $this->settings->settings['access_permission'])) {
                     $user_allowed = false;
                     $this->permissions_message['title'] = get_the_title($post->ID) . ': ' . __('Restricted Access', 'woothemes-sensei');
                     $course_link = '<a href="' . esc_url(get_permalink($lesson_course_id)) . '">' . __('course', 'woothemes-sensei') . '</a>';
                     $wc_post_id = get_post_meta($lesson_course_id, '_course_woocommerce_product', true);
//.........这里部分代码省略.........
开发者ID:drumchannel,项目名称:drumchannel-dev,代码行数:101,代码来源:class-woothemes-sensei.php

示例4: sensei_check_prerequisite_course

/**
 * sensei_check_prerequisite_course function.
 *
 * @access public
 * @param mixed $course_id
 * @return void
 */
function sensei_check_prerequisite_course($course_id)
{
    global $current_user;
    // Get User Meta
    get_currentuserinfo();
    $course_prerequisite_id = (int) get_post_meta($course_id, '_course_prerequisite', true);
    $prequisite_complete = false;
    if (0 < absint($course_prerequisite_id)) {
        $prequisite_complete = WooThemes_Sensei_Utils::user_completed_course($course_prerequisite_id, $current_user->ID);
    } else {
        $prequisite_complete = true;
    }
    // End If Statement
    return $prequisite_complete;
}
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:22,代码来源:woothemes-sensei-template.php

示例5: activate_purchased_single_course

 /**
  * Activate single course if already purchases
  * @return void
  */
 public function activate_purchased_single_course()
 {
     global $post, $current_user;
     if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated()) {
         if (!is_user_logged_in()) {
             return;
         }
         if (!isset($post->ID)) {
             return;
         }
         $user_id = $current_user->ID;
         $course_id = $post->ID;
         $course_product_id = (int) get_post_meta($course_id, '_course_woocommerce_product', true);
         if (!$course_product_id) {
             return;
         }
         $user_course_status = WooThemes_Sensei_Utils::user_course_status(intval($course_id), $user_id);
         // Ignore course if already completed
         if (WooThemes_Sensei_Utils::user_completed_course($user_course_status)) {
             return;
         }
         // Ignore course if already started
         if ($user_course_status) {
             return;
         }
         // Get all user's orders
         $order_args = array('post_type' => 'shop_order', 'posts_per_page' => -1, 'post_status' => array('wc-processing', 'wc-completed'), 'meta_query' => array(array('key' => '_customer_user', 'value' => $user_id)), 'fields' => 'ids');
         $orders = get_posts($order_args);
         foreach ($orders as $order_post_id) {
             // Get course product IDs from order
             $order = new WC_Order($order_post_id);
             $items = $order->get_items();
             foreach ($items as $item) {
                 $product = wc_get_product($item['product_id']);
                 // handle product bundles
                 if ($product->is_type('bundle')) {
                     $bundled_product = new WC_Product_Bundle($product->id);
                     $bundled_items = $bundled_product->get_bundled_items();
                     foreach ($bundled_items as $item) {
                         if ($item->product_id == $course_product_id) {
                             WooThemes_Sensei_Utils::user_start_course($user_id, $course_id);
                             return;
                         }
                     }
                 } else {
                     // handle regular products
                     if ($item['product_id'] == $course_product_id) {
                         WooThemes_Sensei_Utils::user_start_course($user_id, $course_id);
                         return;
                     }
                 }
             }
         }
     }
 }
开发者ID:Ezyva2015,项目名称:opendooronline.com.au,代码行数:59,代码来源:class-woothemes-sensei-frontend.php

示例6: load_user_courses_content

    /**
     * load_user_courses_content generates HTML for user's active & completed courses
     * @since  1.4.0
     * @param  object  $user   Queried user object
     * @param  boolean $manage Whether the user has permission to manage the courses
     * @return string          HTML displayng course data
     */
    public function load_user_courses_content($user = false, $manage = false)
    {
        global $woothemes_sensei, $post, $wp_query, $course, $my_courses_page, $my_courses_section;
        // Build Output HTML
        $complete_html = $active_html = '';
        if ($user) {
            $my_courses_page = true;
            // Allow action to be run before My Courses content has loaded
            do_action('sensei_before_my_courses', $user->ID);
            // Logic for Active and Completed Courses
            $per_page = 20;
            if (isset($woothemes_sensei->settings->settings['my_course_amount']) && 0 < absint($woothemes_sensei->settings->settings['my_course_amount'])) {
                $per_page = absint($woothemes_sensei->settings->settings['my_course_amount']);
            }
            $course_statuses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $user->ID, 'type' => 'sensei_course_status'), true);
            // User may only be on 1 Course
            if (!is_array($course_statuses)) {
                $course_statuses = array($course_statuses);
            }
            $completed_ids = $active_ids = array();
            foreach ($course_statuses as $course_status) {
                if (WooThemes_Sensei_Utils::user_completed_course($course_status, $user->ID)) {
                    $completed_ids[] = $course_status->comment_post_ID;
                } else {
                    $active_ids[] = $course_status->comment_post_ID;
                }
            }
            $active_count = $completed_count = 0;
            $active_courses = array();
            if (0 < intval(count($active_ids))) {
                $my_courses_section = 'active';
                $active_courses = $woothemes_sensei->post_types->course->course_query($per_page, 'usercourses', $active_ids);
                $active_count = count($active_ids);
            }
            // End If Statement
            $completed_courses = array();
            if (0 < intval(count($completed_ids))) {
                $my_courses_section = 'completed';
                $completed_courses = $woothemes_sensei->post_types->course->course_query($per_page, 'usercourses', $completed_ids);
                $completed_count = count($completed_ids);
            }
            // End If Statement
            $lesson_count = 1;
            $active_page = 1;
            if (isset($_GET['active_page']) && 0 < intval($_GET['active_page'])) {
                $active_page = $_GET['active_page'];
            }
            $completed_page = 1;
            if (isset($_GET['completed_page']) && 0 < intval($_GET['completed_page'])) {
                $completed_page = $_GET['completed_page'];
            }
            foreach ($active_courses as $course_item) {
                $course_lessons = $woothemes_sensei->post_types->course->course_lessons($course_item->ID);
                $lessons_completed = 0;
                foreach ($course_lessons as $lesson) {
                    if (WooThemes_Sensei_Utils::user_completed_lesson($lesson->ID, $user->ID)) {
                        ++$lessons_completed;
                    }
                }
                // Get Course Categories
                $category_output = get_the_term_list($course_item->ID, 'course-category', '', ', ', '');
                $active_html .= '<article class="' . esc_attr(join(' ', get_post_class(array('course', 'post'), $course_item->ID))) . '">';
                // Image
                $active_html .= $woothemes_sensei->post_types->course->course_image(absint($course_item->ID));
                // Title
                $active_html .= '<header>';
                $active_html .= '<h2><a href="' . esc_url(get_permalink(absint($course_item->ID))) . '" title="' . esc_attr($course_item->post_title) . '">' . esc_html($course_item->post_title) . '</a></h2>';
                $active_html .= '</header>';
                $active_html .= '<section class="entry">';
                $active_html .= '<p class="sensei-course-meta">';
                // Author
                $user_info = get_userdata(absint($course_item->post_author));
                if (isset($woothemes_sensei->settings->settings['course_author']) && $woothemes_sensei->settings->settings['course_author']) {
                    $active_html .= '<span class="course-author">' . __('by ', 'woothemes-sensei') . '<a href="' . esc_url(get_author_posts_url(absint($course_item->post_author))) . '" title="' . esc_attr($user_info->display_name) . '">' . esc_html($user_info->display_name) . '</a></span>';
                }
                // End If Statement
                // Lesson count for this author
                $lesson_count = $woothemes_sensei->post_types->course->course_lesson_count(absint($course_item->ID));
                // Handle Division by Zero
                if (0 == $lesson_count) {
                    $lesson_count = 1;
                }
                // End If Statement
                $active_html .= '<span class="course-lesson-count">' . $lesson_count . '&nbsp;' . apply_filters('sensei_lessons_text', __('Lessons', 'woothemes-sensei')) . '</span>';
                // Course Categories
                if ('' != $category_output) {
                    $active_html .= '<span class="course-category">' . sprintf(__('in %s', 'woothemes-sensei'), $category_output) . '</span>';
                }
                // End If Statement
                $active_html .= '<span class="course-lesson-progress">' . sprintf(__('%1$d of %2$d lessons completed', 'woothemes-sensei'), $lessons_completed, $lesson_count) . '</span>';
                $active_html .= '</p>';
                $active_html .= '<p class="course-excerpt">' . apply_filters('get_the_excerpt', $course_item->post_excerpt) . '</p>';
                $progress_percentage = abs(round(doubleval($lessons_completed) * 100 / $lesson_count, 0));
//.........这里部分代码省略.........
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:101,代码来源:class-woothemes-sensei-course.php

示例7: the_course_action_buttons

    /**
     * Prints out the course action buttons links
     *
     * - complete course
     * - delete course
     *
     * @param WP_Post $course
     */
    public static function the_course_action_buttons($course)
    {
        if (is_user_logged_in()) {
            ?>

            <section class="entry-actions">
                <form method="POST" action="<?php 
            echo esc_url(remove_query_arg(array('active_page', 'completed_page')));
            ?>
">

                    <input type="hidden"
                           name="<?php 
            esc_attr_e('woothemes_sensei_complete_course_noonce');
            ?>
"
                           id="<?php 
            esc_attr_e('woothemes_sensei_complete_course_noonce');
            ?>
"
                           value="<?php 
            esc_attr_e(wp_create_nonce('woothemes_sensei_complete_course_noonce'));
            ?>
"
                        />

                    <input type="hidden" name="course_complete_id" id="course-complete-id" value="<?php 
            esc_attr_e(intval($course->ID));
            ?>
" />

                    <?php 
            if (0 < absint(count(Sensei()->course->course_lessons($course->ID))) && Sensei()->settings->settings['course_completion'] == 'complete') {
                ?>

                        <span><input name="course_complete" type="submit" class="course-complete" value="<? echo apply_filters( 'sensei_mark_as_complete_text', __( 'Mark as Complete', 'woothemes-sensei' ) ); ?>/></span>

                   <?php 
            }
            // End If Statement
            $course_purchased = false;
            if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated()) {
                // Get the product ID
                $wc_post_id = get_post_meta(intval($course->ID), '_course_woocommerce_product', true);
                if (0 < $wc_post_id) {
                    $user = wp_get_current_user();
                    $course_purchased = WooThemes_Sensei_Utils::sensei_customer_bought_product($user->user_email, $user->ID, $wc_post_id);
                }
                // End If Statement
            }
            // End If Statement
            if (!$course_purchased && !WooThemes_Sensei_Utils::user_completed_course($course->ID, get_current_user_id())) {
                ?>

                        <span><input name="course_complete" type="submit" class="course-delete" value="<?php 
                echo apply_filters('sensei_delete_course_text', __('Delete Course', 'woothemes-sensei'));
                ?>
"/></span>

                    <?php 
            }
            // End If Statement
            $has_quizzes = Sensei()->course->course_quizzes($course->ID, true);
            $results_link = '';
            if ($has_quizzes) {
                $results_link = '<a class="button view-results" href="' . Sensei()->course_results->get_permalink($course->ID) . '">' . apply_filters('sensei_view_results_text', __('View results', 'woothemes-sensei')) . '</a>';
            }
            // Output only if there is content to display
            if (has_filter('sensei_results_links') || $has_quizzes) {
                ?>

                        <p class="sensei-results-links">
                            <?php 
                echo apply_filters('sensei_results_links', $results_link);
                ?>
                        </p>

                    <?php 
            }
            // end if has filter
            ?>
                </form>
            </section>

        <?php 
        }
        // end if is user logged in
    }
开发者ID:andyadams,项目名称:sensei,代码行数:96,代码来源:class-woothemes-sensei-course.php

示例8: savedquest_options


//.........这里部分代码省略.........
        if (isset($_POST['submittreshold']) && ($_POST['submittreshold'] = "submit")) {
            // declare users and variables
            $completionpermonth = $_POST['completionpermonth'];
            $courseid = $_POST['course'];
            $group_id = $_POST['group'];
            $course_name = get_the_title($courseid);
            $array_to_csv = array(array('Student Name', 'Course Name', 'Module(s)'));
            $userincourse = BuddyPress_Sensei_Groups::bp_sensei_get_course_members($courseid);
            //groups_get_groupmeta
            //echo $group_attached = groups_get_groupmeta( $group_id, 'bp_course_attached', true)."<br />---";
            if ($completionpermonth == "") {
                $completionpermonth = groups_get_groupmeta($group_id, 'sensei_threshold', true);
            }
            /* echo "<pre>";
            
            			print_r($userincourse);
            
            			echo "</pre>";
            
            			echo "<pre>";
            
            			print_r($user_in_groups);
            
            			echo "</pre>";	 */
            $user_in_groups = $wpdb->get_results($wpdb->prepare("SELECT user_id FROM wp_bp_groups_members WHERE group_id = %d", $group_id));
            //user loop ----- loop user get the groups and course the course they take
            foreach ($user_in_groups as $user) {
                //echo "user_id ".$user->user_id."<br />";
                $course_user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($courseid, $user->user_id);
                $user_course_status = WooThemes_Sensei_Utils::user_course_status($courseid, $user->user_id);
                $course_status_info = get_comment_meta($user_course_status->comment_ID);
                $started_course = WooThemes_Sensei_Utils::user_started_course($courseid, $user->user_id);
                $course_status = WooThemes_Sensei_Utils::sensei_user_course_status_message($courseid, $user->user_id);
                $completed_course = WooThemes_Sensei_Utils::user_completed_course($user_course_status);
                $modules = Sensei()->modules->get_course_modules($courseid);
                //$modules_content = Sensei()->modules->course_module_content(  $courseid );
                foreach ($modules as $module) {
                    $module_id = $module->term_id;
                    $args = array('post_type' => 'lesson', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'module', 'field' => 'id', 'terms' => $module_id)), 'meta_query' => array(array('key' => '_lesson_course', 'value' => $courseid)), 'fields' => 'ids');
                    $lessons = get_posts($args);
                    $completed = false;
                    $lesson_count = 0;
                    $completed_count = 0;
                    foreach ($lessons as $lesson_id) {
                        $completed = WooThemes_Sensei_Utils::user_completed_lesson($lesson_id, $user->user_id);
                        ++$lesson_count;
                        if ($completed) {
                            ++$completed_count;
                        }
                    }
                    $module_progress = $completed_count / $lesson_count * 100;
                    if ($module_progress == 100) {
                        $module_passed[] = 1;
                        $module_name[] = $module->name;
                    }
                    /* 	echo "<pre>";
                    
                    						echo $module_progress;
                    
                    						echo "---<br />";
                    
                    						//print_r($modules_content);
                    
                    						echo "</pre>"; */
                }
                $course_status_info['start'][0];
开发者ID:Ezyva2015,项目名称:opendooronline.com.au,代码行数:67,代码来源:functions.php


注:本文中的WooThemes_Sensei_Utils::user_completed_course方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。