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_Student_Course::get_actions_html( obj $lesson )
Get the HTML for the actions column on the table
Parameters Parameters
- $lesson
-
(obj) (Required) LLMS_Lesson..
Return Return
(string)
Source Source
File: includes/admin/reporting/tables/llms.table.student.course.php
private function get_actions_html( $lesson ) {
$html = '';
// Evaluate against the student's progress, not the current (admin) user's.
// is_quiz_enabled() requires publish status, so unpublished quizzes are ignored.
$show_button = true;
if ( $lesson->is_quiz_enabled() ) {
$attempt = $this->student->quizzes()->get_best_attempt( $lesson->get( 'quiz' ) );
$passing_required = llms_parse_bool( $lesson->get( 'require_passing_grade' ) );
if ( ! $attempt || ( $passing_required && ! $attempt->is_passing() ) ) {
$show_button = false;
}
}
/**
* Filters whether the lesson action (mark complete/incomplete) button
* should display in the admin student course reporting table.
*
* @since 10.0.0
*
* @param bool $show_button Whether to show the button.
* @param LLMS_Lesson $lesson Lesson instance.
* @param LLMS_Student $student Student being reported on.
*/
$show_button = apply_filters( 'llms_admin_report_show_lesson_action_button', $show_button, $lesson, $this->student );
if ( $show_button ) {
if ( $this->student->is_complete( $lesson->get( 'id' ) ) ) {
$action = 'incomplete';
$icon = 'exclamation-triangle';
$text = __( 'Mark Incomplete', 'lifterlms' );
} else {
$action = 'complete';
$icon = 'check';
$text = __( 'Mark Complete', 'lifterlms' );
}
$html = '
<form action="" method="POST">
<input name="student_id" type="hidden" value="' . $this->student->get( 'id' ) . '">
<input name="lesson_id" type="hidden" value="' . $lesson->get( 'id' ) . '">
<button class="llms-button-secondary square small tip--bottom-left" data-tip="' . esc_attr( $text ) . '" name="llms-lesson-action" type="submit" value="' . $action . '">
<i class="fa fa-' . $icon . '" aria-hidden="true"></i>
</button>
' . wp_nonce_field( 'llms-admin-lesson-progression', 'llms-admin-progression-nonce', false, false ) . '
</form>
';
}
return $html;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.29.0 | Introduced. |