<?php
@session_start();

if ( ( $_SESSION[ "benutzer_anmeldename" ] == "superuser" ) and ( $_SESSION[ "mandant_name" ] == "Standard" ) )
{
	header( "Location: su_uebersicht.php" );
	exit;
}



//$benutzer_anmeldename = $_SESSION[ "benutzer_anmeldename" ];

if ( strlen( $_SESSION[ "benutzer_anmeldename" ] ) > 0 )
{
	////////////////////////////////////////
	// Javascript-Dateien
	$_SESSION[ "javascript_dateien" ] = "";
	////////////////////////////////////////
	
	////////////////////////////////////////
	// Javascript-Startup
	$_SESSION[ "javascript_startup" ] = '';
	////////////////////////////////////////
	
	////////////////////////////////////////
	// CSS-Dateien
	$_SESSION[ "css_dateien" ] = "";
	////////////////////////////////////////
	

	$_SESSION[ "title" ] = "Dokumentimport / Aktenanlage";
	include( 'ssi_header.php' );
	$_SESSION[ "title" ] = "";
	
	////////////////////////////////////////
	// Javascript-Dateien
	$_SESSION[ "javascript_dateien" ] = "";
	////////////////////////////////////////
	
	////////////////////////////////////////
	// Javascript-Startup
	$_SESSION[ "javascript_startup" ] = "";
	////////////////////////////////////////
	
	////////////////////////////////////////
	// CSS-Dateien
	$_SESSION[ "css_dateien" ] = "";
	////////////////////////////////////////
	
	//onclick=\"$( '#ergebnis_3' ).load('su_web.php?cmd=benutzer_anlegen', function() { $( '.date-pick' ).datepicker({ showAnim: 'clip', buttonImageOnly: true,  showOn: 'both', buttonImage: 'img/kalender.png', showWeek: true } ); } );
	
	$ergebnis = welche_dokumentarten_darf_benutzer_importieren( $_SESSION[ "mandant_name" ], $_SESSION[ "benutzer_anmeldename" ] );

	if ( $ergebnis[ 0 ] == 0 )
	{
		header( "Location: us_uebersicht.php" );
	}

	
	
	
	
	$us_rech_imp_button = liefere_benutzerspezifische_einstellung( $_SESSION[ "mandant_name" ], $_SESSION[ "benutzer_anmeldename" ], "us_rech_imp_button" );
	
	if ( $us_rech_imp_button == "ja" )
	{
		echo "<div style='margin-left:200px; padding-bottom:30px;  min-height:550px;'  >";
		include( "us_menu.php" );
	}
	else
	{
		echo "<div style='margin-left:20px; padding-bottom:30px;  min-height:550px;'  >";
	}
	/*
	$ergebnis = welche_dokumentarten_darf_benutzer_importieren( $_SESSION[ "mandant_name" ], $_SESSION[ "benutzer_anmeldename" ] );
	
	if ( $ergebnis[ 0 ] > 0 )
	{
		echo '<select name="alpha_03" style="height:100%; width:255px;" onchange="$( \'#importmaske\' ).load( \'su_web.php?cmd=liefere_importmaske&mandant_name='.urlencode( $mandant_name ).'&element_typ=\'+this.value, function() { $( \'.date-pick\' ).datepicker({ showAnim: \'clip\', buttonImageOnly: true,  showOn: \'both\', buttonImage: \'img/kalender.png\', showWeek: true } ); }, function() { $ (\'.fileupload\' ).fileupload({ url: \'us_upload.php\' }) } ) " ><option />';
		
		//echo '<select name="alpha_03" style="height:100%; width:255px;" onchange="ajaxFunction( \'su_web.php?cmd=liefere_importmaske&mandant_name='.urlencode( $mandant_name ).'&element_typ=\'+this.value, \'importmaske\' );" ><option />';
		
		foreach ( $ergebnis[ 1 ] as $dokart_kuerzel )
		{
			$erg = liefere_dokartinformationen( $mandant_name, $dokart_kuerzel );
			echo "<option value='".$erg[ 2 ][ "dokart_kuerzel" ]."'>".$erg[ 2 ][ "dokart_name" ]."</option>";
		}
		
		echo "</select><div id='importmaske'></div>
		
		
		
		
		
		
		
		
		";
	}
	
	
	
	*/
	$zstr = liefere_zufaelligen_string( );
	
	echo "<h2>Schritt 1 / 2 - Dateiupload</h2>";
	
	echo "<form id='file_upload' action='us_import_maske.php' method='POST' enctype='multipart/form-data' >
    <input type='file' name='file' multiple>
	<input type='hidden' value='".$zstr."' name='praefix' />
    <input type='hidden' value='DOK' name='dokarttyp' />
    <input type='submit' value='Upload'></input>
    </form>
	
	<br /><br/>";
	
	echo '<div name="ergebnis_3" id="ergebnis_3" style=" margin-top:10px;" >'.$_SESSION[ "meldung_ad" ].'</div>';
	$_SESSION[ "meldung_ad" ] = "";
	
	?>
	
	
	<form action='us_import_maske.php' method='POST'>
	<input type='hidden' value='AKT' name='dokarttyp' />
    <input type='submit' value='Akte anlegen'></input>
    </form>
	
	
	
	
	
	
	<?php
	
	echo '</div>';
	
	
	echo "<p style='clear:both;' />";
	include( 'ssi_footer.php' );

}
else
{
	header("Location: index.php");
}
?>