public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/unitfrontend.php
/**
		 * Renders the specified question to HTML, reporting any errors.
		 *
		 * @param Object  $question The question to render as HTML.
		 * @param Array   $resultsList The details of how to process results.
		 * @param Boolean $showErrorsOnForm If true, show the errors on the form, acts as an override to disable showing errors if they are not wanted.
		 * @param Integer $questionNum The question number being rendered.
		 * @param Boolean $pagingMode Is this question being rendered in paging mode?
		 * @param Integer $questionIndex The index of the question within the quiz.
		 *
		 * @return String The HTML to render the question as HTML.
		 */
Renders the specified question to HTML, reporting any errors.
@param Object  $question The question to render as HTML.
@param Array   $resultsList The details of how to process results.
@param Boolean $showErrorsOnForm If true, show the errors on the form, acts as an override to disable showing errors if they are not wanted.
@param Integer $questionNum The question number being rendered.
@param Boolean $pagingMode Is this question being rendered in paging mode.
@param Integer $questionIndex The index of the question within the quiz.

@return String The HTML to render the question as HTML.
Renders the specified question to HTML reporting any errors . @param Object $question The question to render as HTML . @param Array $resultsList The details of how to process results . @param Boolean $showErrorsOnForm If true show the errors on the form acts as an override to disable showing errors if they are not wanted . @param Integer $questionNum The question number being rendered . @param Boolean $pagingMode Is this question being rendered in paging mode . @param Integer $questionIndex The index of the question within the quiz . @return String The HTML to render the question as HTML .
public function render_quizzes_handleQuizRendering_singleQuestion( $question, $resultsList, $showErrorsOnForm, $questionNum, $pagingMode = false, $questionIndex = 0 ) {
			$selectAnswer = false;
			if ( isset( $resultsList['answer_list'][ $question->question_id ] ) ) {
				$selectAnswer = $resultsList['answer_list'][ $question->question_id ];
			}
			switch ( $question->question_type ) {
				case 'multi':
					$quObj = new WPCW_quiz_MultipleChoice( $question );
					break;
				case 'open':
					$quObj = new WPCW_quiz_OpenEntry( $question );
					break;
				case 'upload':
					$quObj = new WPCW_quiz_FileUpload( $question );
					break;
				case 'truefalse':
					$quObj = new WPCW_quiz_TrueFalse( $question );
					break;
				case 'random_selection':
					die( __( 'This question cannot be rendered. This is an error.', 'wp-courseware' ) );
					break;
				default:
					die( __( 'Unexpected question type, aborting.', 'wp-courseware' ) );
					break;
			}
			$quObj->cssClasses .= ' wpcw_fe_quiz_q_single_' . $questionIndex;
			$showAsError = false;
			$errorToShow = false;
			if ( $showErrorsOnForm && isset( $_POST['submit'] ) ) {
				if ( isset( $resultsList['error_answer_list'][ $question->question_id ] ) ) {
					$errorToShow = $resultsList['error_answer_list'][ $question->question_id ];
					$showAsError = 'error';
				} 
				elseif ( ! isset( $resultsList['answer_list'][ $question->question_id ] ) ) {
					if ( ! $pagingMode ) {
						$showAsError = 'missing';
					}
				} 
				elseif ( isset( $resultsList['wrong_answer_list'][ $question->question_id ] ) ) {
					$showAsError = 'wrong';
				}
			}
			return $quObj->renderForm_toString( $this->unitQuizDetails, $questionNum, $selectAnswer, $showAsError, $errorToShow );
		}
public function render_quizzes_handleQuizRendering_singleQuestion ( $ question , $ resultsList , $ showErrorsOnForm , $ questionNum , $ pagingMode = false , $ questionIndex = 0 ) { $ selectAnswer = false ; if ( isset ( $ resultsList [ 'answer_list' ] [ $ question -> question_id ] ) ) { $ selectAnswer = $ resultsList [ 'answer_list' ] [ $ question -> question_id ] ; } switch ( $ question -> question_type ) { case 'multi' : $ quObj = new WPCW_quiz_MultipleChoice ( $ question ) ; break ; case 'open' : $ quObj = new WPCW_quiz_OpenEntry ( $ question ) ; break ; case 'upload' : $ quObj = new WPCW_quiz_FileUpload ( $ question ) ; break ; case 'truefalse' : $ quObj = new WPCW_quiz_TrueFalse ( $ question ) ; break ; case 'random_selection' : die ( __ ( 'This question cannot be rendered. This is an error.' , 'wp-courseware' ) ) ; break ; default : die ( __ ( 'Unexpected question type, aborting.' , 'wp-courseware' ) ) ; break ; } $ quObj -> cssClasses .= ' wpcw_fe_quiz_q_single_' . $ questionIndex ; $ showAsError = false ; $ errorToShow = false ; if ( $ showErrorsOnForm && isset ( $ _POST [ 'submit' ] ) ) { if ( isset ( $ resultsList [ 'error_answer_list' ] [ $ question -> question_id ] ) ) { $ errorToShow = $ resultsList [ 'error_answer_list' ] [ $ question -> question_id ] ; $ showAsError = 'error' ; } elseif ( ! isset ( $ resultsList [ 'answer_list' ] [ $ question -> question_id ] ) ) { if ( ! $ pagingMode ) { $ showAsError = 'missing' ; } } elseif ( isset ( $ resultsList [ 'wrong_answer_list' ] [ $ question -> question_id ] ) ) { $ showAsError = 'wrong' ; } } return $ quObj -> renderForm_toString ( $ this -> unitQuizDetails , $ questionNum , $ selectAnswer , $ showAsError , $ errorToShow ) ; }
Renders the specified question to HTML, reporting any errors.
Renders the specified question to HTML reporting any errors .
// See if we want to show an answer // Not expecting anything here... so not handling the error case. // Add extra CSS classes - this adds an index to the class to allow us to style certain questions. // Use the objects to render the questions, showing an answer as wrong if appropriate. // Only worry about errors if actual data has been submitted. // Something went wrong // No answer yet // Not missing if we're paging! // Answer is wrong // Use object to render