PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.2
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.2
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / meta-boxes / quiz / settings.php

settings.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.2, at inc/admin/views/meta-boxes/quiz/settings.php

141 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class LP_Meta_Box_Quiz extends LP_Meta_Box {
3
4 private static $_instance = null;
5
6 public $post_type = LP_QUIZ_CPT;
7
8 public function add_meta_box() {
9 add_meta_box( 'quiz_settings', esc_html__( 'Quiz Settings', 'learnpress' ), array( $this, 'output' ), $this->post_type, 'normal', 'high' );
10 }
11
12 public function metabox( $post_id = 0 ) {
13 return apply_filters(
14 'lp/metabox/quiz/lists',
15 array(
16 '_lp_duration' => new LP_Meta_Box_Duration_Field(
17 esc_html__( 'Duration', 'learnpress' ),
18 esc_html__( 'Set 0 for no limit, larger than 0 for limit', 'learnpress' ),
19 '0',
20 array(
21 'default_time' => 'minute',
22 'custom_attributes' => array(
23 'min' => '0',
24 'step' => '1',
25 ),
26 )
27 ),
28 '_lp_passing_grade' => new LP_Meta_Box_Text_Field(
29 esc_html__( 'Passing Grade(%)', 'learnpress' ),
30 esc_html__( 'The condition that must be achieved in order to be passed the quiz.', 'learnpress' ),
31 '80',
32 array(
33 'type_input' => 'number',
34 'custom_attributes' => array(
35 'min' => '0',
36 'step' => '1',
37 'max' => '100',
38 ),
39 'style' => 'width: 60px;',
40 )
41 ),
42 '_lp_instant_check' => new LP_Meta_Box_Checkbox_Field(
43 esc_html__( 'Instant Check', 'learnpress' ),
44 esc_html__( 'Allow students to immediately check their answers while doing the quiz.', 'learnpress' ),
45 'no'
46 ),
47 '_lp_negative_marking' => new LP_Meta_Box_Checkbox_Field(
48 esc_html__( 'Negative Marking', 'learnpress' ),
49 esc_html__( 'For each question which students answer wrongly, the total point is deducted exactly the question\'s point', 'learnpress' ),
50 'no'
51 ),
52 '_lp_minus_skip_questions' => new LP_Meta_Box_Checkbox_Field(
53 esc_html__( 'Minus for skip', 'learnpress' ),
54 esc_html__( 'For each question which students answer skip, the total point is deducted exactly the question\'s point', 'learnpress' ),
55 'no'
56 ),
57 '_lp_retake_count' => new LP_Meta_Box_Text_Field(
58 esc_html__( 'Retake', 'learnpress' ),
59 esc_html__( 'How many times the user can re-take this quiz. Set 0 to disable. Set -1 to infinite.', 'learnpress' ),
60 '',
61 array(
62 'type_input' => 'number',
63 'custom_attributes' => array(
64 'min' => '-1',
65 'step' => '1',
66 ),
67 'style' => 'width: 60px;',
68 )
69 ),
70 '_lp_pagination' => new LP_Meta_Box_Text_Field(
71 esc_html__( 'Pagination', 'learnpress' ),
72 esc_html__( 'The number of questions displayed on each page.', 'learnpress' ),
73 '1',
74 array(
75 'type_input' => 'number',
76 'custom_attributes' => array(
77 'min' => '0',
78 'step' => '1',
79 'max' => '100',
80 ),
81 'style' => 'width: 60px;',
82 )
83 ),
84 '_lp_review' => new LP_Meta_Box_Checkbox_Field(
85 esc_html__( 'Review', 'learnpress' ),
86 esc_html__( 'Allow students to review this quiz after they finish the quiz.', 'learnpress' ),
87 'yes'
88 ),
89 '_lp_show_correct_review' => new LP_Meta_Box_Checkbox_Field(
90 esc_html__( 'Show correct answer', 'learnpress' ),
91 esc_html__( 'Allow students view correct answer question in review this quiz.', 'learnpress' ),
92 'yes'
93 ),
94 ),
95 $post_id
96 );
97 }
98
99 public function output( $post ) {
100 parent::output( $post );
101 ?>
102
103 <div class="lp-meta-box lp-meta-box--quiz">
104 <div class="lp-meta-box__inner">
105 <?php
106 do_action( 'learnpress/quiz-settings/before' );
107 // Check if add_filter to old version.
108 $is_old = false;
109
110 foreach ( $this->metabox( $post->ID ) as $key => $object ) {
111 if ( is_a( $object, 'LP_Meta_Box_Field' ) ) {
112 $object->id = $key;
113 echo wp_kses_post( $object->output( $post->ID ) );
114 } elseif ( is_array( $object ) ) {
115 $is_old = true;
116 }
117 }
118
119 if ( $is_old ) {
120 lp_meta_box_output( $this->metabox( $post->ID ) );
121 }
122
123 do_action( 'learnpress/quiz-settings/after' );
124 ?>
125 </div>
126 </div>
127
128 <?php
129 }
130
131 public static function instance() {
132 if ( is_null( self::$_instance ) ) {
133 self::$_instance = new self();
134 }
135
136 return self::$_instance;
137 }
138 }
139
140 LP_Meta_Box_Quiz::instance();
141