forked from travelopenapps/agenciatoa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disponibilidad.php
50 lines (40 loc) · 1.44 KB
/
disponibilidad.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require 'vendor/autoload.php';
include("./lib/toaclient.php");
$toaclient = new TOAClient();
$ideses = $toaclient->sesionAbrir();
$fecini = date_create($toaclient->check_plain($_POST['fecini']))->format('d/m/Y');
$fecfin = date_create($toaclient->check_plain($_POST['fecfin']))->format('d/m/Y');
$disponibilidad = $toaclient->disponibilidadHotel($ideses,
$fecini,
$fecfin, // Fechas
$toaclient->check_plain($_POST['codzge']), // Destino
$toaclient->check_plain($_POST['numuni']),
$toaclient->check_plain($_POST['numadl']),
$toaclient->check_plain($_POST['numnin']) // Pasajeros
);
$hoteles = array();
$habitaciones = array();
$fechas = array (
"fecini" => $fecini,
"fecfin" => $fecfin
);
foreach ($disponibilidad->infhot as $elem) {
$info = $toaclient->informacionServicio($disponibilidad->ideses, $elem->codser);
$hotel = array();
$hotel["disp"] = $elem;
$hotel["info"] = $info;
$hotel["img"] = $info->xpath("/InformacionServicioRespuesta/servic/desser[@id='2']/descdo/urlimg")[0];
$hotel["habs"] = $elem->infhab;
array_push($hoteles, $hotel);
}
$template_loader = new Twig_Loader_Filesystem('public');
$twig = new Twig_Environment($template_loader);
$html = $twig->render('disponibilidad.html', array(
"hoteles" => $hoteles,
"fechas" => array ("fecini" => $fecini, "fecfin" => $fecfin),
"sesion" => urlencode($ideses)
));
echo $html;
exit;
?>