<?php

function cloudfw_get_form_import_all_options(){
?>	
<script type="text/javascript">
jQuery(function(){
	
		jQuery('#upload-all-files').customFileInput();
});
</script>
<form enctype="multipart/form-data" class="slider_forms" action="<?php echo $this_page;?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-data" />
	<input type="hidden" id="case" name="case" value="import-all-options" />
    <input type="hidden" id="comeback" name="comeback" value="<?php echo $this_page?>" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" name="<?php echo PFIX.'_update'; ?>" value="1" />

    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    <div class="description"><?php _e('Choose a file to upload:','cloudfw'); ?></div><input id="upload-all-files" name="uploadedfile" class="upload-input" type="file" /><br/>
    <div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Import The File','cloudfw'); ?>"></div>
</form>
	
<?php }


function cloudfw_get_form_export_slider(){
?>	

<form id="export-sliders" class="" action="<?php echo TMP_ADMIN.'/ajax/backup.php?nonce='.wp_create_nonce('cloudfw').'&amp;case=export-sliders';?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-data" />
    <input type="hidden" id="comeback" name="comeback" value="<?php echo $this_page?>" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" name="zip" value="true" />
    
    <?php
    echo '<span class="select"><select class="input input_400" style="width: 400px;" autocomplete="off" id="ids" name="ids">';
	
		
		$sliders = get_option(PFIX.'_slider_ids');
		
		if (is_array($sliders)): foreach ((array) $sliders as $slider_id_ => $slider){
			
			$option = '<option value="'.$slider_id_.'">';
            $option .=  esc_attr($slider["title"]);
            $option .= '</option>';
            ${'echo_'.$slider["type"]} .=  $option;
			
		} endif;
		
		
		$theme_sliders = cloudfw_sliders();
		
		foreach ($theme_sliders as $slider_id => $slider_item) {
				
			if (${'echo_'.$slider_id})
			echo '
			<optgroup label="'.$slider_item["name"].'">	'.${'echo_'.$slider_id}.'</optgroup>
			';
							
		}		
	
	echo '</select></span>';
	
	?>
	<div class="clear"></div>
    <div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Export','cloudfw'); ?>"></div>
</form>

	
<?php }



function cloudfw_get_form_import_slider(){
?>	
<script type="text/javascript">
jQuery(function(){
	jQuery('#upload-slider').customFileInput();
});
</script>
<div class="clear"></div>
<form enctype="multipart/form-data" class="slider_forms" action="<?php echo $this_page;?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-data" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" name="<?php echo PFIX.'_update'; ?>" value="1" />
    <input type="hidden" name="type" value="slider" />

	<input id="upload-slider" class="upload-input" name="uploadedfile" type="file" />	<br/>

    <div class="upload-submit"><div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Import Slider(s)','cloudfw'); ?>"></div>
    <?php         
		$sizeLimit = apply_filters('cloudfw_upload_limit', cloudfw_upload_size());
		$sizeLimit = max(1, $sizeLimit / 1024 / 1024) . 'M';             

        echo "<em class=\"description fileSizeLimit\">File Size Limit: {$sizeLimit}</em>";

     ?>

    </div>    
</form>
	
<?php }



function cloudfw_get_form_export_skin(){
?>	

<form id="export-skins" class="" action="<?php echo TMP_ADMIN.'/ajax/backup.php?nonce='.wp_create_nonce('cloudfw').'&amp;case=export-skins';?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-data" />
    <input type="hidden" id="comeback" name="comeback" value="<?php echo $this_page?>" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" id="zip" name="zip" value="1" />

    <?php
    echo '<span class="select"><select class="input input_400" style="width: 400px;" autocomplete="off" id="ids" name="ids">';
	
	$all_skins = cloudfw_get_all_skins();
	
	 foreach ((array)$all_skins as $skin):
	 	
	 	$skin_data = cloudfw_get_a_skin($skin);
		
		if ($skin_data) {
			
			echo '<option value="'.$skin.'">'.$skin_data["name"].'</option>';
		
		}
				
	endforeach;
	
	echo '</select></span>';
	
	?>
                
	<div class="clear"></div>
    <div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Export','cloudfw'); ?>"></div>
</form>  
	
<?php }



function cloudfw_get_form_import_skin(){
?>	
<script type="text/javascript">
jQuery(function(){
	jQuery('#upload-skin').customFileInput();
});
</script>
<div class="clear"></div>
<form enctype="multipart/form-data" class="slider_forms" action="<?php echo $this_page;?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-data" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" name="<?php echo PFIX.'_update'; ?>" value="1" />
    <input type="hidden" name="type" value="skin" />

	<input id="upload-skin" class="upload-input" name="uploadedfile" type="file" /><br/>
    <div class="upload-submit"><div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Import Skin(s)','cloudfw'); ?>"></div>

    <?php         

		$sizeLimit = apply_filters('cloudfw_upload_limit', cloudfw_upload_size());
		$sizeLimit = max(1, $sizeLimit / 1024 / 1024) . 'M';             

        echo "<em class=\"description fileSizeLimit\">File Size Limit: {$sizeLimit}</em>";

     ?>

    </div>
</form>
	
<?php }


function cloudfw_get_form_import_iconset(){
?>	
<script type="text/javascript">
jQuery(function(){
	
		jQuery('#upload-iconset').customFileInput();
});
</script>
<div class="clear"></div>
<form enctype="multipart/form-data" class="slider_forms" action="<?php echo $this_page;?>" method="POST">
	<input type="hidden" id="form_selector" name="form_selector" value="import-zip" />
	<input type="hidden" id="case" name="case" value="import-icon-set" />
    <input type="hidden" id="comeback" name="comeback" value="<?php echo $this_page?>" />
    <input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce('cloudfw'); ?>" />
    <input type="hidden" name="<?php echo PFIX.'_update'; ?>" value="1" />

    <input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
    <div class="description"><?php _e('Choose a .zip file to upload','cloudfw'); ?>:</div><input id="upload-iconset" name="uploadedfile" class="upload-input" type="file" /><br/>
    <div class="small-button small-sky"><input type="submit" autocomplete="off" value="<?php _e('Import The File','cloudfw'); ?>"></div>
</form>	
<?php }