public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/unitfrontend.php
/**
		 * Creates a box to show that a unit has been completed.
		 *
		 * @return String The HTML that renders this box.
		 */
Creates a box to show that a unit has been completed.
@return String The HTML that renders this box.
Creates a box to show that a unit has been completed . @return String The HTML that renders this box .
public function render_completionBox_complete() {
			$html = false;
			if ( $this->userProgress->isCourseCompleted() ) {
				$certHTML           = false;
				$certificateDetails = WPCW_certificate_getCertificateDetails( $this->currentUserID, $this->parentData->course_id );
				$certClass          = '';
				if ( 'use_certs' == $this->parentData->course_opt_use_certificate && $certificateDetails ) {
					$certClass = 'wpcw_fe_download_cert';
					$certHTML  = sprintf( '<div class="wpcw_fe_progress_box_download"><a href="%s" class="fe_btn fe_btn_download" target="_blank">%s</a></div>', WPCW_certificate_generateLink( $certificateDetails->cert_access_key ), __( 'Download Certificate', 'wp-courseware' ) );
				}
				$html .= sprintf( __( '<div class="wpcw_fe_progress_box_wrap %s"><div class="wpcw_fe_progress_box wpcw_fe_progress_box_complete"><div class="wpcw_fe_progress_box_inner"><div class="wpcw_checkmark_wrapper"><div class="wpcw_checkmark"></div></div> <div class="wpcw_fe_progress_box_text">%s</div></div>%s</div></div>', 'wp-courseware' ), $certClass, $this->parentData->course_message_course_complete, $certHTML );
			} else {
				$html = sprintf( __( '<div class="wpcw_fe_progress_box_wrap"><div class="wpcw_fe_progress_box wpcw_fe_progress_box_complete"><div class="wpcw_fe_progress_box_inner"><div class="wpcw_checkmark_wrapper"><div class="wpcw_checkmark"></div></div> <div class="wpcw_fe_progress_box_text">%s</div></div></div></div>', 'wp-courseware' ), $this->parentData->course_message_unit_complete );
			}
			if ( $this->unitQuizProgress &&
			     'retake_waiting' != $this->unitQuizProgress->quiz_next_step_type &&
			     'incomplete' != $this->unitQuizProgress->quiz_paging_status &&
			     $this->unitQuizProgress->quiz_needs_marking == 0 &&
			     'survey' != $this->unitQuizDetails->quiz_type ) {
								$quizMessageData = $this->render_completionBox_quizPassStatus();
								$customFeedbackMessages = $this->render_customFeedbackMessage_showResults();
				$html .= $quizMessageData . $customFeedbackMessages;
			}
			$messageToShow    = false;
			$showRetakeButton = false;
			if ( $this->check_quizzes_NonBlockingQuizOffersRetakeButton() ) {
				$remainingAttempts = $this->fetch_quizzes_getRemainingAttempts();
				if ( $remainingAttempts != 0 ) {
					 (Added incomplete paging status).
					if ( 'quiz_noblock' == $this->unitQuizDetails->quiz_type && 'incomplete' != $this->unitQuizProgress->quiz_paging_status ) {
						$courseDetails = WPCW_courses_getCourseDetails( $this->unitQuizDetails->parent_course_id );
						if ( $this->unitQuizProgress->quiz_needs_marking != 0 ) {
							$html             .= self::message_createMessage_success( sprintf( __( '%s', 'wp-courseware' ), $courseDetails->course_message_quiz_open_grading_non_blocking ) );
							$showRetakeButton = false;
						} elseif ( 'retake_waiting' != $this->unitQuizProgress->quiz_next_step_type ) {
							$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
							) );
							$showRetakeButton = true;
						}
					}
				} 
				else {
					if ( $this->unitQuizProgress->quiz_needs_marking < 1 ) {
						$showRetakeButton = false;
						$html             .= wpautop( self::message_createMessage_warning( __( 'Unfortunately you have reached the maximum limit of attempts you are permitted for this quiz.', 'wp-courseware' ) ) );
					}
				}
				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->check_quizzes_hasUserCompletedQuiz() || $this->check_quizzes_areWeWaitingForUserToRetakeQuiz() ) {
					$html .= $this->render_quizzes_handleQuizRendering();
				}
			}
			if ( isset( $this->unitQuizDetails->quiz_type ) && 'survey' == $this->unitQuizDetails->quiz_type ) {
				$html .= self::message_createMessage_success( sprintf( __( 'Thank you for your responses. This %s is now complete.', 'wp-courseware' ), strtolower( wpcw_get_unit_label() ) ) );
			}
			return $html;
		}
