llms_sd_my_grades_table_content( string $id, obj $lesson, obj $student, array $restrictions )

Output content for a single cell on the student single course grades table


Description Description


Parameters Parameters

$id

(string) (Required) key of the table cell.

$lesson

(obj) (Required) LLMS_Lesson.

$student

(obj) (Required) LLMS_Student.

$restrictions

(array) (Required) restriction data from llms_page_restricted().


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/functions/llms.functions.templates.dashboard.php

function llms_sd_my_grades_table_content( $id, $lesson, $student, $restrictions ) {

	do_action( 'llms_sd_my_grades_table_content_' . $id . '_before', $lesson, $student, $restrictions );

	switch ( $id ) {

		case 'completion_date':
			if ( $student->is_complete( $lesson->get( 'id' ) ) ) {
				echo $student->get_completion_date( $lesson->get( 'id' ), get_option( 'date_format' ) );
			} else {
				echo '–';
			}
		break;

		case 'associated_quiz':
			if ( $lesson->has_quiz() && $restrictions['is_restricted'] ) {
				echo '<i class="fa fa-lock" aria-hidden="true"></i>';
			} elseif ( $lesson->has_quiz() ) {
				$attempt = $student->quizzes()->get_last_attempt( $lesson->get( 'quiz' ) );
				$url = $attempt ? $attempt->get_permalink() : get_permalink( $lesson->get( 'quiz' ) );
				$text = $attempt ? __( 'Review', 'lifterlms' ) : __( 'Start', 'lifterlms' );
				if ( $attempt ) {
					echo '<span class="llms-status llms-' . esc_attr( $attempt->get( 'status' ) ) . '">' . $attempt->l10n( 'status' ) . '</span>';
				}
				echo '<a href="' . $url . '">' . $text . '</a>';
			} else {
				echo '&ndash;';
			}
		break;

		case 'overall_grade':
			$grade = $student->get_grade( $lesson->get( 'id' ) );
			echo is_numeric( $grade ) ? llms_get_donut( $grade, '', 'mini' ) : '&ndash;';
		break;

	}

	do_action( 'llms_sd_my_grades_table_content_' . $id, $lesson, $student, $restrictions );

}

Top ↑

Changelog Changelog

Changelog
Version Description
3.24.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.