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


PHP WooThemes_Sensei_Utils类代码示例

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


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

示例1: single_lesson_handler

 public function single_lesson_handler()
 {
     global $post;
     // Preview Lessons shouldn't ignore this rule.
     if (WooThemes_Sensei_Utils::is_preview_lesson($post->ID)) {
         return;
     }
     $course_id = get_post_meta($post->ID, '_lesson_course', true);
     // User already started this course, so ideally, we shouldn't restrict access.
     if (WooThemes_Sensei_Utils::user_started_course($post->ID, wp_get_current_user()->ID)) {
         return;
     }
     // This happens if the lesson isn't locked itself.
     if (memberful_can_user_access_post(wp_get_current_user()->ID, $post->ID)) {
         if (!memberful_can_user_access_post(wp_get_current_user()->ID, $course_id)) {
             // The user doesn't have access to this post, so he shouldn't have actions on it.
             remove_all_actions('sensei_lesson_single_meta');
             // Now the funky filtering part.
             remove_action('the_content', 'memberful_wp_protect_content');
             add_action('the_content', array($this, 'single_lesson_special_content_filter'), -10);
         }
     } else {
         // The user doesn't have access to this post, so he shouldn't have actions on it.
         remove_all_actions('sensei_lesson_single_meta');
     }
 }
开发者ID:andrewkhunn,项目名称:lancero,代码行数:26,代码来源:woothemes-sensei.php

示例2: sensei_check_woocommerce_version

 function sensei_check_woocommerce_version($version = '2.1')
 {
     if (WooThemes_Sensei_Utils::sensei_is_woocommerce_activated()) {
         global $woocommerce;
         if (version_compare($woocommerce->version, $version, ">=")) {
             return true;
         }
     }
     return false;
 }
开发者ID:RiaanKnoetze,项目名称:sensei,代码行数:10,代码来源:woo-functions.php

示例3: trigger

 /**
  * trigger function.
  *
  * @access public
  * @return void
  */
 function trigger($user_id = 0, $course_id = 0)
 {
     global $woothemes_sensei, $sensei_email_data;
     // Get learner user object
     $this->user = new WP_User($user_id);
     // Get passed status
     $passed = __('passed', 'woothemes-sensei');
     if (!WooThemes_Sensei_Utils::sensei_user_passed_course($course_id, $user_id)) {
         $passed = __('failed', 'woothemes-sensei');
     }
     // Construct data array
     $sensei_email_data = apply_filters('sensei_email_data', array('template' => $this->template, 'heading' => $this->heading, 'user_id' => $user_id, 'course_id' => $course_id, 'passed' => $passed), $this->template);
     // Set recipient (learner)
     $this->recipient = stripslashes($this->user->user_email);
     // Send mail
     $woothemes_sensei->emails->send($this->recipient, $this->subject, $woothemes_sensei->emails->get_content($this->template));
 }
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:23,代码来源:class-woothemes-sensei-email-learner-completed-course.php

示例4: 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()
 {
     // course query parameters to be used for all courses
     $query_args = array('post_type' => 'course', 'post_status' => 'publish', 'posts_per_page' => 1000, 'orderby' => $this->orderby, 'order' => $this->order);
     // get all the courses that has a product attached
     $all_courses_query = new WP_Query($query_args);
     $paid_courses_not_taken = array();
     // look through all course and find the purchasable ones that user has not purchased
     foreach ($all_courses_query->posts as $course) {
         // only keep the courses with a product including only  courses that the user not taking
         $course_product_id = get_post_meta($course->ID, '_course_woocommerce_product', true);
         if (is_numeric($course_product_id) && !WooThemes_Sensei_Utils::user_started_course($course->ID, get_current_user_id())) {
             $paid_courses_not_taken[] = $course->ID;
         }
     }
     // end foreach
     // setup the course query again and only use the course the user has not purchased.
     // this query will be loaded into the global WP_Query in the render function.
     $query_args['post__in'] = $paid_courses_not_taken;
     $query_args['posts_per_page'] = $this->number;
     $this->query = new WP_Query($query_args);
 }
