<!DOCTYPE html>
<html lang="cz">  
  <head>        
     <title>Wasah</title>         
    <meta name="viewport" content="width=device-width, initial-scale=1.0">         
    <meta charset="utf-8">         
    <!-- External CSS libraries -->          
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">         
    <link rel="stylesheet" type="text/css" href="css/bootstrap-submenu.css">         
    <link rel="stylesheet" type="text/css" href="css/animate.min.css">         
    <link rel="stylesheet" type="text/css" href="css/slider.css">         
    <link rel="stylesheet" type="text/css" href="fonts/font-awesome/css/font-awesome.min.css">         
    <link rel="stylesheet" type="text/css" href="fonts/linearicons/style.css">         
    <link rel="stylesheet" type="text/css" href="fonts/flaticon/font/flaticon.css">         
    <link href="css/bootstrap-select.min.css" type="text/css" rel="stylesheet">         
    <!-- Custom stylesheet -->          
    <link rel="stylesheet" type="text/css" href="css/style.css">         
    <link rel="stylesheet" type="text/css" href="css/style_form.css">         
    <link rel="stylesheet" type="text/css" id="style_sheet" href="css/colors/default.css">         
    <!-- Favicon icon -->         
    <link rel="shortcut icon" href="img/favicon.gif" type="image/x-icon" >         
    <!-- Google fonts -->          
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800%7CPlayfair+Display:400,700%7CRoboto:100,300,400,400i,500,700">         
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->          
    <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet">         
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->          
    <!--[if lt IE 9]><script type="text/javascript" src="js/ie8-responsive-file-warning.js"></script><![endif]-->      
<script type="text/javascript" src="js/ie-emulation-modes-warning.js"></script>          
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->          
    <!--[if lt IE 9]>
            <script type="text/javascript" src="js/html5shiv.min.js"></script>
            <script type="text/javascript" src="js/respond.min.js"></script>
            <![endif]-->   
  </head>  
  <body>      
