2016-08-01 11:05:40 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-08-01 11:05:40 -04:00
|
|
|
/**
|
2024-05-30 14:13:41 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-08-01 11:05:40 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\WorkflowEngine\Controller;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Controller;
|
2024-07-25 07:14:51 -04:00
|
|
|
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
2016-08-01 11:05:40 -04:00
|
|
|
use OCP\AppFramework\Http\JSONResponse;
|
|
|
|
|
|
2023-06-19 01:48:44 -04:00
|
|
|
class RequestTimeController extends Controller {
|
2016-08-01 11:05:40 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $search
|
|
|
|
|
* @return JSONResponse
|
|
|
|
|
*/
|
2024-07-25 07:14:51 -04:00
|
|
|
#[NoAdminRequired]
|
2016-08-01 11:05:40 -04:00
|
|
|
public function getTimezones($search = '') {
|
|
|
|
|
$timezones = \DateTimeZone::listIdentifiers();
|
|
|
|
|
|
|
|
|
|
if ($search !== '') {
|
|
|
|
|
$timezones = array_filter($timezones, function ($timezone) use ($search) {
|
2018-01-25 16:59:50 -05:00
|
|
|
return stripos($timezone, $search) !== false;
|
2016-08-01 11:05:40 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$timezones = array_slice($timezones, 0, 10);
|
|
|
|
|
|
|
|
|
|
$response = [];
|
|
|
|
|
foreach ($timezones as $timezone) {
|
|
|
|
|
$response[$timezone] = $timezone;
|
|
|
|
|
}
|
|
|
|
|
return new JSONResponse($response);
|
|
|
|
|
}
|
|
|
|
|
}
|