コード例 #1
0
function displayForm($errorMessages, $missingFields, $pedidos)
{
    if ($errorMessages) {
        foreach ($errorMessages as $errorMessage) {
            echo $errorMessage;
        }
    }
    ?>
                    <form role="form" action="pedidosplatos.php" method="post">
                            <input type="hidden" name="action" value="register" />
				<div class="form-group">
					 <label for="fecha"<?php 
    validateField("fecha", $missingFields);
    ?>
></label>
                                         
                                        <div class="input-group date form_date col-md-5" data-date="" data-date-format="dd/mm/yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                                            <input class="form-control" size="16" type="text" value="" name="fecha" readonly>
                                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                                        </div>
				</div>
                            
                            <script type="text/javascript" src="./jquery/jquery-1.8.3.min.js" charset="UTF-8"></script>
                            <script type="text/javascript" src="js/bootstrap.min.js"></script>
                            <script type="text/javascript" src="bootstrap-datetimepicker.js" charset="UTF-8"></script>
                            <script type="text/javascript" src="locales/bootstrap-datetimepicker.es.js" charset="UTF-8"></script>
                            <?php 
    $dates = "";
    list($fechas) = Pedidos::getFecha();
    foreach ($fechas as $fecha) {
        $dates .= "'" . $fecha->getValueEncoded("fecha") . "',";
    }
    $dates = substr($dates, 0, -1);
    ?>
                            
                            <script type="text/javascript">
                                var array = [<?php 
    echo $dates;
    ?>
];
                                $('.form_date').datetimepicker({
                                language:  'es',
                                startDate: "+1d",
                                        autoclose: 1,
                                        todayHighlight: 1,
                                        startView: 2,
                                        minView: 2,
                                        forceParse: 0,
                                        beforeShowDay: function(date){
                                            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
                                            return [ array.indexOf(string) == -1 ]
                                        }
                                });
                               
                        </script>  
                        <br>
				<div class="form-group">
                                        <label for="hora">Hora: </label>
                                            <select name="hora">
                                                <?php 
    for ($i = 0; $i <= 23; $i++) {
        if ($i < 10) {
            echo "<option value='0" . $i . "'>0" . $i . "</option>";
        } else {
            echo "<option value=" . $i . ">" . $i . "</option>";
        }
    }
    ?>
                                            </select>

                                        <label for="minuto"></label>
                                            <select name="minuto">
                                                <?php 
    for ($i = 0; $i <= 59; $i++) {
        if ($i < 10) {
            echo "<option value='0" . $i . "'>0" . $i . "</option>";
        } else {
            echo "<option value=" . $i . ">" . $i . "</option>";
        }
    }
    ?>
                                            </select>				
                                </div>
                            <div class="form-group">
                                <label for="localidad">Localidad: <select name="localidad"></label>
                                <?php 
    list($localidades) = Localidad::getLocalidad();
    foreach ($localidades as $localidad) {
        echo "<option value='" . $localidad->getValueEncoded("cp") . "'>" . $localidad->getValueEncoded("nombre") . "</option>";
    }
    ?>
                                </select>
                            </div>
                            <div class="form-group">
					 <label for="direccion" <?php 
    validateField("direccion", $missingFields);
    ?>
>Dirección: </label>
                                         <input class="form-control" type="text" name="direccion" /> 
                            </div>
                            <div class="form-group">
                                <label for="comensales">Comensales:</label>
                                <select name="comensales">
                                    <?php 
    for ($i = 1; $i <= 12; $i++) {
        echo "<option value=" . $i . ">" . $i . "</option>";
    }
    ?>
                                </select>
                            </div>
				<button type="submit" class="btn btn-default">Submit</button>
			</form>
		</div>
	</div>
    
     <?php 
    displayPageFooter();
}