blob: 1aca5d92d2ddff3401f33179a02dea256e97582e (
plain)
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
|
<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\WorkflowEngine\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\JSONResponse;
class RequestTimeController extends Controller {
/**
* @param string $search
* @return JSONResponse
*/
#[NoAdminRequired]
public function getTimezones($search = '') {
$timezones = \DateTimeZone::listIdentifiers();
if ($search !== '') {
$timezones = array_filter($timezones, function ($timezone) use ($search) {
return stripos($timezone, $search) !== false;
});
}
$timezones = array_slice($timezones, 0, 10);
$response = [];
foreach ($timezones as $timezone) {
$response[$timezone] = $timezone;
}
return new JSONResponse($response);
}
}
|