| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/web18/web/src/PaCIM/ |
Upload File : |
<?php
require_once("includes/config.inc.php");
$MAX_PARKING_INDOOR = 5;
//echo API_CONNECTION;
//die();
/**
* @var \Fusio\Engine\ConnectorInterface $connector
* @var \Fusio\Engine\ContextInterface $context
* @var \Fusio\Engine\RequestInterface $request
* @var \Fusio\Engine\Response\FactoryInterface $response
* @var \Fusio\Engine\ProcessorInterface $processor
* @var \Psr\Log\LoggerInterface $logger
* @var \Psr\SimpleCache\CacheInterface $cache
*/
use PSX\Http\Exception as StatusCode;
/** @var \Doctrine\DBAL\Connection $connection */
$connection = $connector->getConnection( API_CONNECTION );
## Kreuzfahrtschiff und die dazugehörigen Anlauftage
if(isset($_GET['id'])) {
$count = $connection->fetchColumn('
SELECT
COUNT(*)
FROM pacim_events_info ei
LEFT JOIN pacim_events e ON e.event_calendar_info_id = ei.event_id
WHERE DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d")
AND ei.event_id = ' . $_GET['id'] . '
ORDER by ei.event_title ASC
');
$arr_events = array();
if($count > 0) {
$arr_ships = $connection->fetchAll('
SELECT
ei.event_id AS id,
ei.event_title AS title
FROM pacim_events e
LEFT JOIN pacim_events_info ei ON ei.event_id = e.event_calendar_info_id
WHERE DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d")
AND ei.event_id = ' . $_GET['id'] . '
GROUP by ei.event_id
ORDER by ei.event_title ASC
');
foreach($arr_ships as $key => $ship) {
$arr_events[] = array(
'id' => $ship['id'],
'title' => $ship['title'],
'events' => $connection->fetchAll('
SELECT
e.event_calendar_id AS id,
DATE_FORMAT(e.event_calendar_begin, "%d.%m.") AS event_begin,
DATE_FORMAT(e.event_calendar_begin, "%d.%m.%Y") AS event_from,
DATE_FORMAT(e.event_calendar_end, "%d.%m.%Y") AS event_to,
DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") AS start,
DATE_FORMAT(e.event_calendar_end, "%Y-%m-%d") AS end,
DATE_FORMAT(e.event_calendar_begin, "%d") AS event_day,
DATE_FORMAT(e.event_calendar_begin, "%m") AS event_month,
DATE_FORMAT(e.event_calendar_begin, "%Y") AS event_year,
IF(
(SELECT
COUNT(bs.booking_id) AS valet
FROM pacim_booking bs
LEFT JOIN pacim_invoice isu ON isu.invoice_id = bs.booking_invoice
LEFT JOIN pacim_invoice_pos ipsu ON ipsu.invoice_id = isu.invoice_id
WHERE DATE_FORMAT(bs.booking_begin, "%Y-%m-%d") = DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d")
AND isu.invoice_status != 3
AND isu.invoice_no NOT LIKE "AIDA-%"
AND ipsu.product_id = 8
AND DATE_FORMAT(bs.booking_end, "%Y-%m-%d") = DATE_FORMAT(e.event_calendar_end, "%Y-%m-%d")
) >= e.event_calendar_valet,
0,
1
) AS event_valet,
(SELECT e.event_calendar_indoor-COUNT(b.booking_id) FROM pacim_booking b LEFT JOIN pacim_invoice i ON i.invoice_id = b.booking_id WHERE b.booking_type LIKE "Halle%" AND b.booking_event_id = e.event_calendar_id AND i.invoice_no NOT LIKE "AIDA-%" AND i.invoice_status != 3) AS event_indoor,
(SELECT e.event_calendar_outdoor-COUNT(b.booking_id) FROM pacim_booking b LEFT JOIN pacim_invoice i ON i.invoice_id = b.booking_id WHERE b.booking_type LIKE "Außen%" AND b.booking_event_id = e.event_calendar_id AND i.invoice_no NOT LIKE "AIDA-%" AND i.invoice_status != 3) AS event_outdoor
FROM pacim_events_info ei
LEFT JOIN pacim_events e ON e.event_calendar_info_id = ei.event_id
WHERE
e.event_calendar_info_id = ' . $ship['id'] . ' AND
DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d") AND
e.event_calendar_active = 1
ORDER by e.event_calendar_begin ASC, e.event_calendar_end ASC
')
);
}
}
return $response->build(200, [], array(
'status' => 'success',
'count' => $count,
'connection' => API_CONNECTION,
'ship' => $arr_events[0]
));
}
## Alle zukünftigen Anlauftage, angeführt von den Kreuzfahrtschiffen
else {
$count = $connection->fetchColumn('
SELECT
COUNT(*)
FROM pacim_events_info ei
LEFT JOIN pacim_events e ON e.event_calendar_info_id = ei.event_id
WHERE DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d") AND
e.event_calendar_active = 1
ORDER by ei.event_title ASC
');
$arr_events = array();
if($count > 0) {
$arr_ships = $connection->fetchAll('
SELECT
ei.event_id AS id,
ei.event_title AS title
FROM pacim_events e
LEFT JOIN pacim_events_info ei ON ei.event_id = e.event_calendar_info_id
WHERE DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d") AND
e.event_calendar_active = 1
GROUP by ei.event_id
ORDER by ei.event_title ASC
');
foreach($arr_ships as $key => $ship) {
$arr_events[ $ship['id'] ] = array(
'id' => $ship['id'],
'title' => $ship['title'],
'events' => $connection->fetchAll('
SELECT
e.event_calendar_id AS id,
DATE_FORMAT(e.event_calendar_begin, "%d.%m.") AS event_begin,
DATE_FORMAT(e.event_calendar_begin, "%d.%m.%Y") AS event_from,
DATE_FORMAT(e.event_calendar_end, "%d.%m.%Y") AS event_to,
DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") AS start,
DATE_FORMAT(e.event_calendar_end, "%Y-%m-%d") AS end,
DATE_FORMAT(e.event_calendar_begin, "%d") AS event_day,
DATE_FORMAT(e.event_calendar_begin, "%m") AS event_month,
DATE_FORMAT(e.event_calendar_begin, "%Y") AS event_year,
IF(TIMESTAMPDIFF(HOUR, NOW(), DATE_SUB(e.event_calendar_begin, INTERVAL 1 DAY)) >= 2, 1, 0) AS event_valet,
"1" AS event_indoor,
"1" AS event_outdoor
/*IF(
(SELECT
COUNT(bs.booking_id) AS valet
FROM pacim_booking bs
LEFT JOIN pacim_invoice isu ON isu.invoice_id = bs.booking_invoice
LEFT JOIN pacim_invoice_pos ipsu ON ipsu.invoice_id = isu.invoice_id
LEFT JOIN pacim_customer ipc ON ipc.customer_id = bs.booking_customer
WHERE DATE_FORMAT(bs.booking_begin, "%Y-%m-%d") = DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d")
AND isu.invoice_status != 3
AND ipc.customer_source != "AIDA"
AND ipsu.product_id = 8
AND bs.booking_event_id = e.event_calendar_id
) >= e.event_calendar_valet,
0,
1
) AS event_valet,
IF(
(
SELECT e.event_calendar_indoor-COUNT(b.booking_id)
FROM pacim_booking b
LEFT JOIN pacim_invoice i ON i.invoice_id = b.booking_id
LEFT JOIN pacim_customer c ON c.customer_id = b.booking_customer
WHERE b.booking_type = 1
AND b.booking_event_id = e.event_calendar_id
AND c.customer_source != "AIDA"
AND i.invoice_status != 3
) < 1,
0,
1
) AS event_indoor,
IF((SELECT e.event_calendar_outdoor-COUNT(b.booking_id) FROM pacim_booking b LEFT JOIN pacim_invoice i ON i.invoice_id = b.booking_id LEFT JOIN pacim_customer c ON c.customer_id = b.booking_customer WHERE b.booking_type = 2 AND b.booking_event_id = e.event_calendar_id AND c.customer_source != "AIDA" AND i.invoice_status != 3) < 1, 0, 1) AS event_outdoor*/
FROM pacim_events e
WHERE
e.event_calendar_info_id = ' . $ship['id'] . ' AND
DATE_FORMAT(e.event_calendar_begin, "%Y-%m-%d") >= DATE_FORMAT(CURDATE(), "%Y-%m-%d") AND
e.event_calendar_active = 1
ORDER by e.event_calendar_begin ASC, e.event_calendar_end ASC
')
);
}
}
return $response->build(200, [], array(
'status' => 'success',
'count' => $count,
'connection' => API_CONNECTION,
'entries' => $arr_events
));
}