<?php 
    
    
    
        if (isset($_GET["ID"])) {  ?>        
    <div class="page_loader">      
      <img src="img/loader.gif" alt="Loader">    
    </div>    
    <!-- Top Header start -->      
    <?php include_once ("styl/vrchni_panel.php");?>     
    <!-- Top Header end -->     
    <!-- Main header start -->     
    <?php include_once ("styl/panel.php");?>     
    <!-- Main header end -->     
    <!-- Sub banner start -->     
    <div class="sub-banner">           
      <div class="overlay">           
      </div>    
    </div>    
    <!-- Sub banner end -->            
<?php 
 // *******************************Zápis do databáze START******************************   
    include_once ("databaze/pripojit.php"); 
      $id = htmlspecialchars($_GET["ID"]);
   if (isset($_GET["zmena_nazev"])) {
      $z_nazev = htmlspecialchars($_GET["zmena_nazev"]);
      $z_popis = htmlspecialchars($_GET["zmena_popis"]);
      $z_max_osoby= htmlspecialchars($_GET["zmena_max_osoby"]);
      $z_vedouci = htmlspecialchars($_GET["zmena_vedouci"]);
      $z_prihlaseni_datum = htmlspecialchars($_GET["zmena_prihlaseni_datum"]);
      $z_odhlaseni_datum = htmlspecialchars($_GET["zmena_odhlaseni_datum"]);
      $z_misto_konani = htmlspecialchars($_GET["zmena_misto_konani"]);

          
   
  $dotaz="UPDATE event SET nazev ='$z_nazev' , popis = '$z_popis', max_osoby = '$z_max_osoby', vedouci = '$z_vedouci', prihlaseni_datum = '$z_prihlaseni_datum', odhlaseni_datum = '$z_odhlaseni_datum', misto_konani = '$z_misto_konani'  WHERE ID='$id'";  
     $vysledek = mysqli_query($link, $dotaz);
if(!$vysledek) {
    echo "errror uprava auta";
    exit();
  }         
       
    
     }
 // *******************************Zápis do databáze STOP******************************  
       
     
 $dotaz="SELECT * FROM event WHERE ID='".$_GET["ID"]."'";
$vysledek = mysqli_query($link, $dotaz);
if(!$vysledek) {
    echo "error udalosti?id";
    exit();
              }
  
                	$radek=mysqli_fetch_object($vysledek);
                  
 
         ?>          
    <!-- **************************************************************** ZMĚNA AUTA START**************************--->          
    <form action="#"  method="GET" id="uprava_auta">            
      <input type="hidden" name="ID" value="<?php echo $radek->ID;?>">         
      <!-- **************************************************************** ZMĚNA AUTA STOP**************************--->         
      <!-- Car details body start-->         
      <div class="car-details-body">             
        <div class="container">                   
          <div class="row">                         
            <div class="col-lg-12">                               
              <!-- Option bar start-->                                
              <div class="option-bar  details-option-bar clearfix">                                     
                <div class="row">                                           
                  <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">                                                 
                    <div class="section-heading">                                                       
                      <div class="media">                                                             
                        <div class="media-left">                                                                   
                          <i class="lnr lnr-calendar-full"></i>                                                             
                        </div>                                                             
                        <div class="media-body hidden-xs">                                        <h4>                            
                            <?php echo $radek->nazev;?></h4>       									                              
                          <div class="border">                          
                          </div>                                                                   
                          <p>                            
                            <!-- EEC1 -->                          
                          </p>                                                             
                        </div>                                                       
                      </div>                                                 
                    </div>                                           
                  </div>                                                            
                </div>                               
              </div>                               
              <!-- Option bar end-->                          
            </div>                   
          </div>                   
          <div class="row">                         
            <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12">                               
              <div class="car-details sidebar-widget">                                     
                <!-- Car detail slider start-->                                      
                <div class="car-detail-slider simple-slider">                                           
                  <div id="carousel-custom" class="carousel slide" data-ride="carousel">                                                 
                    <div class="carousel-outer">                                                       
                      <!-- Wrapper for slides -->                                                        
                      <div class="carousel-inner">                                                             
                        <div class='item active'>                                                                   
                          <img src='img/event.jpg' class="thumb-preview" alt='event' />                                                             
                        </div>                                                       
                      </div>                                                                 </a>                                                 
                    </div>                                                                    
                    </ol>                                           
                  </div>                                     
                </div>                                     
                <!-- Car detail slider end-->                                      
                <br>                                     
                <!-- Car details end -->                                                           
                <!-- Panel box start -->                                      
                <div class="panel-box">                                           
                  <ul class="nav nav-tabs">                                                 
                    <li class="active">                      
                      <a href="#tab1default" data-toggle="tab" aria-expanded="true">Účastníci</a>                    
                    </li>
					 <li class="">                      
                      <a href="#tab2default" data-toggle="tab" aria-expanded="false">Soubory</a></li> 
					<li class="">
                    <a href="#tab3default" data-toggle="tab" aria-expanded="false">Zpráva vedoucímu události</a></li>
                                 <li class="">                     
                      <a href="#tab4default" data-toggle="tab" aria-expanded="true">Další informace</a>                    
                    </li>                                                                                               
                                                          
                  </ul>                                           
                  <div class="panel with-nav-tabs panel-default">                                                 
                    <div class="panel-body">                                                       
                      <div class="tab-content">                                                             
                        <div class="tab-pane fade active in" id="tab1default">                                                 
                         

                          
                          
                          <br>       
                          <font  size="5" color="#4BA82E">Seznam přihlášených:  </font>
                          <br><br>
                              <?php
                        $dotaz_vypis="SELECT * FROM event_registrace WHERE id_udalosti = '$radek->ID'";
                        $vysledek_vypis = mysqli_query($link, $dotaz_vypis);
                        if(!$vysledek_vypis) {
                          echo "error vypis prihlasenych";
                         exit();
                              }    
                      $pocet_vypis = mysqli_num_rows($vysledek_vypis); 
                         
                         
                        for ($i_vypis = 0; $pocet_vypis > $i_vypis; $pocet_vypis--) {  
                	       $radek_vypis=mysqli_fetch_object($vysledek_vypis); ?>
                        
                        <font  size="4" color="black"> <?php echo $radek_vypis->email; ?> 
                        
                        
                        <?php
                        
                        if ($_SESSION["uzivatel"]->prava=='admin' || $_SESSION["uzivatel"]->prava=='superadmin') {    ?>
                          
                        <a href="event_odhlaseni.php?email=<?php echo "$radek_vypis->email&event=$radek->ID"?>" OnClick="return confirm('Opravdu tohoto uživatele chceš smazat?');" class="button_smazat"> Smazat </a>
                        
                           <?php } ?>
                        
                        </font>
                        <br>
                           <?php } ?>
                                                                                
                          </font>                                          
                        </div> 
						
                        <div class="tab-pane fade features" id="tab2default">
                        </form>
<!------------------------------------------------------------------------ SOUBORY -------------------------------------------------------------------->

<?php  if ($_SESSION["uzivatel"]->prava=='admin' || $_SESSION["uzivatel"]->prava=='superadmin' || $_SESSION["uzivatel"]->prava=='Technik'){ ?>                      
<form  id='idForm' action="files.php" method="post" enctype="multipart/form-data" >
    <font size="5" color="#4BA82E">Vyber soubor k nahrání: </font>  
    <input type="file" name="fileToUpload" id="fileToUpload"><br>
     <button form='idForm' type="submit" class="btn btn-submit btn-block" >Nahraj soubor</button>
    <input id="prodId" name="prodId" type="hidden" value="<?php echo $radek->ID?>">
</form>
<?php  } ?>
                        <br><br>
						<font size="5" color="#4BA82E">Soubory:</font> <br>
                         <?php
                               $files = scandir( "files" );
                              foreach( $files as $file ){
                                 if ($file === '.' or $file === '..') continue;
                                 if (preg_match('#'.$radek->ID.'_#',$file)){echo "<a href='files/$file' download>$file</a><br>";}      
                                
                                     }                                                       
                                   ?>
<!------------------------------------------------------------------------ SOUBORY -------------------------------------------------------------------->                     
                         </div>  

                          

                        <div class="tab-pane fade" id="tab3default">
                                                                <div class="inside-car mrg-btm-40 ">
                                                              <div class="private-message-to-dealer sidebar-widget">
                        <h2 class="title">Zpráva vedoucímu události</h2>
                        <div class=" contact-form">
                            <form action="event_zprava.php" method="GET" id="form1"> 
                                <div class="row">
                                    <div class="form-group  col-xs-12 col-sm-12 col-md-12">
                                        <label for="name">Jméno a Příjmení</label>
                                        <input type="text" name="fullname" class="input-text" id="name" placeholder="">
                                    </div>
                                    <div class="form-group  col-xs-12 col-sm-12 col-md-12">
                                        <label for="email">E-mail</label>
                                        <input type="email" name="email" class="input-text" id="email" placeholder="">
                                    </div>
                                    <div class="form-group  col-xs-12 col-sm-12 col-md-12">
                                        <label for="message">Zpráva</label>
                                        <textarea class="input-text" name="message" id="message" placeholder=""></textarea>
                                    </div>
                                    <div class="form-group  col-xs-12 col-sm-12 col-md-12">
                                    <input type="hidden" name="emailspravce" value=" <?php echo $radek->vedouci;?>">
                                    <input type="hidden" name="odkaz" value=" <?php echo $radek->ID;?>">
                                        <button type="submit" class="btn btn-submit btn-block" form="form1">Odeslat zprávu</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                                        </div>
                     
                         </div> 

<div class="tab-pane fade" id="tab4default">
 						    <font  size="7" color="#4BA82E">Vedoucí:                               
                            <?php echo $radek->vedouci;?>                           
                          </font>  

						  </div>
                        </div>                 
                    </div>                                           
                  </div>                                     
                </div>                                     
                <!-- Panel box end -->                                
              </div>                               
              <!-- Content div end-->                          
            </div>                         
            <div class="col-ld-4 col-md-4 col-sm-12 col-xs-12">                               
              <div class="details-sidebar pad-div">                                     
                <!-- Car details sidebar start -->                                      
                <div class="sidebar-widget car-details-sidebar hidden-xs hidden-sm">                                           
                  <div class="section-heading option-bar">                                                 
                    <div class="media">                                                       
                      <div class="media-left">                                                             
                        <i class="lnr lnr-pencil"></i>                                                       
                      </div>                                                       
                      <div class="media-body">                                    <h4>Základní informace</h4>                                                       
                      </div>                                                 
                    </div>                                           
                  </div>                          
<?php if ($_SESSION["uzivatel"]->prava=='admin' || $_SESSION["uzivatel"]->prava=='superadmin') 
                                                                { ?>                                                                                 
                  <ul>                                                 
                    <li>                                                     
                    <span>Název:                   
                    </span>                    
                    <input type="text" name="zmena_nazev" value="<?php echo $radek->nazev;?>">                                                  
                    </li>                                                 
                    <li>                                                     
                    <span>Vedoucí:                    
                    </span>                    
                    <input type="text" name="zmena_vedouci" value="<?php echo $radek->vedouci;?>">                                                  
                    </li>                                                 
                    <li>                                                     
                    <span>Maximální počet osob:                    
                    </span>                    
                    <input type="number" name="zmena_max_osoby" value="<?php echo $radek->max_osoby;?>">                                                  
                    </li>                                                 
                    <li>                                                     
                    <span>Datum do přihlášení:                  
                    </span>                    
                    <input type="date" name="zmena_prihlaseni_datum" value="<?php echo $radek->prihlaseni_datum;?>">                                                  
                    </li>							                     
                    <li>                                                     
                    <span>Datum do odhlášení:                     
                    </span>                    
                    <input type="date" name="zmena_odhlaseni_datum" value="<?php echo $radek->odhlaseni_datum;?>">                                                  
                    </li>                                                 
                    <li>                                                     
                    <span>Místo konání:                 
                    </span>                    
                    <input type="text" name="zmena_misto_konani" value="<?php echo $radek->misto_konani;?>">                                                
                    </li>   
                    <li>                                                     
                    <span>Info               
                    </span>                    
                    <textarea name="zmena_popis"  cols="40%" rows="5%"><?php echo $radek->popis; ?></textarea>                                                
                    </li>                                                
                    
                    <span>   
                    
                      <!-- SMAZAT START -->             
                    <button class="tlacitko_smaz" onclick="myFunction()" form="uprava_auta2">Smazat</button>
                    <?php $smazat='smaz_event.php?id='.$radek->ID; ?>
<script>
function myFunction() {
    if (confirm("Opravdu chceš položku smazat?")) {
       
              window.location="<?php echo $smazat; ?>"
    } else {
        
    }
}
</script>               
                        <!-- SMAZAT STOP -->
                   <input type="submit" class="tlacitko_uloz" value="Uložit" form="uprava_auta">   </span>                  
                    </li>                                           
                  </ul>                                                                                       
<?php }
                            else {
                                                                 ?>                                             
                  <ul>                                                 
                    <li>                                                     
                    <span>Název                 
                    </span>                    
                    <?php echo $radek->nazev;?>                                              
                    </li>                                                 
                    <li>                                                     
                    <span>Vedoucí                    
                    </span>                    
                   <?php echo $radek->vedouci;?>                                                
                    </li>                                                 
                    <li>                                                     
                    <span>Maximální počet osob                    
                    </span>                    
                    <?php echo $radek->max_osoby;?>                                                 
                    </li>                                                 
                    <li>                                                     
                    <span>Datum do přihlášení                
                    </span>                    
                    <?php echo $radek->prihlaseni_datum;?>                                                 
                    </li>							                     
                    <li>                                                     
                    <span>Datum do odhlášení:                  
                    </span>                    
                    <?php echo $radek->odhlaseni_datum;?>                                                 
                    </li>                                                 
                    <li>                                                     
                    <span>Místo konání               
                    </span>   
                                   
                    <?php echo $radek->misto_konani;?>                                                  
                    </li>  
                    
                    <li>                                                     
                    <span>Info               
                    </span>                    
                    <?php echo $radek->popis;?>                                                  
                    </li>                                                  
                                                                 
                                                             
                                         
                  </ul>                          
                </div>                         
                  <?php }  ?>                                                  
    <!-- Car details end -->                       
    </div>                 
    </div>             
    </div>         
    </div>    
    </div>    
    <!-- Car details body end-->    
    <!-- Footer start-->    
    <?php include_once ("styl/spodek.php");?>    
    <!-- Footer end-->                               
<script type="text/javascript" src="js/jquery-2.2.0.min.js"></script>   
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-slider.js"></script>   
<script type="text/javascript" src="js/wow.min.js"></script>   
<script type="text/javascript" src="js/jquery.scrollUp.js"></script>   
<script type="text/javascript" src="js/bootstrap-select.min.js"></script>   
<script type="text/javascript" src="js/bootstrap-submenu.js"></script>       
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->   
<script type="text/javascript" src="js/ie10-viewport-bug-workaround.js"></script>       
    <!-- Custom javascript -->   
<script type="text/javascript" src="js/app.js"></script>   
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB0N5pbJN10Y1oYFRd0MJ_v2g8W2QT74JE"></script>           
    <?php } else { include_once("404.php");}  ?>     
  </body>
</html>