Commit 0ce90aa2 authored by Mindiell's avatar Mindiell

Added API calling the REST API v0.1

parent e0b9beb6
<?php
/*
* Static class for REST API communication
*/
class Api {
static function get($url) {
$curl = curl_init();
$url = API_BASE . $url;
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
static function get_campaign() {
// Asking for campaign informations
$json = Api::get("campaign/" . CAMPAIGN_ID);
return json_decode($json, true);
}
};
......@@ -2,9 +2,11 @@
class Main extends Controller {
/*
Main page
* Home page
* Presents campaign information and a random Contact
*/
function show($f3,$args) {
function home($f3,$args) {
$f3->set('campaign', Api::get_campaign());
$f3->set('block_content','home.html');
}
......
<!-- content -->
<h1>{{ _("PiPhone") }}</h1>
<h2>{{ _("Call Contact for free - and make yourself heard") }}</h2>
......@@ -9,11 +8,9 @@
</repeat>
</section>
<h3>{{ _("Piphone demo's Campaign") }}</h3>
<h3>{{ @campaign.title }}</h3>
<section id="abstract">
{{ _("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.") }}
</section>
<section id="abstract">{{ @campaign.description }}</section>
<section id="contact">
<include href="contact.html" />
......
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