Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
piphone-front
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
piphone-front
Commits
3e525c53
Commit
3e525c53
authored
Nov 22, 2014
by
nepski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
call contact and contact list view
parent
f6265328
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
6 deletions
+45
-6
app/Main.php
app/Main.php
+6
-4
app/RestApi.php
app/RestApi.php
+26
-0
app/routes.ini
app/routes.ini
+3
-1
templates/call.html
templates/call.html
+1
-1
templates/contactslist.html
templates/contactslist.html
+9
-0
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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