public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/unitfrontend.php
/**
		 * Creates a box to show that a unit is currently pending.
		 */
Creates a box to show that a unit is currently pending.
Creates a box to show that a unit is currently pending .
public function render_completionBox_pending() {
			$html = false;
			if ( ! $this->check_user_canUserAccessUnit() && $this->check_is_unit_teaser() ) {
				return $html;
			}
			if ( $this->check_quizzes_validQuizDetails() ) {
				if ( $this->check_quizzes_hasUserCompletedQuiz() ) {
					if ( 'survey' != $this->unitQuizDetails->quiz_type && $this->unitQuizProgress->quiz_needs_marking == 0 ) {
						if ( 'retake_waiting' != $this->unitQuizProgress->quiz_next_step_type ) {
							$html .= $this->render_completionBox_quizPassStatus();
														$html .= $this->render_customFeedbackMessage_showResults();
						}
						if (
							( $this->check_quizzes_NonBlockingQuizOffersRetakeButton() ||
							  'quiz_block' == $this->unitQuizDetails->quiz_type && ! $this->check_quizzes_hasUserPassedQuiz() )
							&& 'retake_waiting' != $this->unitQuizProgress->quiz_next_step_type ) {
							$messageToShow    = false;
							$showRetakeButton = false;
							if ( 'retake_quiz' == $this->unitQuizProgress->quiz_next_step_type ) {
								$messageToShow .= wpautop( __( 'The course instructor has required that you retake this quiz.', 'wp-courseware' ) );
								if ( $this->unitQuizProgress->quiz_next_step_msg ) {
									$messageToShow .= wpautop( stripslashes( $this->unitQuizProgress->quiz_next_step_msg ) );
								}
								$showRetakeButton = true;
							} 
							else {
								$remainingAttempts = $this->fetch_quizzes_getRemainingAttempts();
								if ( $remainingAttempts != 0 ) {
									switch ( $this->unitQuizDetails->quiz_type ) {
										case 'quiz_block':
											$messageToShow .= wpautop( __( 'The course instructor has allowed you to retake the quiz. To re-attempt the quiz, just click on the button below.', 'wp-courseware' ) );
											break;
										case 'quiz_noblock':
											$messageToShow .= wpautop( sprintf(
												__( 'The recommended grade for this quiz is <b>%d%%</b> (and your grade is <b>%s%%</b>). The course instructor has allowed you to retake this quiz if you wish to improve your grade.', 'wp-courseware' ), $this->unitQuizDetails->show_recommended_percentage, $this->unitQuizProgress->quiz_grade
											) );
											break;
									}
									$showRetakeButton = true;
								} 
								else {
									$showRetakeButton = false;
									$messageToShow    .= wpautop( __( 'Unfortunately you have reached the maximum limit of attempts you are permitted for this quiz.', 'wp-courseware' ) );
									if ( $this->unitQuizProgress->quiz_next_step_msg ) {
										$messageToShow .= wpautop( stripslashes( $this->unitQuizProgress->quiz_next_step_msg ) );
									}
								}
							}
							if ( $showRetakeButton ) {
								$messageToShow .= sprintf(
									'<div class="wpcw_fe_quiz_retake">
								<div class="wpcw_fe_submit_loader wpcw_loader">
									<img src="%sajax_loader.gif" />
								</div>
								<a href="#" class="fe_btn fe_btn_completion btn_completion" data-wpcw_quiz="%d" data-wpcw_unit="%d">%s</a>						
							</div>', WPCW_IMG_URL, $this->unitQuizDetails->quiz_id, $this->unitPost->ID, __( 'Retake Quiz', 'wp-courseware' )
								);
							}
							$html .= self::message_createMessage_warning( $messageToShow );
						}
					}
					if ( $this->unitQuizProgress->quiz_needs_marking > 0 ) {
						if ( 'quiz_block' == $this->unitQuizDetails->quiz_type ) {
							$html .= self::message_createMessage_success( sprintf( __( '%s', 'wp-courseware' ), $this->parentData->course_message_quiz_open_grading_blocking ) );
						}
					}
				}
				if ( ! $this->check_quizzes_hasUserCompletedQuiz() || $this->check_quizzes_areWeWaitingForUserToRetakeQuiz() ) {
					$html .= $this->render_quizzes_handleQuizRendering();
				}
			} 
			else {
				$html .= sprintf( __(
					'<div class="wpcw_fe_progress_box_wrap" id="wpcw_fe_unit_complete_%d">
						<div class="wpcw_fe_progress_box wpcw_fe_progress_box_pending wpcw_fe_progress_box_updating">
							<div class="wpcw_fe_progress_box_text">%s</div>
							<div class="wpcw_fe_progress_box_mark">
								<img src="%sajax_loader.gif" class="wpcw_loader" style="display: none;" />
								<a href="#" class="fe_btn fe_btn_completion btn_completion" id="unit_complete_%d">%s</a>
							</div>
						</div>
					</div>', 'wp-courseware' ),
					$this->unitPost->ID,
					$this->parentData->course_message_unit_pending,
					WPCW_IMG_URL,
					$this->unitPost->ID,
					__( 'Mark as Completed', 'wp-courseware' )
				);
			}
			return $html;
		}
public function render_completionBox_pending ( ) { $ html = false ; if ( ! $ this -> check_user_canUserAccessUnit ( ) && $ this -> check_is_unit_teaser ( ) ) { return $ html ; } if ( $ this -> check_quizzes_validQuizDetails ( ) ) { if ( $ this -> check_quizzes_hasUserCompletedQuiz ( ) ) { if ( 'survey' != $ this -> unitQuizDetails -> quiz_type && $ this -> unitQuizProgress -> quiz_needs_marking == 0 ) { if ( 'retake_waiting' != $ this -> unitQuizProgress -> quiz_next_step_type ) { $ html .= $ this -> render_completionBox_quizPassStatus ( ) ; $ html .= $ this -> render_customFeedbackMessage_showResults ( ) ; } if ( ( $ this -> check_quizzes_NonBlockingQuizOffersRetakeButton ( ) || 'quiz_block' == $ this -> unitQuizDetails -> quiz_type && ! $ this -> check_quizzes_hasUserPassedQuiz ( ) ) && 'retake_waiting' != $ this -> unitQuizProgress -> quiz_next_step_type ) { $ messageToShow = false ; $ showRetakeButton = false ; if ( 'retake_quiz' == $ this -> unitQuizProgress -> quiz_next_step_type ) { $ messageToShow .= wpautop ( __ ( 'The course instructor has required that you retake this quiz.' , 'wp-courseware' ) ) ; if ( $ this -> unitQuizProgress -> quiz_next_step_msg ) { $ messageToShow .= wpautop ( stripslashes ( $ this -> unitQuizProgress -> quiz_next_step_msg ) ) ; } $ showRetakeButton = true ; } else { $ remainingAttempts = $ this -> fetch_quizzes_getRemainingAttempts ( ) ; if ( $ remainingAttempts != 0 ) { switch ( $ this -> unitQuizDetails -> quiz_type ) { case 'quiz_block' : $ messageToShow .= wpautop ( __ ( 'The course instructor has allowed you to retake the quiz. To re-attempt the quiz, just click on the button below.' , 'wp-courseware' ) ) ; break ; case 'quiz_noblock' : $ messageToShow .= wpautop ( sprintf ( __ ( 'The recommended grade for this quiz is <b>%d%%</b> (and your grade is <b>%s%%</b>). The course instructor has allowed you to retake this quiz if you wish to improve your grade.' , 'wp-courseware' ) , $ this -> unitQuizDetails -> show_recommended_percentage , $ this -> unitQuizProgress -> quiz_grade ) ) ; break ; } $ showRetakeButton = true ; } else { $ showRetakeButton = false ; $ messageToShow .= wpautop ( __ ( 'Unfortunately you have reached the maximum limit of attempts you are permitted for this quiz.' , 'wp-courseware' ) ) ; if ( $ this -> unitQuizProgress -> quiz_next_step_msg ) { $ messageToShow .= wpautop ( stripslashes ( $ this -> unitQuizProgress -> quiz_next_step_msg ) ) ; } } } if ( $ showRetakeButton ) { $ messageToShow .= sprintf ( '<div class="wpcw_fe_quiz_retake">
								<div class="wpcw_fe_submit_loader wpcw_loader">
									<img src="%sajax_loader.gif" />
								</div>
								
								<a href="#" class="fe_btn fe_btn_completion btn_completion" data-wpcw_quiz="%d" data-wpcw_unit="%d">%s</a>						
							</div>' , WPCW_IMG_URL , $ this -> unitQuizDetails -> quiz_id , $ this -> unitPost -> ID , __ ( 'Retake Quiz' , 'wp-courseware' ) ) ; } $ html .= self :: message_createMessage_warning ( $ messageToShow ) ; } } if ( $ this -> unitQuizProgress -> quiz_needs_marking > 0 ) { if ( 'quiz_block' == $ this -> unitQuizDetails -> quiz_type ) { $ html .= self :: message_createMessage_success ( sprintf ( __ ( '%s' , 'wp-courseware' ) , $ this -> parentData -> course_message_quiz_open_grading_blocking ) ) ; } } } if ( ! $ this -> check_quizzes_hasUserCompletedQuiz ( ) || $ this -> check_quizzes_areWeWaitingForUserToRetakeQuiz ( ) ) { $ html .= $ this -> render_quizzes_handleQuizRendering ( ) ; } } else { $ html .= sprintf ( __ ( '<div class="wpcw_fe_progress_box_wrap" id="wpcw_fe_unit_complete_%d">
						<div class="wpcw_fe_progress_box wpcw_fe_progress_box_pending wpcw_fe_progress_box_updating">
							<div class="wpcw_fe_progress_box_text">%s</div>
							<div class="wpcw_fe_progress_box_mark">
								<img src="%sajax_loader.gif" class="wpcw_loader" style="display: none;" />
								<a href="#" class="fe_btn fe_btn_completion btn_completion" id="unit_complete_%d">%s</a>
							</div>
						</div>
					</div>' , 'wp-courseware' ) , $ this -> unitPost -> ID , $ this -> parentData -> course_message_unit_pending , WPCW_IMG_URL , $ this -> unitPost -> ID , __ ( 'Mark as Completed' , 'wp-courseware' ) ) ; } return $ html ; }
Creates a box to show that a unit is currently pending.
Creates a box to show that a unit is currently pending .
// Hide Completion Box because its a teaser unit. // See if we have a quiz for this unit? If so, render it and allow the trainee to complete it. // Show the user what their grade is (for non-surveys, if we have any existing data to show). // DJH 2015-09-30 - Hiding messages when being shown at the wrong time. // Never show status or feedback if we're currently re-taking the quiz. // Got any custom feedback data to show?
 // Quiz - User has failed quiz, so offer chance to retake. // Non-blocking and retakes allowed // Blocking and failed // If user has requested retake, we don't want to show this message. // Retake Needed A - Ordered by instructor. // Show a generic message that the quiz needs to be re-taken. // Add the custom message if there was one, which is personalised from the instructor. // Retake Needed B - Auto check as failed, and user can retake again if the retake count is // less than the permitted count for the quiz. This filters out the state of quiz waiting too. // Show message if there are any attempts left. // Show a generic message that the quiz needs to be re-taken. // Show a message about the recommended score. // No retakes left, so show a suitable message. //$messageToShow .= wpautop(__('You have reached the maximum limit of attempts, however your instructor has allowed another retake.', 'wp-courseware')); // The retake button (if allowed) // Finally show the message to the user. // User has completed this quiz, so we need to indicate if it's been marked or not. If it's not been marked // we show a message saying they are blocked until it's marked. // Blocking quiz - show a status message saying that they can't continue until the quiz is graded. // No quiz progress or we're ready for a retake, so show the quiz to be rendered for completion by the user. // Ensure that we render the quiz if we've not yet completed the quiz. // Manually mark the unit as complete as there are no quiz questions. // Render the message