Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
piphone-front
Commits
863b5c0c
Commit
863b5c0c
authored
Nov 22, 2014
by
Mindiell
Browse files
Fake REST API in order to be able to work
parent
ed7760e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/RestApi.php
0 → 100644
View file @
863b5c0c
<?php
// Fake REST API from Campaign module
class
RestApi
{
function
campaign
(
$f3
,
$args
)
{
echo
'{
"title": "Piphone Demo\'s campaign",
"description": "This is a demo campaign used to illustrate how the piphone works. This campaign does not grants you the possibility to contact anyone, it\'s just an ilustration of how it works.",
"start_date": "2014-01-01",
"end_date": "2014-12-31",
"default_language": "en"
}'
;
}
function
contacts
(
$f3
,
$args
)
{
// List of contacts
}
function
contact
(
$f3
,
$args
)
{
if
(
$f3
->
exists
(
'PARAMS.contact'
))
{
// Specified contact
}
else
{
// Random contact
}
}
function
groups
(
$f3
,
$args
)
{
// List of groups available
}
function
categories
(
$f3
,
$args
)
{
// List of feedback categories
}
function
feedback_add
(
$f3
,
$args
)
{
// List of contacts
}
function
arguments
(
$f3
,
$args
)
{
// List of arguments
}
};
app/routes.ini
View file @
863b5c0c
[routes]
; Main site
GET
@home:/=Main->show
GET
@home:/=Main->home
; Fake REST API
GET
/restapi/campaign/@
id
=
RestApi->campaign
GET
/restapi/campaign/@id/
contacts
=
RestApi->contacts
GET
/restapi/campaign/@id/
contact
=
RestApi->contact
GET
/restapi/campaign/@id/contact/@
contact
=
RestApi->contact
GET
/restapi/campaign/@id/
groups
=
RestApi->groups
GET
/restapi/campaign/@id/feedback/
categories
=
RestApi->categories
POST
/restapi/campaign/@id/feedback/
add
=
RestApi->feedback_add
GET
/restapi/campaign/@id/arguments/@
lang
=
RestApi->arguments
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment