equal
deleted
inserted
replaced
|
1 <?php |
|
2 |
|
3 require_once("utilsFunctions.php"); |
|
4 require_once("dbFunctions.php"); |
|
5 |
|
6 function getRenkan($renkanId) { |
|
7 |
|
8 $resRenkan = selectProject($renkanId); |
|
9 |
|
10 header('Content-Type: application/json'); |
|
11 echo($resRenkan[0]['renkan']); |
|
12 die(); |
|
13 |
|
14 } |
|
15 |
|
16 function saveRenkan($renkanId, $renkanStr) { |
|
17 |
|
18 $renkanJson = json_decode($renkanStr, true); |
|
19 $title = $renkanJson["title"]; |
|
20 |
|
21 $res = updateProject($renkanId, $title, $renkanStr); |
|
22 |
|
23 |
|
24 //TODO: return error when fail. |
|
25 http_response_code(200); |
|
26 echo("RES:"); |
|
27 print_r($res); |
|
28 die(); |
|
29 |
|
30 } |
|
31 |
|
32 function emptyRenkan($title, $description, $renkanId = NULL) { |
|
33 if(is_null($renkanId) || trim($renkanId) === '' ) { |
|
34 $renkanId = genUuid4(); |
|
35 } |
|
36 |
|
37 $now = new DateTime('NOW'); |
|
38 |
|
39 $renkan_array = [ |
|
40 'id' => $renkanId, |
|
41 'title' => $title, |
|
42 'description' => $description, |
|
43 'uri' => NULL, |
|
44 'color' => NULL, |
|
45 'created' => $now->format("c"), |
|
46 'updated' => $now->format("c"), |
|
47 'nodes' => [], |
|
48 'edges' => [], |
|
49 'users' => [], |
|
50 'views' => [] |
|
51 ]; |
|
52 |
|
53 return json_encode($renkan_array); |
|
54 |
|
55 } |