Quiz::table_attempts_for_review_column( $cell_data, $column, $data )
Source
File: classes/Quiz.php
public function table_attempts_for_review_column( $cell_data, $column, $data ) { $attempt_id = dozent_array_get( 'id', $data ); $user_id = dozent_array_get( 'user_id', $data ); if ( $column === 'attempt_info' ) { $user = get_userdata( $user_id ); $avatar = dozent_get_avatar( $user_id ); $profile_url = dozent_user_url( $user, false ); $total_scores = dozent_array_get( 'total_scores', $data ); $earned_scores = dozent_array_get( 'earned_scores', $data ); $attempt_status = dozent_array_get( 'status', $data ); $passing_percent = dozent_array_get( 'passing_percent', $data ); $created_at = dozent_array_get( 'created_at', $data ); $ended_at = dozent_array_get( 'ended_at', $data ); $earned_percentage = $earned_scores > 0 ? ( number_format( ( $earned_scores * 100 ) / $total_scores ) ) : 0; $takes_time = __( 'Time Takes', 'dozent' ) . ' - ' . dozent_datetime_diff( $created_at, $ended_at ); if ( $attempt_status === 'in_review' ) { $result = '<span class="dozent-pill">' . __( 'Under Review', 'dozent' ) . '</span>'; } else { if ( $earned_percentage >= $passing_percent ) { $result = '<span class="dozent-pill dozent-pill-result-pass">' . __( 'Pass', 'dozent' ) . '</span>'; } else { $result = '<span class="dozent-pill dozent-pill-result-fail">' . __( 'Fail', 'dozent' ) . '</span>'; } } $output = "<div class='student-name dozent-d-flex dozent-align-flex-start'> {$avatar} <strong class='flex-grow-1'> <a href='{$profile_url}' target='_blank'> {$user->display_name} </a> </strong> {$result} </div>"; $output .= "<p class='dozent-text-muted dozent-small'> {$takes_time} </p>"; return $output; } if ( $column === 'status' ) { $status = dozent_array_get( $cell_data, dozent_attempt_statuses() ); $output = "<span class='dozent-pill dozent-pill-status-{$cell_data}'> {$status} </span>"; return $output; } if ( $column === 'buttons' ) { $review_url = dozent_get_dashboard_permalink( 'quiz-attempts/attempt-review' ); $review_url = add_query_arg( [ 'attempt_id' => $attempt_id ], $review_url ); return sprintf( "<a href='%s' class='dozent-btn dozent-btn-primary'> <i class='dicon-check'></i> " . __( 'Review', 'dozent' ) . " </a>", $review_url ); } return $cell_data; }