Quiz::table_dozent_course_has_quizzes_column( $cell_data,  $column,  $data )


Source

File: classes/Quiz.php

	public function table_dozent_course_has_quizzes_column( $cell_data, $column, $data ) {
		$quiz_id = dozent_array_get( 'ID', $data );

		if ( $column === 'quiz_info' ) {
			$attempt_count      = dozent_get_attempts_count_by_quiz( $quiz_id );
			$attempt_count_text = sprintf( _n( '%s attempt', '%s attempts', $attempt_count, 'dozent' ),
				number_format_i18n( $attempt_count ) );

			$output = '';
			$output .= "<p class='dozent-mb-2'>
                           <a href='" . get_the_permalink( $quiz_id ) . "' target='_blank'><strong> "
			           . get_the_title( $quiz_id ) . " </strong></a>
                        </p>";

			$output .= "<p class='dozent-text-muted dozent-small'> {$attempt_count_text} </p>";

			return $output;
		}

		if ( $column === 'buttons' ) {
			$quizzes_url = dozent_get_dashboard_permalink( 'quiz-attempts/attempts' );
			$quizzes_url = add_query_arg( [ 'quiz_id' => $quiz_id ], $quizzes_url );

			return sprintf( "<a href='%s' class='dozent-btn dozent-btn-primary'> <i class='dicon-quiz'></i> "
			                . __( 'Attempts', 'dozent' ) . " </a>", $quizzes_url );
		}

		return $cell_data;
	}