开发者ID:RiaanKnoetze,项目名称:sensei,代码行数:28,代码来源:class-sensei-shortcode-unpurchased-courses.php

示例5: prepare_items

 /**
  * Prepare the table with different parameters, pagination, columns and table elements
  * @since  1.7.0
  * @return void
  */
 public function prepare_items()
 {
     global $woothemes_sensei, $per_page, $wp_version;
     // Handle orderby
     $orderby = '';
     if (!empty($_GET['orderby'])) {
         if (array_key_exists(esc_html($_GET['orderby']), $this->get_sortable_columns())) {
             $orderby = esc_html($_GET['orderby']);
         }
         // End If Statement
     }
     // Handle order
     $order = 'DESC';
     if (!empty($_GET['order'])) {
         $order = 'ASC' == strtoupper($_GET['order']) ? 'ASC' : 'DESC';
     }
     // Handle search
     $search = false;
     if (!empty($_GET['s'])) {
         $search = esc_html($_GET['s']);
     }
     // End If Statement
     $this->search = $search;
     // Searching users on statuses requires sub-selecting the statuses by user_ids
     if ($this->search) {
         $user_args = array('search' => '*' . $this->search . '*', 'fields' => 'ID');
         // Filter for extending
         $user_args = apply_filters('sensei_grading_search_users', $user_args);
         if (!empty($user_args)) {
             $learners_search = new WP_User_Query($user_args);
             // Store for reuse on counts
             $this->user_ids = $learners_search->get_results();
         }
     }
     // End If Statement
     $per_page = $this->get_items_per_page('sensei_comments_per_page');
     $per_page = apply_filters('sensei_comments_per_page', $per_page, 'sensei_comments');
     $paged = $this->get_pagenum();
     $offset = 0;
     if (!empty($paged)) {
         $offset = $per_page * ($paged - 1);
     }
     // End If Statement
     $activity_args = array('type' => 'sensei_lesson_status', 'number' => $per_page, 'offset' => $offset, 'orderby' => $orderby, 'order' => $order, 'status' => 'any');
     if ($this->lesson_id) {
         $activity_args['post_id'] = $this->lesson_id;
     } elseif ($this->course_id) {
         // Currently not possible to restrict to a single Course, as that requires WP_Comment to support multiple
         // post_ids (i.e. every lesson within the Course), WP 4.1 ( https://core.trac.wordpress.org/changeset/29808 )
         if (version_compare($wp_version, '4.1', '>=')) {
             $activity_args['post__in'] = $woothemes_sensei->post_types->course->course_lessons($this->course_id, 'any', 'ids');
         }
     }
     // Sub select to group of learners
     if ($this->user_ids) {
         $activity_args['user_id'] = (array) $this->user_ids;
     }
     // Restrict to a single Learner
     if ($this->user_id) {
         $activity_args['user_id'] = $this->user_id;
     }
     switch ($this->view) {
         case 'in-progress':
             $activity_args['status'] = 'in-progress';
             break;
         case 'ungraded':
             $activity_args['status'] = 'ungraded';
             break;
         case 'graded':
             $activity_args['status'] = array('graded', 'passed', 'failed');
             break;
         case 'all':
         default:
             $activity_args['status'] = 'any';
             break;
     }
     // End switch
     $activity_args = apply_filters('sensei_grading_filter_statuses', $activity_args);
     // WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
     $total_statuses = WooThemes_Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
     // Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
     if ($total_statuses < $activity_args['offset']) {
         $new_paged = floor($total_statuses / $activity_args['number']);
         $activity_args['offset'] = $new_paged * $activity_args['number'];
     }
     $statuses = WooThemes_Sensei_Utils::sensei_check_for_activity($activity_args, true);
     // Need to always return an array, even with only 1 item
     if (!is_array($statuses)) {
         $statuses = array($statuses);
     }
     $this->total_items = $total_statuses;
     $this->items = $statuses;
     $total_items = $this->total_items;
     $total_pages = ceil($total_items / $per_page);
     $this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page));
