LLMS_Admin_Reporting_Tab_Students::breadcrumbs()

Add breadcrumb links to the tab depending on current view


Return Return

(void)


Top ↑

Source Source

File: includes/admin/reporting/tabs/class.llms.admin.reporting.tab.students.php

	public function breadcrumbs() {

		$links = array();

		// Single student.
		if ( isset( $_GET['student_id'] ) ) {
			$student = new LLMS_Student( absint( $_GET['student_id'] ) );
			$links[ LLMS_Admin_Reporting::get_stab_url( 'information' ) ] = $student->get_name();

			if ( isset( $_GET['stab'] ) && 'courses' === $_GET['stab'] ) {
				$links[ LLMS_Admin_Reporting::get_stab_url( 'courses' ) ] = __( 'All Courses', 'lifterlms' );

				if ( isset( $_GET['course_id'] ) ) {

					$course_id     = llms_filter_input( INPUT_GET, 'course_id', FILTER_SANITIZE_NUMBER_INT );
					$student_id    = llms_filter_input( INPUT_GET, 'student_id', FILTER_SANITIZE_NUMBER_INT );
					$url           = LLMS_Admin_Reporting::get_current_tab_url(
						array(
							'stab'       => 'courses',
							'student_id' => $student_id,
							'course_id'  => $course_id,
						)
					);
					$links[ $url ] = get_the_title( $course_id );

					if ( isset( $_GET['quiz_id'] ) ) {
						$quiz_id       = llms_filter_input( INPUT_GET, 'quiz_id', FILTER_SANITIZE_NUMBER_INT );
						$url           = LLMS_Admin_Reporting::get_current_tab_url(
							array(
								'stab'       => 'courses',
								'student_id' => $student_id,
								'course_id'  => $course_id,
								'quiz_id'    => $quiz_id,
							)
						);
						$links[ $url ] = get_the_title( $quiz_id );

					}
				}
			}
		}

		foreach ( $links as $url => $title ) {

			echo '<a href="' . esc_url( $url ) . '">' . $title . '</a>';

		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.35.0 Sanitize input data.
3.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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