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


Top ↑

Return Return

(void)


Top ↑

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'];

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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