LLMS_Table_Students::get_export_data( string $key, LLMS_Student $student )

Retrieve data for a cell in an export file


Description Description

Should be overridden in extending classes.


Top ↑

Parameters Parameters

$key

(string) (Required) The column id / key.

$student

(LLMS_Student) (Required) Instance of the LLMS_Student.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.students.php

	public function get_export_data( $key, $student ) {

		switch ( $key ) {

			case 'id':
				$value = $student->get_id();
				break;

			case 'courses_cancelled':
			case 'courses_enrolled':
			case 'courses_expired':
				$status  = explode( '_', $key );
				$status  = array_pop( $status );
				$courses = $student->get_courses(
					array(
						'status' => $status,
					)
				);
				$titles  = array();
				foreach ( $courses['results'] as $id ) {
					$titles[] = get_the_title( $id );
				}
				$value = implode( ', ', $titles );

				break;

			case 'email':
				$value = $student->get( 'user_email' );
				break;

			case 'memberships_cancelled':
			case 'memberships_enrolled':
			case 'memberships_expired':
				$status      = explode( '_', $key );
				$status      = array_pop( $status );
				$memberships = $student->get_memberships(
					array(
						'status' => $status,
					)
				);
				$titles      = array();
				foreach ( $memberships['results'] as $id ) {
					$titles[] = get_the_title( $id );
				}
				$value = implode( ', ', $titles );

				break;

			case 'name_first':
				$value = $student->get( 'first_name' );
				break;

			case 'name_last':
				$value = $student->get( 'last_name' );
				break;

			case 'overall_grade':
				$value = $student->get_overall_grade( false );
				if ( is_numeric( $value ) ) {
					$value .= '%';
				}
				break;

			case 'overall_progress':
				$value = $student->get_overall_progress( false ) . '%';
				break;

			case 'billing_address_1':
			case 'billing_address_2':
			case 'billing_city':
			case 'billing_state':
			case 'billing_zip':
			case 'billing_country':
			case 'phone':
				$value = $student->get( $key );
				break;

			default:
				$value = $this->get_data( $key, $student );

		}

		return $this->filter_get_data( $value, $key, $student, 'export' );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.26.1 Unknown.
3.15.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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