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
nico
piphone-front
Commits
3e525c53
Commit
3e525c53
authored
Nov 22, 2014
by
nepski
Browse files
call contact and contact list view
parent
f6265328
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/Main.php
View file @
3e525c53
...
...
@@ -59,20 +59,22 @@ class Main extends Controller {
function
call
(
$f3
,
$args
)
{
//GET
if
(
$f3
->
get
(
'VERB'
)
==
'GET'
)
{
//$contact_id = $f3->get('POST.contact_id');
$f3
->
set
(
'contact'
,
Api
::
get_contact
());
//by $contact_id
$f3
->
set
(
'contact'
,
Api
::
get_contact
());
//$args['id']
$f3
->
set
(
'block_content'
,
'call.html'
);
}
//POST
elseif
(
$f3
->
get
(
'VERB'
)
==
'POST'
){
$web
=
new
Web
;
//GET feedbackform
$f3
->
set
(
'VERB'
,
'GET'
);
$this
->
feedbackform
(
$f3
,
$args
);
}
}
function
contactslist
(
$f3
,
$args
)
{
$f3
->
set
(
'contacts'
,
Api
::
get_contacts
()[
'contacts'
]);
$f3
->
set
(
'block_content'
,
'contactslist.html'
);
}
};
app/RestApi.php
View file @
3e525c53
...
...
@@ -14,6 +14,32 @@ class RestApi {
function
contacts
(
$f3
,
$args
)
{
// List of contacts
echo
'{"contacts":[{
"id": "4123",
"last_name": "ANDERSDOTTER",
"first_name": "Amelia",
"tel": "+322 28 45922",
"groups": [{"type": "Political group","name": "Greens/EFA","media": ""},{"type": "National party","name": "Piratpartiet","media": ""},
{"type": "Country","name": "SE","media": ""},{"type": "Committee","name": "ITRE","media": ""},{"type": "Committee","name": "INTA","media": ""},
{"type": "Committee","name": "CONT","media": ""}
]},{
"id": "4123",
"last_name": "ANDERSDOTTER",
"first_name": "Amelia",
"tel": "+322 28 45922",
"groups": [{"type": "Political group","name": "Greens/EFA","media": ""},{"type": "National party","name": "Piratpartiet","media": ""},
{"type": "Country","name": "SE","media": ""},{"type": "Committee","name": "ITRE","media": ""},{"type": "Committee","name": "INTA","media": ""},
{"type": "Committee","name": "CONT","media": ""}
]},{
"id": "4123",
"last_name": "ANDERSDOTTER",
"first_name": "Amelia",
"tel": "+322 28 45922",
"groups": [{"type": "Political group","name": "Greens/EFA","media": ""},{"type": "National party","name": "Piratpartiet","media": ""},
{"type": "Country","name": "SE","media": ""},{"type": "Committee","name": "ITRE","media": ""},{"type": "Committee","name": "INTA","media": ""},
{"type": "Committee","name": "CONT","media": ""}
]}
]}'
;
}
function
contact
(
$f3
,
$args
)
{
...
...
app/routes.ini
View file @
3e525c53
...
...
@@ -13,6 +13,8 @@ POST /restapi/campaign/@id/feedback/add=RestApi->feedback_add
GET
/restapi/campaign/@id/arguments/@
lang
=
RestApi->arguments
GET|POST
@feedback:/
feedback
=
Main->feedbackform
GET|POST
@call:/
call
=
Main->call
GET|POST
@call:/call/@
id
=
Main->call
GET
@contactslist:/
contactslist
=
Main->contactslist
POST
@feedbacksip:/
feedbacksip
=
Main->feedbacksip
\ No newline at end of file
templates/call.html
View file @
3e525c53
<h2>
{{ _("Call for free") }}
</h2>
<form
method=
"post"
action=
"/call/"
>
<form
method=
"post"
action=
"/call/
{{ @contact.id }}
"
>
<input
type=
"text"
id=
"contact_id"
name=
"contact_id"
hidden=
"hidden"
value=
"{{ @contact.id }}"
>
<p>
{{ _("If you want to call for free, you must provide us with your phone number (the PiPhone will call that number to initiate the communication).") }}
</p>
...
...
templates/contactslist.html
0 → 100644
View file @
3e525c53
<repeat
group=
"{{ @contacts }}"
value=
"{{ @contact }}"
>
<p>
<include
href=
"contact.html"
/>
</p>
<form
method=
"post"
action=
"/call/{{ @contact.id }}"
>
<input
type=
"submit"
value=
"{{ _("
Call
")
}}"
/>
</form>
</repeat>
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