public function render_completionBox_complete ( ) { $ html = false ; if ( $ this -> userProgress -> isCourseCompleted ( ) ) { $ certHTML = false ; $ certificateDetails = WPCW_certificate_getCertificateDetails ( $ this -> currentUserID , $ this -> parentData -> course_id ) ; $ certClass = '' ; if ( 'use_certs' == $ this -> parentData -> course_opt_use_certificate && $ certificateDetails ) { $ certClass = 'wpcw_fe_download_cert' ; $ certHTML = sprintf ( '<div class="wpcw_fe_progress_box_download"><a href="%s" class="fe_btn fe_btn_download" target="_blank">%s</a></div>' , WPCW_certificate_generateLink ( $ certificateDetails -> cert_access_key ) , __ ( 'Download Certificate' , 'wp-courseware' ) ) ; } $ html .= sprintf ( __ ( '<div class="wpcw_fe_progress_box_wrap %s"><div class="wpcw_fe_progress_box wpcw_fe_progress_box_complete"><div class="wpcw_fe_progress_box_inner"><div class="wpcw_checkmark_wrapper"><div class="wpcw_checkmark"></div></div> <div class="wpcw_fe_progress_box_text">%s</div></div>%s</div></div>' , 'wp-courseware' ) , $ certClass , $ this -> parentData -> course_message_course_complete , $ certHTML ) ; } else { $ html = sprintf ( __ ( '<div class="wpcw_fe_progress_box_wrap"><div class="wpcw_fe_progress_box wpcw_fe_progress_box_complete"><div class="wpcw_fe_progress_box_inner"><div class="wpcw_checkmark_wrapper"><div class="wpcw_checkmark"></div></div> <div class="wpcw_fe_progress_box_text">%s</div></div></div></div>' , 'wp-courseware' ) , $ this -> parentData -> course_message_unit_complete ) ; } if ( $ this -> unitQuizProgress && 'retake_waiting' != $ this -> unitQuizProgress -> quiz_next_step_type && 'incomplete' != $ this -> unitQuizProgress -> quiz_paging_status && $ this -> unitQuizProgress -> quiz_needs_marking == 0 && 'survey' != $ this -> unitQuizDetails -> quiz_type ) { $ quizMessageData = $ this -> render_completionBox_quizPassStatus ( ) ; $ customFeedbackMessages = $ this -> render_customFeedbackMessage_showResults ( ) ; $ html .= $ quizMessageData . $ customFeedbackMessages ; } $ messageToShow = false ; $ showRetakeButton = false ; if ( $ this -> check_quizzes_NonBlockingQuizOffersRetakeButton ( ) ) { $ remainingAttempts = $ this -> fetch_quizzes_getRemainingAttempts ( ) ; if ( $ remainingAttempts != 0 ) { if ( 'quiz_noblock' == $ this -> unitQuizDetails -> quiz_type && 'incomplete' != $ this -> unitQuizProgress -> quiz_paging_status ) { $ courseDetails = WPCW_courses_getCourseDetails ( $ this -> unitQuizDetails -> parent_course_id ) ; if ( $ this -> unitQuizProgress -> quiz_needs_marking != 0 ) { $ html .= self :: message_createMessage_success ( sprintf ( __ ( '%s' , 'wp-courseware' ) , $ courseDetails -> course_message_quiz_open_grading_non_blocking ) ) ; $ showRetakeButton = false ; } elseif ( 'retake_waiting' != $ this -> unitQuizProgress -> quiz_next_step_type ) { $ 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 ) ) ; $ showRetakeButton = true ; } } } else { if ( $ this -> unitQuizProgress -> quiz_needs_marking < 1 ) { $ showRetakeButton = false ; $ html .= wpautop ( self :: message_createMessage_warning ( __ ( 'Unfortunately you have reached the maximum limit of attempts you are permitted for this quiz.' , 'wp-courseware' ) ) ) ; } } 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 -> check_quizzes_hasUserCompletedQuiz ( ) || $ this -> check_quizzes_areWeWaitingForUserToRetakeQuiz ( ) ) { $ html .= $ this -> render_quizzes_handleQuizRendering ( ) ; } } if ( isset ( $ this -> unitQuizDetails -> quiz_type ) && 'survey' == $ this -> unitQuizDetails -> quiz_type ) { $ html .= self :: message_createMessage_success ( sprintf ( __ ( 'Thank you for your responses. This %s is now complete.' , 'wp-courseware' ) , strtolower ( wpcw_get_unit_label ( ) ) ) ) ; } return $ html ; }
Creates a box to show that a unit has been completed.
Creates a box to show that a unit has been completed .
// Work out if course completed. // Unit and course is complete, so show course complete message. // Generate certificate button if enabled and a certificate exists for this user. // Course completion message // DJH 2015-09-30 - Hiding messages when being shown at the wrong time. // Don't show feedback messages if we're in retake mode or we're paging and the status is incomplete. // Got any quiz status data to show?
 // Got any custom feedback data to show?
 // Allow non-blocking Quiz Retakes - (as unit is always complete for non-blocking quizzes). // DJH 2015-09-30 - Hiding messages when being shown at the wrong time. (Added incomplete paging status). // Only show if a non-blocking quiz, and we're not paging. // Show a message about the recommended score. // No retakes left, so show a suitable message. // The retake button (if allowed) // 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. /* translators: %s - The unit label */ //. $quizMessageData . $customFeedbackMessages . $retakeButtonData