<?php
/**
 * @version    $Id$
 * @package    IT_Theme_Framework
 * @author     InnoThemes Team <support@innothemes.com>
 * @copyright  Copyright (C) 2012 InnoThemes.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.innothemes.com
 */

// Check if we have any backup file?
$path = wp_upload_dir();
$path = $path['basedir'] . '/' . IT_THEME_ID . '/backup';

if ( count( $files = glob( "{$path}/*.sql" ) ) ) {
	// Sort by file name
	sort( $files );

	// Store latest backup file
	$backup = array_pop( $files );
}
?>
<legend><?php _e( 'Getting Started', IT_THEME_TEXTDOMAIN ); ?></legend>
<div class="it-getting-started">
	<h3><?php _e( 'Step 1. Setup sample data', IT_THEME_TEXTDOMAIN ); ?></h3>

	<p><?php _e( 'The best way to understand the template is to setup sample data on your website to make it look the same as template demo website.', IT_THEME_TEXTDOMAIN ); ?></p>
	<ul>
		<li>
			<a href="javascript:void(0)" id="it-install-sample-data" class="btn btn-default btn-sm"><b><?php _e( 'Install Sample Data', IT_THEME_TEXTDOMAIN ); ?></b></a>
		</li>
	</ul>
	<?php if ( isset( $backup ) ) : ?>
	<div id="it-data-backup">
		<p><?php _e( 'Found backup-ed data of your site. What do you want to do?', IT_THEME_TEXTDOMAIN ); ?></p>
		<ul>
			<li class="pull-left">
				<a href="javascript:void(0)" id="it-restore-backup-data" class="btn btn-default btn-sm" loading-text="<?php _e( 'Restoring', IT_THEME_TEXTDOMAIN ); ?>"><b><?php _e( 'Restore Backup Data', IT_THEME_TEXTDOMAIN ); ?></b></a>
			</li>
			<li class="pull-left">
				<a href="javascript:void(0)" id="it-remove-backup-data" class="btn btn-default btn-sm" loading-text="<?php _e( 'Removing', IT_THEME_TEXTDOMAIN ); ?>"><b><?php _e( 'Remove Backup Data', IT_THEME_TEXTDOMAIN ); ?></b></a>
			</li>
		</ul>
	</div>
	<?php endif; ?>
	<div id="it-install-sample-data-modal" class="jsn-bootstrap hidden" title="<?php _e( 'Install Sample Data', IT_THEME_TEXTDOMAIN ); ?>"></div>
	<hr />

	<h3><?php _e( 'Step 2. Check documentation', IT_THEME_TEXTDOMAIN ); ?></h3>

	<p><?php _e( 'Now, when the sample data installed, it\'s about time to take a look at template documentation and start exploration.', IT_THEME_TEXTDOMAIN ); ?></p>
	<ul>
		<li>
			<a href="#docs.zip" target="_blank" id="it-read-documentation" class="btn btn-default btn-sm">
				<b><?php _e( 'Read documentation', IT_THEME_TEXTDOMAIN ); ?></b>
			</a>
		</li>
	</ul>
</div>
<?php
$script = '
		new $.IT_SampleData({
			base_url: "' . get_admin_url() . '"
		});';

IT_Init_Assets::inline( 'js', $script, true );