//.........这里部分代码省略.........
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:101,代码来源:class-woothemes-sensei-grading-main.php

示例6: load_component

    /**
     * Load the desired component, if a method is available for it.
     * @param  string $component The component to potentially be loaded.
     *
     * @since  1.0.0
     * @return void
     */
    protected function load_component($instance)
    {
        global $woothemes_sensei, $current_user;
        get_currentuserinfo();
        $course_ids = array();
        if ('activecourses' == esc_attr($instance['component'])) {
            $courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'in-progress'), true);
            // Need to always return an array, even with only 1 item
            if (!is_array($courses)) {
                $courses = array($courses);
            }
            foreach ($courses as $course) {
                $course_ids[] = $course->comment_post_ID;
            }
        } elseif ('completedcourses' == esc_attr($instance['component'])) {
            $courses = WooThemes_Sensei_Utils::sensei_check_for_activity(array('user_id' => $current_user->ID, 'type' => 'sensei_course_status', 'status' => 'complete'), true);
            // Need to always return an array, even with only 1 item
            if (!is_array($courses)) {
                $courses = array($courses);
            }
            foreach ($courses as $course) {
                $course_ids[] = $course->comment_post_ID;
            }
        }
        // End If Statement
        $posts_array = array();
        // course_query() is buggy, it doesn't honour the 1st arg if includes are provided, so instead slice the includes
        if (!empty($instance['limit']) && intval($instance['limit']) >= 1 && intval($instance['limit']) < count($course_ids)) {
            $course_ids = array_slice($course_ids, 0, intval($instance['limit']));
            // This does mean the order by is effectively ignored
        }
        if (!empty($course_ids)) {
            $posts_array = $woothemes_sensei->post_types->course->course_query(intval($instance['limit']), esc_attr($instance['component']), $course_ids);
        } else {
            if ('activecourses' == esc_attr($instance['component']) || 'completedcourses' == esc_attr($instance['component'])) {
                $posts_array = array();
            } else {
                $posts_array = $woothemes_sensei->post_types->course->course_query(intval($instance['limit']), esc_attr($instance['component']));
            }
        }
        // End If Statement
        if (count($posts_array) > 0) {
            ?>
			<ul>
			<?php 
            foreach ($posts_array as $post_item) {
                $post_id = absint($post_item->ID);
                $post_title = $post_item->post_title;
                $user_info = get_userdata(absint($post_item->post_author));
                $author_link = get_author_posts_url(absint($post_item->post_author));
                $author_display_name = $user_info->display_name;
                $author_id = $post_item->post_author;
                ?>
		    	<li class="fix">
		    		<?php 
                do_action('sensei_course_image', $post_id);
                ?>
		    		<a href="<?php 
                echo esc_url(get_permalink($post_id));
                ?>
" title="<?php 
                echo esc_attr($post_title);
                ?>
"><?php 
                echo $post_title;
                ?>
</a>
		    		<br />
		    		<?php 
                if (isset($woothemes_sensei->settings->settings['course_author']) && $woothemes_sensei->settings->settings['course_author']) {
                    ?>
    					<span class="course-author"><?php 
                    _e('by ', 'woothemes-sensei');
                    ?>
<a href="<?php 
                    echo esc_url($author_link);
                    ?>
" title="<?php 
                    echo esc_attr($author_display_name);
                    ?>
"><?php 
                    echo esc_html($author_display_name);
                    ?>
</a></span>
    					<br />
    				<?php 
                }
                // End If Statement
                ?>
    				<span class="course-lesson-count"><?php 
                echo $woothemes_sensei->post_types->course->course_lesson_count($post_id) . '&nbsp;' . apply_filters('sensei_lessons_text', __('Lessons', 'woothemes-sensei'));
                ?>
</span>
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:opendooronline.com.au,代码行数:101,代码来源:widget-woothemes-sensei-course-component.php

示例7: get_learners

 /**
  * Return array of learners
  * @since  1.7.0
  * @return array learners
  */
 private function get_learners($args)
 {
     $user_ids = false;
     $post_id = 0;
     $activity = '';
     if ($this->lesson_id) {
         $post_id = intval($this->lesson_id);
         $activity = 'sensei_lesson_status';
     } elseif ($this->course_id) {
         $post_id = intval($this->course_id);
         $activity = 'sensei_course_status';
     }
     if (!$post_id || !$activity) {
         $this->total_items = 0;
         return array();
     }
     $activity_args = array('post_id' => $post_id, 'type' => $activity, 'status' => 'any', 'number' => $args['per_page'], 'offset' => $args['offset'], 'orderby' => $args['orderby'], 'order' => $args['order']);
     // Searching users on statuses requires sub-selecting the statuses by user_ids
     if ($args['search']) {
         $user_args = array('search' => '*' . $args['search'] . '*', 'fields' => 'ID');
         // Filter for extending
         $user_args = apply_filters('sensei_learners_search_users', $user_args);
         if (!empty($user_args)) {
             $learners_search = new WP_User_Query($user_args);
             $activity_args['user_id'] = $learners_search->get_results();
         }
     }
     $activity_args = apply_filters('sensei_learners_filter_users', $activity_args);
     // WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
     $total_learners = WooThemes_Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
     // Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
     if ($total_learners < $activity_args['offset']) {
         $new_paged = floor($total_learners / $activity_args['number']);
         $activity_args['offset'] = $new_paged * $activity_args['number'];
     }
     $learners = WooThemes_Sensei_Utils::sensei_check_for_activity($activity_args, true);
     // Need to always return an array, even with only 1 item
     if (!is_array($learners)) {
         $learners = array($learners);
     }
     $this->total_items = $total_learners;
     return $learners;
 }
开发者ID:drumchannel,项目名称:drumchannel-dev,代码行数:48,代码来源:class-woothemes-sensei-learners-main.php

示例8: add_new_learners

 public function add_new_learners()
 {
     $result = false;
     if (!isset($_POST['add_learner_submit'])) {
         return $result;
     }
     if (!isset($_POST['add_learner_nonce']) || !wp_verify_nonce($_POST['add_learner_nonce'], 'add_learner_to_sensei')) {
         return $result;
     }
     if (!isset($_POST['add_user_id']) || '' == $_POST['add_user_id'] || !isset($_POST['add_post_type']) || !isset($_POST['add_course_id']) || !isset($_POST['add_lesson_id'])) {
         return $result;
     }
     $post_type = $_POST['add_post_type'];
     $user_id = absint($_POST['add_user_id']);
     $course_id = absint($_POST['add_course_id']);
     switch ($post_type) {
         case 'course':
             $result = WooThemes_Sensei_Utils::user_start_course($user_id, $course_id);
             // Complete each lesson if course is set to be completed
             if (isset($_POST['add_complete_course']) && 'yes' == $_POST['add_complete_course']) {
                 $lesson_ids = Sensei()->course->course_lessons($course_id, 'any', 'ids');
                 foreach ($lesson_ids as $id) {
                     WooThemes_Sensei_Utils::sensei_start_lesson($id, $user_id, true);
                 }
                 // Updates the Course status and it's meta data
                 WooThemes_Sensei_Utils::user_complete_course($course_id, $user_id);
                 do_action('sensei_user_course_end', $user_id, $course_id);
             }
             break;
         case 'lesson':
             $lesson_id = absint($_POST['add_lesson_id']);
             $complete = false;
             if (isset($_POST['add_complete_lesson']) && 'yes' == $_POST['add_complete_lesson']) {
                 $complete = true;
             }
             $result = WooThemes_Sensei_Utils::sensei_start_lesson($lesson_id, $user_id, $complete);
             // Updates the Course status and it's meta data
             WooThemes_Sensei_Utils::user_complete_course($course_id, $user_id);
             break;
     }
     // Set redirect URL after adding user to course/lesson
     $query_args = array('page' => $this->page_slug, 'view' => 'learners');
     if ($result) {
         if ($course_id) {
             $query_args['course_id'] = $course_id;
         }
         if ($lesson_id) {
             $query_args['lesson_id'] = $lesson_id;
         }
         $query_args['message'] = 'success';
     } else {
         $query_args['message'] = 'error';
     }
     $redirect_url = apply_filters('sensei_learners_add_learner_redirect_url', add_query_arg($query_args, admin_url('admin.php')));
     wp_safe_redirect(esc_url_raw($redirect_url));
     exit;
 }
开发者ID:RiaanKnoetze,项目名称:sensei,代码行数:57,代码来源:class-woothemes-sensei-learners.php

示例9: get_post_meta

     $single_lesson_complete = WooThemes_Sensei_Utils::user_completed_lesson($lesson_item->ID, $current_user->ID);
     if ($single_lesson_complete) {
         $post_classes[] = 'lesson-completed';
     }
     // End If Statement
 }
 // End If Statement
 // Get Lesson data
 $complexity_array = $woothemes_sensei->post_types->lesson->lesson_complexities();
 $lesson_length = get_post_meta($lesson_item->ID, '_lesson_length', true);
 $lesson_complexity = get_post_meta($lesson_item->ID, '_lesson_complexity', true);
 if ('' != $lesson_complexity) {
     $lesson_complexity = $complexity_array[$lesson_complexity];
 }
 $user_info = get_userdata(absint($lesson_item->post_author));
 $is_preview = WooThemes_Sensei_Utils::is_preview_lesson($lesson_item->ID);
 $preview_label = '';
 if ($is_preview && !$is_user_taking_course) {
     $preview_label = $woothemes_sensei->frontend->sensei_lesson_preview_title_text($post->ID);
     $preview_label = '<span class="preview-heading">' . $preview_label . '</span>';
     $post_classes[] = 'lesson-preview';
 }
 $html .= '<article class="' . esc_attr(join(' ', get_post_class($post_classes, $lesson_item->ID))) . '">';
 $html .= '<header>';
 $html .= '<h2><a href="' . esc_url(get_permalink($lesson_item->ID)) . '" title="' . esc_attr(sprintf(__('Start %s', 'woothemes-sensei'), $lesson_item->post_title)) . '">';
 if (apply_filters('sensei_show_lesson_numbers', $show_lesson_numbers)) {
     $html .= '<span class="lesson-number">' . $lesson_count . '. </span>';
 }
 $html .= esc_html(sprintf(__('%s', 'woothemes-sensei'), $lesson_item->post_title)) . $preview_label . '</a></h2>';
 $html .= '<p class="lesson-meta">';
 if ('' != $lesson_length) {
开发者ID:drumchannel,项目名称:drumchannel-dev,代码行数:31,代码来源:course-lessons.php

示例10: absint

$quiz_lesson = $woothemes_sensei->quiz->data->quiz_lesson;
$quiz_grade_type = $woothemes_sensei->quiz->data->quiz_grade_type;
$user_lesson_end = $woothemes_sensei->quiz->data->user_lesson_end;
$user_lesson_complete = $woothemes_sensei->quiz->data->user_lesson_complete;
$lesson_quiz_questions = $woothemes_sensei->quiz->data->lesson_quiz_questions;
// Check if the user has started the course
$lesson_course_id = absint(get_post_meta($quiz_lesson, '_lesson_course', true));
$has_user_start_the_course = WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID);
// Get the meta info
$quiz_passmark = absint(get_post_meta($post->ID, '_quiz_passmark', true));
$quiz_passmark_float = (double) $quiz_passmark;
?>
<div class="lesson-meta">
	<?php 
// Display user's quiz status
$status = WooThemes_Sensei_Utils::sensei_user_quiz_status_message($quiz_lesson, $current_user->ID);
echo '<div class="sensei-message ' . $status['box_class'] . '">' . $status['message'] . '</div>';
// Lesson Quiz Meta
if (0 < count($lesson_quiz_questions)) {
    $question_count = 1;
    ?>
		<form method="POST" action="<?php 
    echo esc_url(get_permalink());
    ?>
" enctype="multipart/form-data">
			<ol id="sensei-quiz-list">
				<?php 
    foreach ($lesson_quiz_questions as $question_item) {
        // Setup current Frontend Question
        $woothemes_sensei->quiz->data->question_item = $question_item;
        $woothemes_sensei->quiz->data->question_count = $question_count;
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:31,代码来源:quiz-questions.php

示例11: get_course_statuses

 /**
  * Return array of Course statuses
  * @since  1.7.0
  * @return array statuses
  */
 private function get_course_statuses($args)
 {
     $activity_args = array('user_id' => $this->user_id, 'type' => 'sensei_course_status', 'number' => $args['number'], 'offset' => $args['offset'], 'orderby' => $args['orderby'], 'order' => $args['order'], 'status' => 'any');
     $activity_args = apply_filters('sensei_analysis_user_profile_filter_statuses', $activity_args);
     // WP_Comment_Query doesn't support SQL_CALC_FOUND_ROWS, so instead do this twice
     $this->total_items = WooThemes_Sensei_Utils::sensei_check_for_activity(array_merge($activity_args, array('count' => true, 'offset' => 0, 'number' => 0)));
     // Ensure we change our range to fit (in case a search threw off the pagination) - Should this be added to all views?
     if ($this->total_items < $activity_args['offset']) {
         $new_paged = floor($total_statuses / $activity_args['number']);
         $activity_args['offset'] = $new_paged * $activity_args['number'];
     }
     $statuses = WooThemes_Sensei_Utils::sensei_check_for_activity($activity_args, true);
     // Need to always return an array, even with only 1 item
     if (!is_array($statuses)) {
         $statuses = array($statuses);
     }
     return $statuses;
 }
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:23,代码来源:class-woothemes-sensei-analysis-user-profile.php

示例12: limit_analysis_learners

 /**
  * Limit the analysis view to only the users taking courses belong to this teacher
  *
  * Hooked into sensei_analysis_get_learners
  * @param array $args WP_User_Query arguments
  * @return array $learners_query_results
  */
 public function limit_analysis_learners($args)
 {
     // show default for none teachers
     if (!Sensei()->teacher->is_admin_teacher()) {
         return $args;
     }
     // for teachers all courses only return those which belong to the teacher
     // as they don't have access to course belonging to other users
     $teacher_courses = Sensei()->course->get_all_courses();
     // if the user has no courses they should see no users
     if (empty($teacher_courses) || !is_array($teacher_courses)) {
         // tell the query to return 0 students
         $args['include'] = array(0);
         return $args;
     }
     $learner_ids_for_teacher_courses = array();
     foreach ($teacher_courses as $course) {
         $course_learner_ids = array();
         $activity_comments = WooThemes_Sensei_Utils::sensei_check_for_activity(array('post_id' => $course->ID, 'type' => 'sensei_course_status', 'field' => 'user_id'), true);
         if (empty($activity_comments) || is_array($activity_comments) && !(count($activity_comments) > 0)) {
             continue;
             // skip to the next course as there are no users on this course
         }
         // it could be an array of comments or a single comment
         if (is_array($activity_comments)) {
             foreach ($activity_comments as $comment) {
                 $user = get_userdata($comment->user_id);
                 if (empty($user)) {
                     // next comment in this array
                     continue;
                 }
                 $course_learner_ids[] = $user->ID;
             }
         } else {
             $user = get_userdata($activity_comments->user_id);
             $course_learner_ids[] = $user->ID;
         }
         // add learners on this course to the all courses learner list
         $learner_ids_for_teacher_courses = array_merge($learner_ids_for_teacher_courses, $course_learner_ids);
     }
     // if there are no students taking the courses by this teacher don't show them any of the other users
     if (empty($learner_ids_for_teacher_courses)) {
         $args['include'] = array(0);
     } else {
         $args['include'] = $learner_ids_for_teacher_courses;
     }
     // return the WP_Use_Query arguments
     return $args;
 }
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:56,代码来源:class-sensei-teacher.php

示例13: course_lessons

 /**
  * Load template for displaying course lessons
  * @since  1.4.0
  * @return void
  */
 public function course_lessons()
 {
     global $course, $woothemes_sensei, $current_user;
     $started_course = WooThemes_Sensei_Utils::user_started_course($course->ID, $current_user->ID);
     if ($started_course) {
         $woothemes_sensei->frontend->sensei_get_template('course-results/course-lessons.php');
     }
 }
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:13,代码来源:class-woothemes-sensei-course-results.php

示例14: wp_get_current_user

                <?php 
$view_lesson = true;
wp_get_current_user();
$lesson_prerequisite = absint(get_post_meta($post->ID, '_lesson_prerequisite', true));
if ($lesson_prerequisite > 0) {
    // Check for prerequisite lesson completions
    $view_lesson = WooThemes_Sensei_Utils::user_completed_lesson($lesson_prerequisite, $current_user->ID);
}
$lesson_course_id = get_post_meta($post->ID, '_lesson_course', true);
$user_taking_course = WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID);
if (current_user_can('administrator')) {
    $view_lesson = true;
    $user_taking_course = true;
}
$is_preview = false;
if (WooThemes_Sensei_Utils::is_preview_lesson($post->ID)) {
    $is_preview = true;
    $view_lesson = true;
}
if ($view_lesson) {
    ?>

					<section class="entry fix">
					<?php 
    if ($is_preview && !$user_taking_course) {
        ?>
						<div class="sensei-message alert"><?php 
        echo $woothemes_sensei->permissions_message['message'];
        ?>
</div>
					<?php 
开发者ID:ragulka,项目名称:sensei,代码行数:31,代码来源:content-single-lesson.php

示例15: absint

$lesson_course_id = absint(get_post_meta($post->ID, '_lesson_course', true));
$is_preview = WooThemes_Sensei_Utils::is_preview_lesson($post->ID);
// Get User Meta
get_currentuserinfo();
// Complete Lesson Logic
do_action('sensei_complete_lesson');
// Check that the course has been started
if ($woothemes_sensei->access_settings() || WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID) || $is_preview) {
    ?>
	<section class="lesson-meta" id="lesson_complete">
		<?php 
    if (apply_filters('sensei_video_position', 'top', $post->ID) == 'bottom') {
        do_action('sensei_lesson_video', $post->ID);
    }
    ?>
        <?php 
    do_action('sensei_frontend_messages');
    ?>
        <?php 
    if (!$is_preview || WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $current_user->ID)) {
        do_action('sensei_lesson_quiz_meta', $post->ID, $current_user->ID);
    }
    ?>
    </section>
    <?php 
    do_action('sensei_lesson_back_link', $lesson_course_id);
} else {
    do_action('sensei_lesson_course_signup', $lesson_course_id);
}
// End If Statement
do_action('sensei_lesson_meta_extra', $post->ID);
开发者ID:mattytemple,项目名称:YTC-Sensei,代码行数:31,代码来源:lesson-meta.php


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