LLMS_Table_Quiz_Attempts::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.quiz.attempts.php
public function get_results( $args = array() ) {
$this->title = __( 'Quiz Attempts', 'lifterlms' );
$args = $this->clean_args( $args );
$this->quiz_id = $args['quiz_id'];
if ( isset( $args['page'] ) ) {
$this->current_page = absint( $args['page'] );
}
$per = apply_filters( 'llms_reporting_' . $this->id . '_per_page', 25 );
$this->order = isset( $args['order'] ) ? $args['order'] : $this->order;
$this->orderby = isset( $args['orderby'] ) ? $args['orderby'] : $this->orderby;
$this->filter = isset( $args['filter'] ) ? $args['filter'] : $this->get_filter();
$this->filterby = isset( $args['filterby'] ) ? $args['filterby'] : $this->get_filterby();
$query_args = array(
'sort' => array(
$this->orderby => $this->order,
),
'page' => $this->current_page,
'per_page' => $per,
'quiz_id' => $args['quiz_id'],
'student_id' => isset( $args['student_id'] ) ? $args['student_id'] : null,
);
if ( 'any' !== $this->filter ) {
$query_args['status'] = $this->filter;
}
if ( current_user_can( 'view_others_lifterlms_reports' ) || ( current_user_can( 'view_lifterlms_reports' ) && current_user_can( 'edit_post', $args['quiz_id'] ) ) ) {
$query = new LLMS_Query_Quiz_Attempt( $query_args );
} else {
return;
}
$this->max_pages = $query->get_max_pages();
$this->is_last_page = $query->is_last_page();
$this->tbody_data = $query->get_attempts();
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 6.0.0 | Don't access LLMS_Query_Quiz_Attempt properties directly. |
| 3.25.0 | Unknown. |
| 3.16.0 | Introduced. |