From 11c151b4394259ee07029fa00488d0552954e20e Mon Sep 17 00:00:00 2001 From: okhin Date: Wed, 11 Jan 2017 16:30:00 +0100 Subject: [PATCH] Let's get group types --- app/Api.php | 6 ++ app/Main.php | 7 ++ templates/contact.html | 149 ++++++++++++++++++++--------------------- 3 files changed, 87 insertions(+), 75 deletions(-) diff --git a/app/Api.php b/app/Api.php index ca67382..26c7e51 100644 --- a/app/Api.php +++ b/app/Api.php @@ -47,6 +47,12 @@ class Api { return json_decode($json, true); } + // //Asking for complete list of group types + static function get_group_types() { + $json = Api::get("campaigns/" . CAMPAIGN_ID . "/grouptypes"); + return json_decode($json, true); + } + // Asking for complete list of feedback categories static function get_feedback_categories() { $json = Api::get("campaigns/" . CAMPAIGN_ID . "/categories"); diff --git a/app/Main.php b/app/Main.php index 17eb770..816a0f6 100644 --- a/app/Main.php +++ b/app/Main.php @@ -16,6 +16,13 @@ class Main extends Controller { //TODO: use weight for random $rand_id = rand(0, count($f3->get('contacts'))-1); $contacts = $f3->get('contacts'); + + $groups = Api::get_groups(); + $f3->set('groups', $groups); + + $group_types = Api::get_group_types(); + $f3->set('group_types', $group_types); + $f3->set('contact', $contacts[$rand_id]); $f3->set('random', rand(0, 2)); $f3->set('block_content', 'home.html'); diff --git a/templates/contact.html b/templates/contact.html index 4d776c2..2f2deef 100644 --- a/templates/contact.html +++ b/templates/contact.html @@ -3,94 +3,93 @@
- - + + - -
-
- -
- -
-

{{ @contact.first_name }}
{{ @contact.last_name }}

- -
-

- {{ _("Phone number") }}: {{ @contact.phone }} -
+ +

+
+ +
+ +
+

{{ @contact.first_name }}
{{ @contact.last_name }}

+ +
+

+ {{ _("Phone number") }}: {{ @contact.phone }} +
- - - -

+ + + +

+
+
- -
- + - -
- -
- + +
+ +
+ - -
-
    - - -
  • {{ @group.name }}
  • -
    -
    -
-
- + +
+
    + + +
  • {{ @group.name }}
  • +
    +
    +
+
+
- - - + + + - + - -
-
- - -
+ +
+
+ + +
+
+
- -
- - +
-- GitLab