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()


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.quiz.attempts.php

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
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();
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Don't access LLMS_Query_Quiz_Attempt properties directly.
3.25.0 Unknown.
3.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.