Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/src/js/v3/@types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type InjectionSlots } from '@TutorShared/utils/types';

import { type InjectedField } from '@CourseBuilderContexts/CourseBuilderSlotContext';

export type { };
export type {};

interface Tutor {
readonly CourseBuilder: {
Expand Down
20 changes: 15 additions & 5 deletions models/QuizModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,17 +982,27 @@ public static function get_quiz_answers_by_attempt_id( $attempt_id, $add_index =
return array();
}

//phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$results = $wpdb->get_results(
"SELECT answers.*,
$cache_key = __FUNCTION__ . implode( '_', $ids );
$cached = TutorCache::get( $cache_key );
$results = array();

if ( false === $cached ) {
//phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$results = $wpdb->get_results(
"SELECT answers.*,
question.*
FROM {$wpdb->prefix}tutor_quiz_attempt_answers answers
LEFT JOIN {$wpdb->prefix}tutor_quiz_questions question
ON answers.question_id = question.question_id
WHERE answers.quiz_attempt_id IN ({$ids_in})
ORDER BY attempt_answer_id ASC;"
);
//phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
);
//phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared

TutorCache::set( $cache_key, $results );
} else {
$results = $cached;
}

if ( $add_index ) {
$new_array = array();
Expand Down
8 changes: 5 additions & 3 deletions templates/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
'icon_class' => 'ttr tutor-icon-hamburger-o tutor-dashboard-menu-toggler',
),
);

$enrolled_student_count = (int) tutor_utils()->get_total_students_by_instructor( $user_id );
?>

<?php do_action( 'tutor_dashboard/before/wrap' ); ?>
Expand All @@ -111,7 +113,7 @@ class="tutor-dashboard-layout<?php echo esc_attr( ( $has_dashboard_site_footer ?
>
<?php tutor_load_template( 'dashboard.components.sidebar' ); ?>
<div class="tutor-dashboard-main">
<?php tutor_load_template( 'dashboard.components.header' ); ?>
<?php tutor_load_template( 'dashboard.components.header', array( 'enrolled_student_count' => $enrolled_student_count ) ); ?>
<div class="tutor-dashboard-body" role="main">
<div class="tutor-dashboard-page">
<?php
Expand All @@ -137,15 +139,15 @@ class="tutor-dashboard-layout<?php echo esc_attr( ( $has_dashboard_site_footer ?
$from_other_location = apply_filters( 'load_dashboard_template_part_from_other_location', $other_location );

if ( '' == $from_other_location ) {
tutor_load_template( 'dashboard.' . $dashboard_page_name );
tutor_load_template( 'dashboard.' . $dashboard_page_name, array( 'enrolled_student_count' => $enrolled_student_count ) );
} else {
// Load template from other location full abspath.
include_once $from_other_location;
}

do_action( 'tutor_load_dashboard_template_after', $dashboard_page_name );
} elseif ( User::is_instructor_view() ) {
tutor_load_template( 'dashboard.dashboard' );
tutor_load_template( 'dashboard.dashboard', array( 'total_students' => $enrolled_student_count ) );
} else {
tutor_load_template( 'dashboard.student.dashboard' );
}
Expand Down
4 changes: 3 additions & 1 deletion templates/dashboard/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @author Themeum <support@themeum.com>
* @link https://themeum.com
* @since 1.4.3
*
* @var int $total_students passed from tutor\templates\dashboard.php
*/

defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -52,4 +54,4 @@
}
}

tutor_load_template( 'dashboard.instructor.home' );
tutor_load_template( 'dashboard.instructor.home', array( 'total_students' => $total_students ?? 0 ) );
3 changes: 2 additions & 1 deletion templates/learning-area/components/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @author Themeum <support@themeum.com>
* @link https://themeum.com
* @since 4.0.0
*
* @var array $menu_items passed from tutor\templates\learning-area\index.php
*/

defined( 'ABSPATH' ) || exit;
Expand Down Expand Up @@ -42,7 +44,6 @@
$is_preview = get_post_meta( $tutor_current_post->ID, '_is_preview', true );
$current_url = trailingslashit( $tutor_course_list_url ) . $tutor_course->post_name;

$menu_items = Template::make_learning_area_sub_page_nav_items( $current_url );
$active_menu = Template::learning_area_active_subpage();

$course_reset_progress = tutor_utils()->get_option( 'course_reset_progress', false );
Expand Down
2 changes: 1 addition & 1 deletion templates/learning-area/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class="tutor-learning-area<?php echo esc_attr( ( is_admin_bar_showing() ? ' tuto
>
<?php tutor_load_template( 'learning-area.components.header' ); ?>
<div class="tutor-learning-area-body">
<?php tutor_load_template( 'learning-area.components.sidebar' ); ?>
<?php tutor_load_template( 'learning-area.components.sidebar', array( 'menu_items' => $subpages ) ); ?>
<div class="tutor-learning-area-content" role="main">
<div class="tutor-learning-area-container">
<?php
Expand Down
Loading