Ejemplo n.º 1
0
         echo json_encode($objtrayecto->updateDB());
         break;
     case 'del':
         $objtrayecto->setVar('id', $_POST['id']);
         echo json_encode($objtrayecto->deleteDB());
         break;
     case 'get':
         $res = $objtrayecto->searchDB($_POST['id'], 'id', 1);
         if (is_array($res)) {
             echo json_encode($res[0]);
         } else {
             echo json_encode(0);
         }
         break;
     case 'list':
         $res = $objtrayecto->listDB();
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
     case 'search':
         $res = $objtrayecto->searchDB($_POST['data'], $_POST['value'], $_POST['type']);
         if (is_array($res)) {
             echo json_encode($res);
         } else {
             echo json_encode(0);
         }
         break;
 }
Ejemplo n.º 2
0
            }
        }
        echo '>' . $tu["nombre"] . '</option>';
    }
}
?>
    </select>
</div>

<div class='control-group'>
    <label>Trayecto</label>
    <select class='form-control' id='trayecto' name='trayecto'>
        <?php 
require_once 'nucleo/trayecto.php';
$objtrayecto = new trayecto();
$ltr = $objtrayecto->listDB();
if (is_array($ltr)) {
    foreach ($ltr as $tr) {
        echo '<option value="' . $tr["id"] . '"';
        if (isset($_GET["tr"])) {
            if ($_GET["tr"] === $tr["id"]) {
                echo " selected";
            }
        }
        echo '>' . $tr["nombre"] . '</option>';
    }
}
?>
    </select>
</div>
Ejemplo n.º 3
0
</div>
<div class='control-group'>
    <label>Distancia Km</label>
    <input class='form-control' placeholder='0.00' id='distancia_km' name='distancia_km' type="number"/>
</div>
<div class='control-group'>
    <p></p>
    <button type='button' class='btn btn-primary' onclick='save()'>Guardar</button>
    <button type='reset' class='btn'>Limpiar</button>
</div>
</form>
<hr/>
<?php 
include_once 'nucleo/trayecto.php';
$obj = new trayecto();
$objs = $obj->listDB();
?>
<div class='contenedor-tabla'>
    <table id='tb' class='display' cellspacing='0' width='100%'>
        <thead>
            <tr>
                <th>Id</th><th>Nombre</th><th>Ubicacion</th><th>Distancia Km</th>
                <th>OPC</th>
            </tr>
        </thead>
        <tbody>
            <?php 
if (is_array($objs)) {
    foreach ($objs as $o) {
        ?>
                    <tr><td><?php