<?php
$CI = get_instance();

if($page->field("login"))
{
	?>
	<div class="p-3">
		<?php
		require_once(MODULE_PATH . "/login/login.php");

		$m = new LoginModule();

		// Transfer page fields to module settings.
		foreach($page->fields as $f)
		{
			$m->set($f->key, $f->value);
		}

		if($m->enable_jquery())
		{
			$CI->enable_jquery = true;
		}
		if($m->enable_jquery_ui())
		{
			$CI->enable_jquery_ui = true;
		}

		foreach($m->scripts() as $script)
		{
			$CI->scripts[] = $script;
		}

		if(file_exists(MODULE_PATH . "/login/login.less"))
		{
			$CI->less[] = MODULE_PATH . "/login/login.less";
		}

		$m->module_instance_id = "a";
		$m->set("title", $page->field("title_login"));
		$m->set("title_heading_level", $page->field("title_heading_level_login"));
		$m->render();
		?>
	</div>
	<?php
}

if($page->field("registration"))
{
	?>
	<div class="p-3">
		<?php
		require_once(MODULE_PATH . "/registration/registration.php");

		$m = new RegistrationModule();

		// Transfer page fields to module settings.
		foreach($page->fields as $f)
		{
			$m->set($f->key, $f->value);
		}

		if($m->enable_jquery())
		{
			$CI->enable_jquery = true;
		}
		if($m->enable_jquery_ui())
		{
			$CI->enable_jquery_ui = true;
		}

		foreach($m->scripts() as $script)
		{
			$CI->scripts[] = $script;
		}

		if(file_exists(MODULE_PATH . "/registration/registration.less"))
		{
			$CI->less[] = MODULE_PATH . "/registration/registration.less";
		}

		$m->module_instance_id = "b";
		$m->set("title", $page->field("title_registration"));
		$m->set("title_heading_level", $page->field("title_heading_level_registration"));
		$m->render();
		?>
	</div>
	<?php
}
