public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/unitfrontend.php
/**
		 * Get the associated image for a multi-choice question based on the selected answer.
		 *
		 * @param Object $question The question object.
		 * @param Mixed  $answerIdx If specified, the index of the raw answer.
		 *
		 * @return String The answer for the question.
		 */
Get the associated image for a multi-choice question based on the selected answer.
@param Object $question The question object.
@param Mixed  $answerIdx If specified, the index of the raw answer.

@return String The answer for the question.
Get the associated image for a multi - choice question based on the selected answer . @param Object $question The question object . @param Mixed $answerIdx If specified the index of the raw answer . @return String The answer for the question .
public function fetch_quizzes_getImageForAnswer( $question, $answerIdx ) {
			if ( 'multi' != $question->question_type ) {
				return false;
			}
			$answerListRaw = WPCW_quizzes_decodeAnswers( $question->question_data_answers );
			$imageURL      = false;
			if ( $answerIdx >= 0 && $answerIdx <= count( $answerListRaw ) && isset( $answerListRaw[ $answerIdx ] ) ) {
				if ( isset( $answerListRaw[ $answerIdx ]['image'] ) ) {
					$imageURL = $answerListRaw[ $answerIdx ]['image'];
				}
			}
			return $imageURL;
		}
public function fetch_quizzes_getImageForAnswer ( $ question , $ answerIdx ) { if ( 'multi' != $ question -> question_type ) { return false ; } $ answerListRaw = WPCW_quizzes_decodeAnswers ( $ question -> question_data_answers ) ; $ imageURL = false ; if ( $ answerIdx >= 0 && $ answerIdx <= count ( $ answerListRaw ) && isset ( $ answerListRaw [ $ answerIdx ] ) ) { if ( isset ( $ answerListRaw [ $ answerIdx ] [ 'image' ] ) ) { $ imageURL = $ answerListRaw [ $ answerIdx ] [ 'image' ] ; } } return $ imageURL ; }
Get the associated image for a multi-choice question based on the selected answer.
Get the associated image for a multi - choice question based on the selected answer .
// Multi-choice questions have images, no others do. // Turn list of answers into array then use 1-indexing to get the image of the result. // Just double check that the selected answer is valid. // 2013-12-06 - Added <= rather than < count for the final answer to accept the final answer. // Because it's 1-indexed, not 0 indexed.