Commit 3e525c53 authored by nepski's avatar nepski

call contact and contact list view

parent f6265328
......@@ -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');
}
};
......@@ -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) {
......
......@@ -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
<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>
......
<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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment