本文整理汇总了PHP中WooThemes_Sensei_Utils::sensei_course_pass_grade方法的典型用法代码示例。如果您正苦于以下问题:PHP WooThemes_Sensei_Utils::sensei_course_pass_grade方法的具体用法?PHP WooThemes_Sensei_Utils::sensei_course_pass_grade怎么用?PHP WooThemes_Sensei_Utils::sensei_course_pass_grade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WooThemes_Sensei_Utils
的用法示例。
在下文中一共展示了WooThemes_Sensei_Utils::sensei_course_pass_grade方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}