Quiz::table_quiz_attempts_courses_column( $cell_data, $column, $data )
Source
File: classes/Quiz.php
public function table_quiz_attempts_courses_column( $cell_data, $column, $data ) { $course_id = dozent_array_get( 'ID', $data ); $post_statuses = get_post_statuses( $course_id ); $course_status = get_post_status( $course_id ); $course_status_text = dozent_array_get( $course_status, $post_statuses ); if ( $column === 'thumbnail' ) { return sprintf( '<div class="courses-thumbnail"> %s </div>', dozent_get_course_thumbnail( $course_id ) ); } if ( $column === 'course_info' ) { $quiz_count = dozent_get_total_quiz( $course_id ); $attempt_count = dozent_get_attempts_count_by_course( $course_id ); $quiz_count_text = sprintf( _n( '%s quiz', '%s quizzes', $quiz_count, 'dozent' ), number_format_i18n( $quiz_count ) ); $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( $course_id ) . "' target='_blank'><strong> " . get_the_title( $course_id ) . " </strong></a> <span class='dozent-pill dozent-pill-{$course_status}'> {$course_status_text} </span> </p>"; $output .= "<p class='dozent-text-muted dozent-small'> {$quiz_count_text}, {$attempt_count_text} </p>"; return $output; } if ( $column === 'buttons' ) { $quizzes_url = dozent_get_dashboard_permalink( 'quiz-attempts/quizzes' ); $quizzes_url = add_query_arg( [ 'course_id' => $course_id ], $quizzes_url ); return sprintf( "<a href='%s' class='dozent-btn dozent-btn-primary'> <i class='dicon-quiz'></i> " . __( 'Quizzes', 'dozent' ) . " </a>", $quizzes_url ); } return $cell_data; }