<p><span id='resultno'></span><?php echo localization(" search results", " Résultats"); ?> </p> </div> <hr class="divider"> </div> <div class="filter_padding"> <div class="filters"> <h4><?php echo localization("Services", "Services"); ?> </h4> <div class="filters-wrapper"> <?php foreach (ServiceType::GetTypes() as $key => $val) { echo '<div class="checkMark">' . '<label for="service__' . $key . '" class="filter"></label>' . '<input type="checkbox" class="ui_checkbox" name="service__' . $key . '" value="' . $key . '"> <span class="ui_checkbox_target clr"></span><span>' . $val . '</span>' . '</div>' . '<br />'; } ?> </div> <h4><?php echo localization("Languages", "Langue"); ?> </h4> <div class="filters-wrapper"> <div class="checkMark"> <label for="french" class="filter"></label> <input type="checkbox" class="ui_checkbox" name="french" value="french"> <span class="ui_checkbox_target clr"></span> <span> <?php echo localization("French", "Français");
?> border-bottom:none;text-align:center" > <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <form class="editservice-form" action="editservice.php" method="post" data-available="<?php echo $service['available'] ? 'true' : 'false'; ?> "> <input type="hidden" name="ctid" value="<?php echo $service['ctid']; ?> "> <div class="form-inline"> <label> <select class="form-control" name="type"> <?php foreach (ServiceType::GetTypes() as $k => $v) { $selected = $k == $service['service_type'] ? 'selected' : ''; echo '<option value="' . $k . '" ' . $selected . '>' . $v . '</option>'; } ?> </select> </label> <label> <input placeholder="<?php echo localization("Available from", "Disponible du"); ?> " type="text" name="from" class="datepicker form-control" value="<?php echo $service['from']; ?> " > </label>
$services = array_map("intval", preg_grep_keys("/service__\\d+/", $_POST)); $location_id = intval($_POST['locationid']); $sql = "select p.id, p.name, p.description, p.picture, l.name as cityname, l.countryname, count(*) as services_no, array_to_json(array_agg(s.service_type)) as services_type, array_to_json(array_agg(s.price_per_day)) as services_price_per_day " . "from profile p, offered_service s, porref_nearest l " . "where p.id = s.profile_id " . "and s.available = TRUE " . "and s.price_per_day is not null " . "and l.id = p.location_id " . "and (p.location_id = " . $location_id . " or " . $location_id . " = ANY (l.nearest)) " . "and s.period @> '[" . $arrival_date->format('Y-m-d') . ", " . $departure_date->format('Y-m-d') . "]'::daterange "; if (count($services) > 0) { $sql .= "and s.service_type in (" . implode($services, ', ') . ") "; } $sql .= "group by p.id, p.name, p.description, p.picture, l.name, l.countryname " . "order by count(*) desc"; $q = $db->prepare($sql); $q->execute(); $result = []; while ($row = $q->fetch(PDO::FETCH_ASSOC)) { $new_element = array_merge($row, ['stars' => isset($_SESSION['stars'][$row['id']]) ? $_SESSION['stars'][$row['id']] : ($_SESSION['stars'][$row['id']] = round(rand(1, 5), 1)), 'wished' => isset($_SESSION['favourites'][$row['id']]) && $_SESSION['favourites'][$row['id']], 'arrival' => $arrival_date->format(__DATEFORMAT), 'departure' => $departure_date->format(__DATEFORMAT)]); $types = json_decode($new_element['services_type']); $prices = json_decode($new_element['services_price_per_day']); $inqparams = []; $insql = "select service_type, available, period, price_fix, price_per_day " . "from offered_service " . "where profile_id = :id " . "and price_per_day is not null " . "and period @> '[" . $arrival_date->format('Y-m-d') . ", " . $departure_date->format('Y-m-d') . "]'::daterange "; $inqparams[":id"] = $row['id']; $inq = $db->prepare($insql); $inq->execute($inqparams); while ($inservice = $inq->fetch(PDO::FETCH_ASSOC)) { $new_element['services'][] = ['type' => $inservice['service_type'], 'price_per_day' => $inservice['price_per_day'], 'pic' => ServiceType::GetPics()[$inservice['service_type']], 'name' => ServiceType::GetTypes()[$inservice['service_type']]]; } $new_element['stars'] = 5; $result[] = $new_element; } header('Content-Type: application/json; Charset=UTF-8'); echo json_encode($result); ?> <?php require 'destroy.php.inc';
$qparams[":id"] = $id; $q = $db->prepare($sql); $q->execute($qparams); $servicelist = []; $overall_price = 0; while ($row = $q->fetch(PDO::FETCH_ASSOC)) { $dest_name = $row['name']; $dest_email = $row['email']; $datespair = parse_and_validate_dates($_POST['arrival__' . $row['service_type']], $_POST['departure__' . $row['service_type']]); if (!$datespair) { $error_message[] = "Invalid departure or arrival dates provided"; goto theExit; } $service_tot_price = ($datespair[1]->diff($datespair[0], true)->days + 1) * $row['price_per_day']; $overall_price += $service_tot_price; $servicelist[] = ['type' => $row['service_type'], 'name' => ServiceType::GetTypes()[$row['service_type']], 'price_per_day' => $row['price_per_day'], 'datespair' => $datespair, 'tot_price' => $service_tot_price]; } if (!isset($_POST['first_name']) || !isset($_POST['email_from']) || !isset($_POST['comments'])) { $error_message[] = "Please complete all the mandatory fields."; } $first_name = $_POST['first_name']; // required //$last_name = $_POST['last_name']; // required $email_from = $_POST['email_from']; // required $telephone = $_POST['phone_number']; // not required $comments = $_POST['comments']; // required if (!filter_var($email_from, FILTER_VALIDATE_EMAIL)) { $error_message[] = 'The Email Address you entered does not appear to be valid.';
</div> </div> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 AddedToCart"> <div class="col-lg-2 col-md-2 col-sm-2 hidden-xs"> <div class="items-section"> <div class="item_border"> <img alt="" src="<?php echo ServiceType::GetPics()[$service['service_type']]; ?> " class="img-responsive items-sell"/> </div> </div> </div> <div class="col-lg-5 col-md-5 col-sm-6 col-xs-6"> <h3><?php echo ServiceType::GetTypes()[$service['service_type']]; ?> <?php echo localization("added to cart", "ajouté(s) au panier"); ?> </h3> </div> <div class="col-lg-2 col-md-2 col-sm-4 col-xs-4"> </div> <div class="col-lg-1 col-md-1 col-sm-3 col-xs-3"> <div class="TotalPrice"> <h3 class="service-price total-price"> <span><?php echo round(($departure_date->diff($arrival_date)->days + 1) * $service['price_per_day'], 2); ?>