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.
Parameters Parameters
- $key
-
(string) (Required) The column id / key.
- $student
-
(LLMS_Student) (Required) Instance of the LLMS_Student.
Return Return
(mixed)
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' ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.26.1 | Unknown. |
3.15.0 | Introduced. |