コード例 #1
0
        public function meta_box_settings(WP_Post $post, $meta_box)
        {
            $type = get_post_meta($post->ID, 'type', true);
            echo '
			<table class="form-table">
				<tbody>';
            echo '
					<tr class="quiz-field quiz-field-radio">
						<th><label>' . __('Type') . '</label></th>
						<td>';
            icit_fields::field_radio(array('name' => 'type', 'value' => $type, 'options' => apply_filters('quizzlestick_question_types', array('single' => __('Single Answer <span class="description"> quizzes submit answers immediately on click and show the question result and a \'next\' button.</span><br /><br />'), 'which' => __('Which are you / is it? <span class="description"> quizzes have no incorrect answers but must use graduated results based on the points scored.</span><br /><br />'))), 'description' => __('Choose the type of quiz'), 'default' => 'single'));
            //<span class="instruction-quickfire">Quickfire quizzes submit answers immediately on click and automatically progress to the next question if available.</span><br />
            //		<span class="instruction-single">Single answer quizzes submit answers immediately on click and show the question result and a \'next\' button.</span><br />
            //		<span class="instruction-multi">Multiple answer quizzes can have more than one correct answer per question which all have to be selected to get the question right.</span><br />
            //		<span class="instruction-which">Which are you / is it quizzes have no incorrect answers but must use graduated results based on the points scored.</span><br />
            //		<span class="instruction-poll">Polls are a single questions the results of which are shown immediately after.</span>
            echo '
						</td>
					</tr>';
            echo '
					<tr class="quiz-field quiz-field-radio">
						<th><label>' . __('Description') . '</label></th>
						<td>';
            icit_fields::field_textarea(array('name' => 'excerpt', 'value' => html_entity_decode($post->post_excerpt), 'description' => '<p>' . __('If the quiz needs an introduction or instructions add them here') . '</p>', 'tiny_mce' => true, 'edit_args' => array('media_buttons' => false, 'teeny' => true, 'textarea_rows' => 2, 'wpautop' => true)));
            echo '
						</td>
					</tr>';
            if (!apply_filters('quizzlestick_enable_timelime', false)) {
                echo '<input type="hidden" name="timelimit" value="0" />';
            }
            //else {
            //if ( $type !== 'poll' ) {
            //echo '
            //<tr class="quiz-field quiz-field-number">
            //	<th><label>' . __( 'Time limit (seconds)' ) . '</label></th>
            //	<td>';
            //
            //icit_fields::field_numeric( array(
            //	'name' => 'timelimit',
            //	'value' => get_post_meta( $post->ID, 'timelimit', true ),
            //	'description' => __( 'The time limit for this quiz in seconds. Zero means there is no time limit.' ),
            //	'default' => 0,
            //	'min' => 0
            //) );
            //
            //echo '
            //	</td>
            //</tr>';
            //}
            //}
            //if ( $type == 'quickfire' ) {
            //	echo '
            //	<tr class="quiz-field quiz-field-number">
            //		<th><label>' . __( 'Delay before next question (miliseconds)' ) . '</label></th>
            //		<td>';
            //
            //	icit_fields::field_numeric( array(
            //		'name' => 'nextdelay',
            //		'value' => get_post_meta( $post->ID, 'nextdelay', true ),
            //		'description' => __( 'The delay before moving to the next question after answering default is 500 miliseconds.' ),
            //		'default' => 500,
            //		'min' => 0
            //	) );
            //
            //	echo '
            //		</td>
            //	</tr>';
            //}
            //echo '
            //<tr class="quiz-field quiz-field-number">
            //	<th><label>' . __( 'Next question delay (seconds)' ) . '</label></th>
            //	<td>';
            //
            //icit_fields::field_numeric( array(
            //	'name' => 'nextdelay',
            //	'value' => get_post_meta( $post->ID, 'nextdelay', true ),
            //	'description' => __( 'If set then the quiz will automatically advance after a question has been answered. You can set this to a decimal value eg 0.5' ),
            //	'default' => 0,
            //	'min' => 0
            //) );
            //
            //echo '
            //	</td>
            //</tr>';
            if (!in_array($type, array('which'))) {
                echo '
						<tr class="quiz-field quiz-field-number">
							<th><label>' . __('Text to show for correct answer') . '</label></th>
							<td>';
                $correct = get_post_meta($post->ID, 'correct', true);
                icit_fields::field_text(array('name' => 'correct', 'value' => $correct ? $correct : __('Correct!'), 'default' => __('Correct!')));
                echo '
							</td>
						</tr>';
                echo '
						<tr class="quiz-field quiz-field-number">
							<th><label>' . __('Text to show for incorrect answer') . '</label></th>
							<td>';
                $incorrect = get_post_meta($post->ID, 'incorrect', true);
                icit_fields::field_text(array('name' => 'incorrect', 'value' => $incorrect ? $incorrect : __('Wrong!'), 'default' => __('Wrong!')));
                echo '
							</td>
						</tr>';
            }
            do_action('quiz_settings_metabox', $post, $meta_box);
            echo '
				</tbody>
			</table>';
            echo '<p><input type="submit" class="button button-primary" name="updatesettings" value="' . __('Update settings') . '" /></p>';
        }