LLMS_Table_Student_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.student.quiz.attempts.php
public function get_results( $args = array() ) {
$this->title = __( 'Quiz Attempts', 'lifterlms' );
$args = $this->clean_args( $args );
$this->student_id = $args['student_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,
'student_id' => $this->student_id,
);
// Add search functionality
if ( isset( $args['search'] ) && ! empty( $args['search'] ) ) {
$query_args['search'] = $args['search'];
}
if ( 'any' !== $this->filter ) {
$query_args['status'] = $this->filter;
}
// Check permissions
if ( ! current_user_can( 'view_others_lifterlms_reports' ) && ! llms_current_user_can( 'view_lifterlms_reports', $this->student_id ) ) {
return;
}
$query = new LLMS_Query_Quiz_Attempt( $query_args );
$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 |
|---|---|
| 9.1.0 | Introduced. |