<?php
//simpilotgroup addon module for phpVMS virtual airline system
//
//simpilotgroup addon modules are licenced under the following license:
//Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
//To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
//
//@author David Clark (simpilot)
//@copyright Copyright (c) 2009-2010, David Clark
//@license http://creativecommons.org/licenses/by-nc-sa/3.0/

$this->show('events/events_header.tpl');

if(isset($event))
{echo '<div id="error">All fields must be filled out</div>'; }
?>

<h4>Create New Event<br>
<small><i class="text-muted">By Default, Events will be posted on the Time Line</i></small></h4>

        <form name="eventform" action="<?php echo SITE_URL; ?>/admin/index.php/events_admin" method="post" enctype="multipart/form-data">
        	
        	<div class="row">
              
            
            
              <div class="col-md-12">
                <label for="firstName">Event Name</label>
               
               <input  class="form-control" type="text" name="title"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['title'].'"';}
                           ?>
                           >
                           
              </div>
              
              
            <div class="col-md-12">
                <label for="firstName">Event Description (about 50 words) </label>
               
             <textarea id="textarea-ckeditor" class="ckeditor" style="visibility: hidden; display: none;" name="description" rows="4" cols="40"><?php
                                if(isset($event))
                                {echo $event['description'];}
                           ?></textarea>
                           
              </div>
              
              
            
              <div class="col-md-12">
                <label for="firstName">
                	Event Banner
                </label>
               <input type="file" class="form-control" name="banner" >
              </div>
              
              <div class="col-md-6 mb-3">
                <label>
                	Event Date
                </label><br>
            	  <?php
                    $months = range(1, 12);
                    $days = range (1, 31);
                    $years = range (date('Y'), 2018);
                        echo "Month: <select   class='form-control' name='month'>";
                            foreach ($months as $value)
                                {echo '<option value="'.$value.'">'.$value.'</option>\n';}
                        echo '</select>';
                        echo "   Day: <select  class='form-control' name='day'>";
                            foreach ($days as $value)
                                {echo '<option value="'.$value.'">'.$value.'</option>\n';}
                        echo '</select>';
                        echo "   Year: <select  class='form-control'name='year'>";
                            foreach ($years as $value)
                                {echo '<option value="'.$value.'">'.$value.'</option>\n';}
                        echo '</select>';
                    ?>
              </div>
              
              <div class="col-md-12">
                <label>
                	Event Start Time
                </label>
                <br>
            	  <?php
                        $start = strtotime('0:00');
                        $end = strtotime('23:30');

                        echo '<select  class="form-control" name="time">';
                        for ($i = $start; $i <= $end; $i += 1800)
                            {
                                echo '<option>' . date('H:i', $i).'</option>';
                            }
                        echo '</select>';
                    ?>
                     GMT
              </div>
              
               <div class="col-md-6 mb-3">
                <label>
                	Departure Airfield (ICAO)
                </label>
            	  <input  class="form-control" type="text" name="dep"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['dep'].'"';}
                           ?>
                           >
              </div>
                
                
               <div class="col-md-6 mb-3">
                <label>
                	Arrival Airfield (ICAO)
                </label>
				<input  class="form-control" type="text" name="arr"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['arr'].'"';}
                           ?>
                           >
              </div>
                
                  
               <div class="col-md-12">
                <label>
                	Airline Schedule #ID (For open the desired schedule in iCrew, and copy the ID from the URL and enter here)
                </label>
			<input  class="form-control" type="text" name="schedule"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['schedule'].'"';}
                           ?>
                           >
              </div>
              
              <div class="col-md-6 mb-3">
                <label>
                	Number of Slots for the Event
                </label>
		<input  class="form-control" type="text" name="limit"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['limit'].'"';}
                                else
                                {echo 'value="1"';}
                           ?>>
              </div>
              
              <div class="col-md-6 mb-3">
                <label>
                	Slot Interval between each departure in Minutes (Minimum 5)
                </label>
					<input class="form-control" type="text" name="interval"
                           <?php
                                if(isset($event))
                                {echo 'value="'.$event['interval'].'"';}
                                else
                                {echo 'value="1"';}
                           ?>
                           >
              </div>
              
              <div class="col-md-6 mb-3">
                <label>
                	Post Event as News Item?
                </label>
				<select  class="form-control"name="postnews">
                        <option value="1">Yes</option>
                        <option value="2">No</option>
                    </select>
              </div>
              
            
            <div class="col-md-6 mb-3">
                <label>
                	Active Event?<br />Inactive events will not show in public/pilot listings.
                </label>
			 <select class="form-control" name="active">
                        <option value="1">Yes</option>
                        <option value="2">No</option>
                    </select>
              </div>
              <input type="hidden" name="action" value="save_new_event" /><input type="submit" value="Save New Event">
            
            </div>
        </form>
    

