exam_header.php
1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* LearnDash LD30 Displays an Exam Header
*
* Available Variables:
* $learndash_exam_model : (object) LDLMS_Model_Exam instance.
*
* @since 4.0.0
*
* @package LearnDash\Templates\LD30
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ( ! isset( $learndash_exam_model ) ) || ( ! is_a( $learndash_exam_model, 'LDLMS_Model_Exam' ) ) ) {
return;
}
?>
<div class="ld-exam-header">
<button type="submit" class="ld-exam-button-start">
<?php
echo sprintf(
// translators: placeholder: Exam.
esc_html_x( 'Start %s', 'placeholder: Exam', 'learndash' ),
esc_html( learndash_get_custom_label( 'exam' ) )
);
?>
</button>
<button type="submit" class="ld-exam-button-results"><?php echo esc_html__( 'View Results', 'learndash' ); ?></button>
<?php
/**
* Filter to show exam progress.
*
* @since 4.0.0
*
* @param bool $show_exam_progress Whether to show exam progress.
* @param int $exam_id ID of the Exam post.
*/
if ( apply_filters( 'learndash_exam_question_row_show_number', true, $learndash_exam_model->exam_id ) ) {
?>
<div class="ld-exam-progress">
<div class="ld-exam-progress-text">
<?php
echo wp_kses_post(
sprintf(
// translators: plaseholders: Exam label, Question number, Questions count, Question(s) label, Percentage.
_x( '%1$s progress: %2$s of %3$s %4$s (%5$s%%)', 'Exam label, Question number, Questions count, Question(s) label, Percentage', 'learndash' ),
learndash_get_custom_label( 'exam' ),
'<span class="ld-exam-progress-text-current">0</span>',
'<span class="ld-exam-progress-text-total">0</span>',
$learndash_exam_model->questions_count > 1 ? learndash_get_custom_label_lower( 'questions' ) : learndash_get_custom_label_lower( 'question' ),
'<span class="ld-exam-progress-text-percentage">0</span>'
)
);
?>
</div>
<div class="ld-exam-progress-bar">
<span class="ld-exam-progress-bar-fill" style="width: 30%;"></span>
</div>
</div>
<?php
}
?>
</div>