LLMS_Table_Student_Course::get_data( string $key, int $lesson )

Retrieve data for the columns


Parameters Parameters

$key

(string) (Required) the column id / key

$lesson

(int) (Required) Instance of an LLMS_Lesson


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.student.course.php

	public function get_data( $key, $lesson ) {

		switch ( $key ) {

			case 'actions':
				$value = $this->get_actions_html( $lesson );
				break;

			case 'completed':
				$date  = $this->student->get_completion_date( $lesson->get( 'id' ) );
				$value = $date ? $date : '–';
				break;

			case 'grade':
				$grade = $this->student->get_grade( $lesson->get( 'id' ) );
				$value = is_numeric( $grade ) ? $grade . '%' : $grade;
				break;

			case 'id':
				$value = $this->get_post_link( $lesson->get( 'id' ) );
				break;

			case 'name':
				$value = $lesson->get( 'title' );
				break;

			case 'quiz':
				$q = $lesson->get( 'quiz' );

				if ( $q ) {

					$url   = esc_url(
						add_query_arg(
							array(
								'quiz_id'   => $q,
								'lesson_id' => $lesson->get( 'id' ),
							)
						)
					);
					$value = '<a href="' . $url . '">' . get_the_title( $q ) . '</a>';

				} else {
					$value = '&ndash;';
				}

				break;

			default:
				$value = $key;

		}// End switch.

		return $this->filter_get_data( $value, $key, $lesson );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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