LLMS_Table_Course_Students::get_results( array $args = array() )
Execute a query to retrieve results from the table.
Parameters Parameters
- $args
-
(array) (Optional) Array of query args.
Default value: array()
Return Return
(void)
Source Source
File: includes/admin/reporting/tables/llms.table.course.students.php
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | public function get_results( $args = array () ) { $this ->title = __( 'Students' , 'lifterlms' ); if ( ! $args ) { $args = $this ->get_args(); } $args = $this ->clean_args( $args ); $this ->course_id = $args [ 'course_id' ]; if ( isset( $args [ 'page' ] ) ) { $this ->current_page = absint( $args [ 'page' ] ); } $this ->filter = isset( $args [ 'filter' ] ) ? $args [ 'filter' ] : $this ->get_filter(); $this ->filterby = isset( $args [ 'filterby' ] ) ? $args [ 'filterby' ] : $this ->get_filterby(); $this ->order = isset( $args [ 'order' ] ) ? $args [ 'order' ] : $this ->get_order(); $this ->orderby = isset( $args [ 'orderby' ] ) ? $args [ 'orderby' ] : $this ->get_orderby(); $sort = array (); switch ( $this ->get_orderby() ) { case 'completed' : $sort = array ( 'completed' => $this ->get_order(), 'last_name' => 'ASC' , 'first_name' => 'ASC' , 'id' => 'ASC' , ); break ; case 'enrolled' : $sort = array ( 'date' => $this ->get_order(), 'last_name' => 'ASC' , 'first_name' => 'ASC' , 'id' => 'ASC' , ); break ; case 'id' : $sort = array ( 'id' => $this ->get_order(), ); break ; case 'name' : $sort = array ( 'last_name' => $this ->get_order(), 'first_name' => 'ASC' , 'id' => 'ASC' , ); break ; case 'status' : $sort = array ( 'status' => $this ->get_order(), 'last_name' => 'ASC' , 'first_name' => 'ASC' , 'id' => 'ASC' , ); break ; } $query_args = array ( 'page' => $this ->get_current_page(), 'post_id' => $args [ 'course_id' ], 'per_page' => apply_filters( 'llms_' . $this ->id . '_table_students_per_page' , 25 ), 'sort' => $sort , ); if ( 'status' === $this ->get_filterby() && 'any' !== $this ->get_filter() ) { $query_args [ 'statuses' ] = array ( $this ->get_filter() ); } if ( isset( $args [ 'search' ] ) ) { $this ->search = $args [ 'search' ]; $query_args [ 'search' ] = $this ->get_search(); } $query = new LLMS_Student_Query( $query_args ); $this ->max_pages = $query ->get_max_pages(); $this ->is_last_page = $query ->is_last_page(); $this ->tbody_data = $query ->get_students(); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
6.0.0 | Don't access LLMS_Student_Query properties directly. |
5.10.0 | Add ability to sort by completion date. |
3.15.0 | Introduced. |