LLMS_Table_Questions::get_data( string $key, mixed $data )

Retrieve data for the columns


Description Description


Parameters Parameters

$key

(string) (Required) the column id / key

$data

(mixed) (Required) object of achievement data


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/admin/reporting/tables/llms.table.questions.php

	public function get_data( $key, $data ) {

		switch ( $key ) {

			case 'correct':
				$q = new LLMS_Question( $data['id'] );
				$correct = $q->get_correct_option();
				$value = $correct['option_text'];
			break;

			case 'id':
				$value = $this->get_post_link( $data['id'] );
			break;

			case 'name':
				$value = get_post_meta( $data->achievement_id, '_llms_achievement_title', true );
			break;

			case 'points':
				if ( $data['correct'] ) {
					$value = $data['points'];
				} else {
					$value = '0 <del>' . $data['points'] . '</del>';
				}
			break;

			case 'question':
				$q = new LLMS_Question( $data['id'] );
				$value = apply_filters( 'the_content', $q->post->post_content );
			break;

			case 'selected':
				$q = new LLMS_Question( $data['id'] );
				$options = $q->get_options();
				if ( isset( $data['answer'] ) && isset( $options[ $data['answer'] ]['option_text'] ) ) {
					$value = wp_kses_post( $options[ $data['answer'] ]['option_text'] );
				} else {
					$value = '';
				}
			break;

			default:
				$value = $key;

		}// End switch().

		return $this->filter_get_data( $value, $key, $data );

	}

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.