Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Table_Quizzes::get_actions_html( LLMS_Quiz $quiz )

Get HTML for buttons in the actions cell of the table


Parameters Parameters

$quiz

(LLMS_Quiz) (Required) Quiz object.


Top ↑

Return Return

(string)


Top ↑

Source Source

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

	private function get_actions_html( $quiz ) {

		if ( ! $quiz->is_orphan( true ) && $quiz->get_course() ) {
			return '';
		}

		// If there are quiz attempts for the quiz let the admin know they're going to delete the attempts also.
		$query = new LLMS_Query_Quiz_Attempt(
			array(
				'quiz_id'  => $quiz->get( 'id' ),
				'per_page' => 1,
			)
		);

		$msg  = $query->has_results() ? __( 'Are you sure you want to delete this quiz and all associated student attempts?', 'lifterlms' ) : __( 'Are you sure you want to delete this quiz?', 'lifterlms' );
		$msg .= ' ' . __( 'This action cannot be undone!', 'lifterlms' );

		ob_start();
		?>
		<form action="" method="POST" style="display:inline;">

			<button type="submit" class="llms-button-danger small" id="llms-del-quiz-<?php echo $quiz->get( 'id' ); ?>" name="llms_del_quiz" value="<?php echo $quiz->get( 'id' ); ?>">
				<?php _e( 'Delete', 'lifterlms' ); ?>
				<i class="fa fa-trash" aria-hidden="true"></i>
			</button>

			<input type="hidden" name="_llms_quiz_actions_nonce" value="<?php echo wp_create_nonce( 'llms-quiz-actions' ); ?>">

		</form>

		<script>document.getElementById( 'llms-del-quiz-<?php echo $quiz->get( 'id' ); ?>' ).onclick = function( e ) {
			return window.confirm( '<?php echo esc_attr( $msg ); ?>' );
		};</script>
		<?php
		return ob_get_clean();

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Don't access LLMS_Query_Quiz_Attempt properties directly.
4.2.0 Added a deep check on whether the quiz is associated to a lesson.
3.37.8 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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