本文整理汇总了PHP中WooThemes_Sensei_Utils::sensei_course_user_grade方法的典型用法代码示例。如果您正苦于以下问题:PHP WooThemes_Sensei_Utils::sensei_course_user_grade方法的具体用法?PHP WooThemes_Sensei_Utils::sensei_course_user_grade怎么用?PHP WooThemes_Sensei_Utils::sensei_course_user_grade使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WooThemes_Sensei_Utils
的用法示例。
在下文中一共展示了WooThemes_Sensei_Utils::sensei_course_user_grade方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savedquest_options
//.........这里部分代码省略.........
<th><?php
echo $diftime;
?>
</th>
<td><?php
echo implode(', ', $user_info->roles);
?>
</td>
</tr>
<?php
}
?>
<?php
}
?>
</table><br /><br />
<?php
} elseif ($tab == "timequizecompleted") {
global $woothemes_sensei, $post, $current_user, $wp_query, $learner_user;
echo "<table class='wp-list-table widefat fixed striped pages'>";
$allUsers = get_users();
echo "<tr>\r\r\n\t\t\t\t<th>User</th>\r\r\n\t\t\t\t<th>Courses</th>\r\r\n\t\t\t\t<th>Percentage Incomplete</th>\r\r\n\t\t\t\t<th>Percentage Complete</th>\r\r\n\t\t\t\t<th>Percentage Competent</th>\r\r\n\t\t\t\t<th>Percentage Attempted</th>\r\r\n\t\t\t\t<th>Length of time Course Completed</th>\r\r\n\t\t\t </tr>";
foreach ($allUsers as $user) {
$args = array('post_type' => 'course');
$courses = get_posts($args);
$i = 1;
foreach ($courses as $course) {
$course_user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($course->ID, $user->ID);
$course_status = WooThemes_Sensei_Utils::user_course_status($course->ID, $user->ID);
$course_status_update = get_comment_meta($course_status->comment_ID);
if (!empty($course_status)) {
$displayed_lessons = array();
$modules = Sensei()->modules->get_course_modules(intval($course->ID));
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($course->ID), '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);
if (count($lessons) > 0) {
$html .= '<h3>' . $module->name . '</h3>' . "\n";
$count = 0;
foreach ($lessons as $lesson_item) {
$lesson_grade = ' n/a';
$has_questions = get_post_meta($lesson_item->ID, '_quiz_has_questions', true);
if ($has_questions) {
$lesson_status = WooThemes_Sensei_Utils::user_lesson_status($lesson_item->ID, $user->ID);
// Get user quiz grade
$lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true);
if ($lesson_grade) {
$lesson_grade .= '%';
}
$modulequizdata = get_comment_meta($lesson_status->comment_ID);
//echo "<a href='".get_post_permalink($lesson_item->ID)."'>".$lesson_item->post_title."</a><br />";
$modulequestion_asked = count(explode(",", $modulequizdata['questions_asked'][0]));
$moduleanswered_quiz = count(unserialize($modulequizdata['quiz_answers'][0]));
//echo "number of questions:".$modulequestion_asked."<br />";
//echo "number of Answered:".$moduleanswered_quiz."<br />";
if ($course_status->comment_approved == "complete") {
$attempted = "(100%)";
} else {
if ($modulequizdata['grade'][0] == "") {
if ($lesson_status->comment_approved == "passed") {
示例2: get_currentuserinfo
* Override this template by copying it to yourtheme/sensei/course-results/course-lessons.php
*
* @author WooThemes
* @package Sensei/Templates
* @version 1.6.0
*/
if (!defined('ABSPATH')) {
exit;
}
global $course, $woothemes_sensei, $current_user;
// Get User Meta
get_currentuserinfo();
if (is_user_logged_in()) {
// WooThemes_Sensei_Utils::sensei_course_user_grade() loops through every Lesson to find it's grade and total for the Course
// but then we re-loop every lesson below and do the same again, REFACTOR!
$course_user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($course->ID, $current_user->ID);
$html = '';
$html .= '<section class="course-results-lessons">';
$html .= '<header>';
$html .= '<h2>' . apply_filters('sensei_lessons_text', __('Lessons', 'woothemes-sensei')) . '</h2>';
$html .= '</header>';
$html .= '<article class="' . esc_attr(join(' ', get_post_class(array('course', 'post'), $course->ID))) . '">';
$displayed_lessons = array();
$modules = Sensei()->modules->get_course_modules(intval($course->ID));
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($course->ID), '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);
if (count($lessons) > 0) {
$html .= '<h3>' . $module->name . '</h3>' . "\n";
$count = 0;
foreach ($lessons as $lesson_item) {
示例3: sensei_user_course_status_message
/**
* Set the status message displayed to the user for a course
* @param integer $course_id ID of course
* @param integer $user_id ID of user
* @return array Status code and message
*/
public static function sensei_user_course_status_message($course_id = 0, $user_id = 0)
{
if (intval($user_id) == 0) {
$user_id = get_current_user_id();
}
$status = 'not_started';
$box_class = 'info';
$message = __('You have not started this course yet.', 'woothemes-sensei');
if ($course_id > 0 && $user_id > 0) {
$started_course = WooThemes_Sensei_Utils::user_started_course($course_id, $user_id);
if ($started_course) {
$passmark = WooThemes_Sensei_Utils::sensei_course_pass_grade($course_id);
// This happens inside sensei_user_passed_course()!
$user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($course_id, $user_id);
// This happens inside sensei_user_passed_course()!
if ($user_grade >= $passmark) {
$status = 'passed';
$box_class = 'tick';
$message = sprintf(__('You have passed this course with a grade of %1$d%%.', 'woothemes-sensei'), $user_grade);
} else {
$status = 'failed';
$box_class = 'alert';
$message = sprintf(__('You require %1$d%% to pass this course. Your grade is %2$s%%.', 'woothemes-sensei'), $passmark, $user_grade);
}
}
}
$message = apply_filters('sensei_user_course_status_' . $status, $message);
return array('status' => $status, 'box_class' => $box_class, 'message' => $message);
}
示例4: savedquest_options
//.........这里部分代码省略.........
echo implode(', ', $user_info->roles);
?>
</td>
</tr>
<?php
}
?>
<?php
}
?>
</table><br /><br />
<?php
} elseif ($tab == "timequizecompleted") {
global $woothemes_sensei, $post, $current_user, $wp_query, $learner_user;
echo "<table class='wp-list-table widefat fixed striped pages'>";
$allUsers = get_users();
echo "<tr>\n\n\t\t\t\t<th>User</th>\n\n\t\t\t\t<th>Courses</th>\n\n\t\t\t\t<th>Percentage Incomplete</th>\n\n\t\t\t\t<th>Percentage Complete</th>\n\n\t\t\t\t<th>Percentage Competent</th>\n\n\t\t\t\t<th>Percentage Attempted</th>\n\n\t\t\t\t<th>Length of time Course Completed</th>\n\n\t\t\t </tr>";
foreach ($allUsers as $user) {
$args = array('post_type' => 'course');
$courses = get_posts($args);
$i = 1;
foreach ($courses as $course) {
$course_user_grade = WooThemes_Sensei_Utils::sensei_course_user_grade($course->ID, $user->ID);
$course_status = WooThemes_Sensei_Utils::user_course_status($course->ID, $user->ID);
$course_status_update = get_comment_meta($course_status->comment_ID);
if (!empty($course_status)) {
$displayed_lessons = array();
$modules = Sensei()->modules->get_course_modules(intval($course->ID));
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($course->ID), '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);
if (count($lessons) > 0) {
$html .= '<h3>' . $module->name . '</h3>' . "\n";
$count = 0;
foreach ($lessons as $lesson_item) {
$lesson_grade = ' n/a';
$has_questions = get_post_meta($lesson_item->ID, '_quiz_has_questions', true);
if ($has_questions) {
$lesson_status = WooThemes_Sensei_Utils::user_lesson_status($lesson_item->ID, $user->ID);
// Get user quiz grade
$lesson_grade = get_comment_meta($lesson_status->comment_ID, 'grade', true);
if ($lesson_grade) {
$lesson_grade .= '%';
}
$modulequizdata = get_comment_meta($lesson_status->comment_ID);
//echo "<a href='".get_post_permalink($lesson_item->ID)."'>".$lesson_item->post_title."</a><br />";
$modulequestion_asked = count(explode(",", $modulequizdata['questions_asked'][0]));
$moduleanswered_quiz = count(unserialize($modulequizdata['quiz_answers'][0]));
//echo "number of questions:".$modulequestion_asked."<br />";
//echo "number of Answered:".$moduleanswered_quiz."<br />";
//echo "<pre>";
//echo "<h1>".$user->user_email.$lesson_item->post_title."</h1>";
//print_r($course_status );
//echo $course_status->comment_approved;
//echo $modulequestion_asked."------".$moduleanswered_quiz;