本文整理匯總了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);
}