<?php

/**
 * iCMS - i Content Management System
 * Copyright (c) 2007-2017 iCMSdev.com. All rights reserved.
 *
 * @author icmsdev <master@icmsdev.com>
 * @site https://www.icmsdev.com
 * @licence https://www.icmsdev.com/LICENSE.html
 */
defined('iPHP') or exit('What are you doing?');
self::head();
?>
<div class="bg-image" style="background-image: url('./assets/img/bg/photo15.jpg');">
	<div class="bg-primary-dark-op">
		<div class="content content-full text-center py-3">
			<h1 class="h2 text-white mb-2"><?php echo $title;?>安装</h1>
		</div>
	</div>
</div>
<div class="content" id="<?php echo APP_MAINID; ?>">

	<?php if (!$start) { ?>
		<div class="bg-light d-flex justify-content-center align-items-center" style="height: 150px;">
			<a style="font-size: 1.25rem;" class="btn btn-primary btn-lg " href="<?php echo self::url('start=1'); ?>"><i class="fa fa-fw fa-wrench"></i> 开始安装</a>
		</div>
	<?php } else { ?>
		<div id="log">
		</div>
		<script type="text/javascript">
			var log = "1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>1<iCMS>";
			var n = 0;
			var timer = 0;
			log = log.split('<iCMS>');
			setIntervals();

			function GoPlay() {
				if (n > log.length - 1) {
					n = -1;
					clearIntervals();
				}
				if (n > -1) {
					Play(n);
					n++;
				}
			}

			function Play(n) {
				log[n] = log[n].replace('#', '<br />');
				document.getElementById('log').innerHTML += log[n] + '<br /><a name="last"></a>';
				document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight;
			}

			function setIntervals() {
				timer = setInterval('GoPlay()', 100);
			}

			function clearIntervals() {
				clearInterval(timer);
				// finish();
			}
		</script> 
		<?php } ?>
</div>

<?php self::foot(); ?>