LLMS_Table_Courses::get_data( string $key, mixed $data )
Retrieve data for a cell
Parameters Parameters
- $key
-
(string) (Required) the column id / key
- $data
-
(mixed) (Required) object / array of data that the function can use to extract the data
Return Return
(mixed)
Source Source
File: includes/admin/reporting/tables/llms.table.courses.php
protected function get_data( $key, $data ) { $course = llms_get_post( $data ); switch ( $key ) { case 'grade': $value = $course->get( 'average_grade' ) . '%'; break; case 'id': $value = $this->get_post_link( $course->get( 'id' ) ); break; case 'instructors': $data = array(); foreach ( $course->get_instructors() as $info ) { $instructor = llms_get_instructor( $info['id'] ); if ( $instructor ) { $data[] = sprintf( '%1$s (%2$s)', $instructor->get( 'display_name' ), $info['label'] ); } } $value = implode( ', ', $data ); break; case 'progress': $value = $this->get_progress_bar_html( $course->get( 'average_progress' ) ); break; case 'students': $value = number_format_i18n( $course->get_student_count(), 0 ); break; case 'title': $url = LLMS_Admin_Reporting::get_current_tab_url( array( 'tab' => 'courses', 'course_id' => $course->get( 'id' ), ) ); $value = '<a href="' . esc_url( $url ) . '">' . $course->get( 'title' ) . '</a>'; break; default: $value = $key; }// End switch(). return $value; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.15.0 | Introduced. |