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


PHP WooThemes_Sensei_Utils::sensei_user_quiz_status_message方法代码示例

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


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

示例1: 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

示例2: sensei_lesson_quiz_meta

    public function sensei_lesson_quiz_meta($post_id = 0, $user_id = 0)
    {
        //		echo "quizee lessons <br>";
        global $woothemes_sensei;
        // Get the prerequisite lesson
        $lesson_prerequisite = (int) get_post_meta($post_id, '_lesson_prerequisite', true);
        $lesson_course_id = (int) get_post_meta($post_id, '_lesson_course', true);
        // Lesson Quiz Meta
        $quiz_id = $woothemes_sensei->post_types->lesson->lesson_quizzes($post_id);
        $has_user_completed_lesson = WooThemes_Sensei_Utils::user_completed_lesson(intval($post_id), $user_id);
        $show_actions = is_user_logged_in() ? true : false;
        if (intval($lesson_prerequisite) > 0) {
            // If the user hasn't completed the prereq then hide the current actions
            $show_actions = WooThemes_Sensei_Utils::user_completed_lesson($lesson_prerequisite, $user_id);
        }
        ?>
<header class="quizheader"><?php 
        if ($quiz_id && is_user_logged_in() && WooThemes_Sensei_Utils::user_started_course($lesson_course_id, $user_id)) {
            ?>
            <?php 
            $no_quiz_count = 0;
            ?>
        	<?php 
            $has_quiz_questions = get_post_meta($post_id, '_quiz_has_questions', true);
            // Display lesson quiz status message
            if ($has_user_completed_lesson || $has_quiz_questions) {
                $status = WooThemes_Sensei_Utils::sensei_user_quiz_status_message($post_id, $user_id, true);
                echo '<div class="sensei-message ' . $status['box_class'] . '">' . $status['message'] . '</div>';
                if ($has_quiz_questions) {
                    $string = 'April 15, 2003';
                    $pattern = '/title="View the Topic Quiz"/';
                    $replacement = 'target="_blank" title="View the Topic Quiz"';
                    echo preg_replace($pattern, $replacement, $status['extra']);
                    //echo $status['extra'];
                }
                // End If Statement
            }
            // End If Statement
            ?>
        <?php 
        } elseif ($show_actions && $quiz_id && $woothemes_sensei->access_settings()) {
            ?>
    		<?php 
            $has_quiz_questions = get_post_meta($post_id, '_quiz_has_questions', true);
            if ($has_quiz_questions) {
                ?>
        			<p><a class="button" target="_blank" href="<?php 
                echo esc_url(get_permalink($quiz_id));
                ?>
" title="<?php 
                echo esc_attr(apply_filters('sensei_view_lesson_quiz_text', __('View the Lesson Quiz', 'woothemes-sensei')));
                ?>
"><?php 
                echo apply_filters('sensei_view_lesson_quiz_text', __('View the Lesson Quiz', 'woothemes-sensei'));
                ?>
</a></p>
        		<?php 
            }
            ?>
        <?php 
        }
        // End If Statement
        if ($show_actions && !$has_user_completed_lesson) {
            sensei_complete_lesson_button();
        } elseif ($show_actions) {
            sensei_reset_lesson_button();
        }
        // End If Statement
        ?>
</header><?php 
    }
开发者ID:Ezyva2015,项目名称:opendooronline.com.au,代码行数:71,代码来源:class-woothemes-sensei-frontend.php


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