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
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 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. |