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


PHP WooThemes_Sensei_Utils::sensei_get_user_question_answer_notes方法代码示例

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


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

示例1: get_the_title

    }
}
$question_text = get_the_title($question_item);
$question_description = apply_filters('the_content', $question_item->post_content);
$answer_message = false;
$answer_notes = false;
if ($lesson_complete && $user_quiz_grade != '' || $lesson_complete && !$reset_quiz_allowed && $user_quiz_grade != '') {
    $user_correct = false;
    $answer_message = __('Incorrect', 'woothemes-sensei');
    $answer_message_class = 'user_wrong';
    if ($user_question_grade > 0) {
        $user_correct = true;
        $answer_message = sprintf(__('Grade: %d', 'woothemes-sensei'), $user_question_grade);
        $answer_message_class = 'user_right';
    }
    $answer_notes = WooThemes_Sensei_Utils::sensei_get_user_question_answer_notes($user_answer_entry);
    if ($answer_notes) {
        $answer_message_class .= ' has_notes';
    }
}
?>
<li class="file-upload">
	<span class="question"><?php 
echo apply_filters('sensei_question_title', esc_html($question_text));
?>
 <span class="grade">[<?php 
echo $question_grade;
?>
]</span></span>
	<?php 
echo $question_description;
开发者ID:AlecBeltrami,项目名称:sensei,代码行数:31,代码来源:question_type-file-upload.php

示例2: display

    /**
     * display output to the admin view
     * @since  1.3.0
     * @return html
     */
    public function display()
    {
        // Get data for the user
        $questions = $this->build_data_array();
        $count = 0;
        $graded_count = 0;
        $user_quiz_grade_total = 0;
        $quiz_grade_total = 0;
        $quiz_grade = 0;
        ?>
<form name="<?php 
        esc_attr_e('quiz_' . $this->quiz_id);
        ?>
" action="" method="post">
			<?php 
        wp_nonce_field('sensei_manual_grading', '_wp_sensei_manual_grading_nonce');
        ?>
			<input type="hidden" name="sensei_manual_grade" value="<?php 
        esc_attr_e($this->quiz_id);
        ?>
" />
			<input type="hidden" name="sensei_grade_next_learner" value="<?php 
        esc_attr_e($this->user_id);
        ?>
" />
			<div class="total_grade_display">
				<span><?php 
        esc_attr_e(__('Grade:', 'woothemes-sensei'));
        ?>
</span>
				<span class="total_grade_total"><?php 
        echo $user_quiz_grade_total;
        ?>
</span> / <span class="quiz_grade_total"><?php 
        echo $quiz_grade_total;
        ?>
</span> (<span class="total_grade_percent"><?php 
        echo $quiz_grade;
        ?>
</span>%)
			</div>
			<div class="buttons">
				<input type="submit" value="<?php 
        esc_attr_e(__('Save', 'woothemes-sensei'));
        ?>
" class="grade-button button-primary" title="Saves grades as currently marked on this page" />
				<input type="button" value="<?php 
        esc_attr_e(__('Auto grade', 'woothemes-sensei'));
        ?>
" class="autograde-button button-secondary" title="Where possible, automatically grades questions that have not yet been graded" />
				<input type="reset" value="<?php 
        esc_attr_e(__('Reset', 'woothemes-sensei'));
        ?>
" class="reset-button button-secondary" title="Resets all questions to ungraded and total grade to 0" />
			</div>
			<div class="clear"></div><br/><?php 
        $lesson_status_id = WooThemes_Sensei_Utils::sensei_get_activity_value(array('post_id' => $this->lesson_id, 'user_id' => $this->user_id, 'type' => 'sensei_lesson_status', 'field' => 'comment_ID'));
        $user_quiz_grade = get_comment_meta($lesson_status_id, 'grade', true);
        $correct_answers = 0;
        foreach ($questions as $question) {
            $question_id = $question->ID;
            ++$count;
            $type = false;
            $type_name = '';
            $types = wp_get_post_terms($question_id, 'question-type');
            foreach ($types as $t) {
                $type = $t->name;
                break;
            }
            if (!$type) {
                $type = 'multiple-choice';
            }
            $user_answer = WooThemes_Sensei_Utils::sensei_check_for_activity(array('post_id' => $question_id, 'user_id' => $this->user_id, 'type' => 'sensei_user_answer'), true);
            $question_answer_notes = WooThemes_Sensei_Utils::sensei_get_user_question_answer_notes($user_answer);
            $question_grade_total = get_post_meta($question_id, '_question_grade', true);
            if (!$question_grade_total || 0 == intval($question_grade_total)) {
                $question_grade_total = 1;
            }
            $quiz_grade_total += $question_grade_total;
            $right_answer = get_post_meta($question_id, '_question_right_answer', true);
            $user_answer_content = maybe_unserialize(base64_decode($user_answer->comment_content));
            $type_name = __('Multiple Choice', 'woothemes-sensei');
            $grade_type = 'manual-grade';
            switch ($type) {
                case 'boolean':
                    $type_name = __('True/False', 'woothemes-sensei');
                    $right_answer = ucfirst($right_answer);
                    $user_answer_content = ucfirst($user_answer_content);
                    $grade_type = 'auto-grade';
                    break;
                case 'multiple-choice':
                    $type_name = __('Multiple Choice', 'woothemes-sensei');
                    $grade_type = 'auto-grade';
                    break;
                case 'gap-fill':
//.........这里部分代码省略.........
开发者ID:AlecBeltrami,项目名称:sensei,代码行数:101,代码来源:class-woothemes-sensei-grading-user-quiz.php


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