LLMS_Table_Student_Courses::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.student.courses.php
public function get_results( $args = array() ) {
$args = $this->clean_args( $args );
if ( is_numeric( $args['student'] ) ) {
$args['student'] = new LLMS_Student( $args['student'] );
}
$this->student = $args['student'];
if ( isset( $args['page'] ) ) {
$this->current_page = absint( $args['page'] );
}
$per = apply_filters( 'llms_gradebook_' . $this->id . '_per_page', 20 );
$order = ! empty( $args['order'] ) ? $args['order'] : 'ASC';
$order = in_array( $order, array( 'ASC', 'DESC' ) ) ? $order : 'ASC';
if ( isset( $args['order'] ) ) {
$this->order = $order;
}
if ( isset( $args['orderby'] ) ) {
$this->orderby = $args['orderby'];
}
switch ( $this->orderby ) {
case 'updated':
$orderby = 'upm.updated_date';
break;
case 'name':
default:
$orderby = 'p.post_title';
}
$courses = $this->student->get_courses(
array(
'limit' => $per,
'skip' => ( $this->current_page - 1 ) * $per,
'orderby' => $orderby,
'order' => $order,
)
);
if ( $courses['more'] ) {
$this->is_last_page = false;
}
$this->tbody_data = $courses['results'];
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |