LLMS_Admin_Assets::maybe_enqueue_reporting( WP_Sreen $screen )

Register and enqueue scripts used on and related-to reporting and analytics


Parameters Parameters

$screen

(WP_Sreen) (Required) Screen object from WP get_current_screen().


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.assets.php

	protected function maybe_enqueue_reporting( $screen ) {

		if ( in_array( $screen->base, array( 'lifterlms_page_llms-reporting', 'lifterlms_page_llms-settings' ), true ) ) {

			$current_tab = llms_filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );

			wp_register_script( 'llms-google-charts', LLMS_PLUGIN_URL . 'assets/js/vendor/gcharts-loader.min.js', array(), '2019-09-04', false );
			wp_register_script( 'llms-analytics', LLMS_PLUGIN_URL . 'assets/js/llms-analytics' . LLMS_ASSETS_SUFFIX . '.js', array( 'jquery', 'llms', 'llms-admin-scripts', 'llms-google-charts' ), LLMS()->version, true );

			// Settings "general" tab where we have analytics widgets.
			if ( 'lifterlms_page_llms-settings' === $screen->base && ( is_null( $current_tab ) || 'general' === $current_tab ) ) {

				wp_enqueue_script( 'llms-analytics' );

			} elseif ( 'lifterlms_page_llms-reporting' === $screen->base ) {

				if ( in_array( $current_tab, array( 'enrollments', 'sales' ), true ) ) {
					wp_enqueue_script( 'llms-analytics' );
				} elseif ( 'quizzes' === $current_tab && 'attempts' === llms_filter_input( INPUT_GET, 'stab', FILTER_SANITIZE_STRING ) ) {
					wp_enqueue_script( 'llms-quiz-attempt-review', LLMS_PLUGIN_URL . 'assets/js/llms-quiz-attempt-review' . LLMS_ASSETS_SUFFIX . '.js', array( 'jquery', 'llms' ), LLMS()->version, true );
				}
			}
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.3.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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