lifterlms_course_continue_button( $post_id = null, $student = null, $progress = null )
Contents
Source Source
File: includes/llms.template.functions.php
if ( $button ) {
$html .= '<' . $tag . ' class="llms-button-primary llms-purchase-button"' . $href . '>' . __( 'Continue', 'lifterlms' ) . '(' . $progress . '%)</' . $tag . '>';
}
if ( $echo ) {
echo $html;
} else {
return $html;
}
}
}
function llms_get_progress_bar_html( $percentage ) {
$percentage = sprintf( '%s%%', $percentage );
$html = '<div class="llms-progress">
<div class="progress__indicator">' . $percentage . '</div>
<div class="llms-progress-bar">
<div class="progress-bar-complete" data-progress="' . $percentage . '" style="width:' . $percentage . '"></div>
</div></div>';
return $html;
}
/**
* Output a course continue button linking to the incomplete lesson for a given student.
*
* If the course is complete "Course Complete" is displayed.
*
* @since 3.11.1
* @since 3.15.0 Unknown.
* @since 7.1.0 Remove check on student existence, now included in the enrollment check.
*
* @param int $post_id WP Post ID for a course, lesson, or quiz.
* @param LLMS_Student $student Instance of an LLMS_Student, defaults to current student.
* @param int $progress Current progress of the student through the course.
* @return void
*/
if ( ! function_exists( 'lifterlms_course_continue_button' ) ) {
function lifterlms_course_continue_button( $post_id = null, $student = null, $progress = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
if ( ! $post_id ) {
return '';
}
}
$course = llms_get_post( $post_id );
if ( ! $course || ! is_a( $course, 'LLMS_Post_Model' ) ) {
return '';
}
if ( in_array( $course->get( 'type' ), array( 'lesson', 'quiz' ) ) ) {
$course = llms_get_post_parent_course( $course->get( 'id' ) );
if ( ! $course ) {
Expand full source code Collapse full source code View on GitHub