public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/unitfrontend.php
/**
		 * Function called when showing the pass status for a quiz. Called in both complete and pending status boxes.
		 */
Function called when showing the pass status for a quiz. Called in both complete and pending status boxes.
Function called when showing the pass status for a quiz . Called in both complete and pending status boxes .
public function render_completionBox_quizPassStatus() {
			$html          = false;
			$messageToShow = false;
			$msgDetails = $this->check_quizzes_workoutQuizPassStatusDetails();
			global $wpdb, $wpcwdb;
			$quizID = $this->unitQuizDetails->quiz_id;
			$switch = $wpdb->get_var( "
	          SELECT quiz_results_downloadable
	          FROM $wpcwdb->quiz
	          WHERE quiz_id = $quizID"
			);
			$messageToShow .= '<div class="wpcw_fe_quiz_messages_wrapper">';
			$messageToShow .= '<div class="wcpw_fe_quiz_messages">';
			for ( $idx = 0; $idx < 5; ++ $idx ) {
				if ( ! empty( $msgDetails[ $idx ] ) ) {
					$messageToShow .= '<div class="wpcw_fe_quiz_message">';
					foreach ( $msgDetails[ $idx ] as $keyName => $stringToShow ) {
						$messageToShow .= $stringToShow . ' ';
					}
					$messageToShow .= '</div>';
				}
			}
			$messageToShow .= '</div>';
			if ( isset( $msgDetails['button_dl_results_url'] ) && $switch == 'on' ) {
				$messageToShow .= sprintf( '<div class="wpcw_fe_progress_download"><a href="%s" class="fe_btn fe_btn_completion fe_btn_small" target="_blank">%s</a></div>', $msgDetails['button_dl_results_url'], __( 'Download Results', 'wp-courseware' ) );
			}
			$messageToShow .= '</div>';
			$progressBreakdown = false;
			if ( isset( $msgDetails['msg_results_by_tag'] ) && ! empty( $msgDetails['msg_results_by_tag'] ) ) {
				$progressBreakdown .= '<div class="wpcw_fe_progress_result_by_tag_wrap">';
				foreach ( $msgDetails['msg_results_by_tag'] as $tagMessage ) {
					$progressBreakdown .= '<div class="wpcw_fe_progress_result_by_tag">' . $tagMessage . '</div>';
				}
				$progressBreakdown .= '</div>';
			}
			if ( isset( $msgDetails['msg_results_by_timer'] ) ) {
				$extraClass        = ( $progressBreakdown ? 'wpcw_fe_progress_timing_pad' : '' );
				$progressBreakdown .= sprintf( '<div class="wpcw_fe_progress_timing %s">%s</div>', $extraClass, $msgDetails['msg_results_by_timer'] );
			}
			if ( $progressBreakdown ) {
				$progressBreakdown = '<div class="wpcw_fe_progress_breakdown_wrap">' . $progressBreakdown . '</div>';
				$messageToShow     .= $progressBreakdown;
			}
			if ( $messageToShow ) {
				if ( $msgDetails['error_mode'] ) {
					$html .= self::message_createMessage_error( $messageToShow );
				} else {
					$html .= self::message_createMessage_success( $messageToShow );
				}
			}
			return $html;
		}
public function render_completionBox_quizPassStatus ( ) { $ html = false ; $ messageToShow = false ; $ msgDetails = $ this -> check_quizzes_workoutQuizPassStatusDetails ( ) ; global $ wpdb , $ wpcwdb ; $ quizID = $ this -> unitQuizDetails -> quiz_id ; $ switch = $ wpdb -> get_var ( " 
	          SELECT quiz_results_downloadable
	          FROM  $ wpcwdb -> quiz 
	          WHERE quiz_id =  $ quizID " ) ; $ messageToShow .= '<div class="wpcw_fe_quiz_messages_wrapper">' ; $ messageToShow .= '<div class="wcpw_fe_quiz_messages">' ; for ( $ idx = 0 ; $ idx < 5 ; ++ $ idx ) { if ( ! empty ( $ msgDetails [ $ idx ] ) ) { $ messageToShow .= '<div class="wpcw_fe_quiz_message">' ; foreach ( $ msgDetails [ $ idx ] as $ keyName => $ stringToShow ) { $ messageToShow .= $ stringToShow . ' ' ; } $ messageToShow .= '</div>' ; } } $ messageToShow .= '</div>' ; if ( isset ( $ msgDetails [ 'button_dl_results_url' ] ) && $ switch == 'on' ) { $ messageToShow .= sprintf ( '<div class="wpcw_fe_progress_download"><a href="%s" class="fe_btn fe_btn_completion fe_btn_small" target="_blank">%s</a></div>' , $ msgDetails [ 'button_dl_results_url' ] , __ ( 'Download Results' , 'wp-courseware' ) ) ; } $ messageToShow .= '</div>' ; $ progressBreakdown = false ; if ( isset ( $ msgDetails [ 'msg_results_by_tag' ] ) && ! empty ( $ msgDetails [ 'msg_results_by_tag' ] ) ) { $ progressBreakdown .= '<div class="wpcw_fe_progress_result_by_tag_wrap">' ; foreach ( $ msgDetails [ 'msg_results_by_tag' ] as $ tagMessage ) { $ progressBreakdown .= '<div class="wpcw_fe_progress_result_by_tag">' . $ tagMessage . '</div>' ; } $ progressBreakdown .= '</div>' ; } if ( isset ( $ msgDetails [ 'msg_results_by_timer' ] ) ) { $ extraClass = ( $ progressBreakdown ? 'wpcw_fe_progress_timing_pad' : '' ) ; $ progressBreakdown .= sprintf ( '<div class="wpcw_fe_progress_timing %s">%s</div>' , $ extraClass , $ msgDetails [ 'msg_results_by_timer' ] ) ; } if ( $ progressBreakdown ) { $ progressBreakdown = '<div class="wpcw_fe_progress_breakdown_wrap">' . $ progressBreakdown . '</div>' ; $ messageToShow .= $ progressBreakdown ; } if ( $ messageToShow ) { if ( $ msgDetails [ 'error_mode' ] ) { $ html .= self :: message_createMessage_error ( $ messageToShow ) ; } else { $ html .= self :: message_createMessage_success ( $ messageToShow ) ; } } return $ html ; }
Function called when showing the pass status for a quiz.
Function called when showing the pass status for a quiz .
// Fetch the details that we need to render. // 1) Check for a download button // 2) Check for messages by row. If we've got a row, then render each item. //    There are a maximum of 5 rows. // 4) Show the progress by tag or timer if present. // Create wrapper for tags // Add a wrapper per line for the tag results. // Close wrapper for tags // Add class for padding if we have results by tag // 5) Add wrapper for progress if present // 6) See if we need to mark up the message as an error.