-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathglobal-api.php
44 lines (22 loc) · 899 Bytes
/
global-api.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
<?php
header('Content-Type: application/json');
require_once 'functions.php';
$api = [];
foreach ($cronograma as $atividade) {
$atividade['time'] = strtotime($atividade['date']."-02-2015 ".$atividade['time'].":00");
$atividade['end-time'] = strtotime($atividade['date']."-02-2015 ".$atividade['end-time'].":00");
unset($atividade['date']);
if (gettype($atividade['authors']) == "array"){
$tmpauth = [];
foreach ($atividade['authors'] as $author) {
array_push($tmpauth, ["id" => $author, "name" => $authors[$author]['name']]);
}
} else {
$tmpauth = [["id" => $atividade['authors'], "name" => $authors[$atividade['authors']]['name']]];
}
$atividade['authors'] = $tmpauth;
$atividade['type'] = ["id" => $atividade['type'], "name" => $types[$atividade['type']]];
array_push($api, $atividade);
echo json_encode($api);
}
?>