LLMS_Admin_Builder::output()

Output the page content


Return Return

(void)


Top ↑

Source Source

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

	public static function output() {

		global $post;

		$course_id = isset( $_GET['course_id'] ) ? absint( $_GET['course_id'] ) : null;
		if ( ! $course_id || ( $course_id && 'course' !== get_post_type( $course_id ) ) ) {
			_e( 'Invalid course ID', 'lifterlms' );
			return;
		}

		$post = get_post( $course_id );

		$course = llms_get_post( $post );

		if ( ! current_user_can( 'edit_course', $course_id ) ) {
			_e( 'You cannot edit this course!', 'lifterlms' );
			return;
		}

		remove_all_actions( 'the_title' );
		remove_all_actions( 'the_content' );

		global $llms_builder_lazy_load;
		$llms_builder_lazy_load = true;
		?>

		<div class="wrap lifterlms llms-builder">

			<?php do_action( 'llms_before_builder', $course_id ); ?>

			<div class="llms-builder-main" id="llms-builder-main"></div>

			<aside class="llms-builder-sidebar" id="llms-builder-sidebar"></aside>

			<?php
				$templates = array(
					'assignment',
					'course',
					'editor',
					'elements',
					'lesson',
					'lesson-settings',
					'quiz',
					'question',
					'question-choice',
					'question-type',
					'section',
					'settings-fields',
					'sidebar',
					'utilities',
				);

				foreach ( $templates as $template ) {
					echo self::get_template(
						$template,
						array(
							'course_id' => $course_id,
						)
					);
				}

				?>

			<script>window.llms_builder =
			<?php
			echo json_encode(
				array(
					'autosave'  => self::get_autosave_status(),
					'admin_url' => admin_url(),
					'course'    => $course->toArray(),
					'debug'     => array(
						'enabled' => ( defined( 'LLMS_BUILDER_DEBUG' ) && LLMS_BUILDER_DEBUG ),
					),
					'questions' => array_values( llms_get_question_types() ),
					'schemas'   => self::get_custom_schemas(),
					'sync'      => apply_filters(
						'llms_builder_sync_settings',
						array(
							'check_interval_ms' => 10000,
						)
					),
				)
			);
			?>
			</script>

			<?php do_action( 'llms_after_builder', $course_id ); ?>

		</div>

		<?php
		$llms_builder_lazy_load = false;
		self::handle_post_locking( $course_id );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.14.0 Added builder autosave preference defaults.
3.19.2 Unknown.
3.13.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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