RestApi.php 882 Bytes
Newer Older
1
<?php
2
3
4
5
6
/*
 * Fake REST API from Campaign module
 *
 * Uses datas folder to retrieve informations
 */
7
8

class RestApi {
9
10
11
12
13
14
15
    function return_datas($filename) {
        $f = fopen($filename, 'r');
        $result = fread($f, filesize($filename));
        fclose($f);
        return $result;
    }

16
    function campaign($f3,$args) {
17
        echo $this->return_datas('app/datas/campaign.json');
18
19
20
    }

    function contacts($f3,$args) {
21
        echo $this->return_datas('app/datas/contacts.json');
22
23
24
25
    }

    function categories($f3,$args) {
        // List of feedback categories
nepski's avatar
nepski committed
26
27
28
29
30
31
        echo'{"categories": [
                "category1",
                "category2",
                "category3"
                ]
            }';
32
33
34
35
36
37
38
39
40
41
42
43
    }

    function feedback_add($f3,$args) {
        // List of contacts
    }

    function arguments($f3,$args) {
        // List of arguments
    }

};