From f2e0b5357a6f019780773cb87cc5c633b27c88f2 Mon Sep 17 00:00:00 2001
From: Fibinger Ádám <adam.fibinger@wup.hu>
Date: Thu, 10 Sep 2020 20:46:09 +0200
Subject: [PATCH] Alapértelmezetten ne legyen csapat kiválasztva

---
 form.php |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/form.php b/form.php
index 5340e72..9d990f5 100644
--- a/form.php
+++ b/form.php
@@ -7,24 +7,33 @@
     $s->loadFromArray($_POST['stripe']);
 
     if (!empty($s->getState())) {
-        file_put_contents($last_json, $s->getJson());
+        file_put_contents(STRIPE_JSON, $s->getJson());
     }
 
     $s->setClass('simple');
-    $html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]);
+    $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
     file_put_contents(OVERLAY_DIR . 'simple.html', $html_content);
 
     $s->setClass('team');
-    $html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]);
+    $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
     file_put_contents(OVERLAY_DIR . 'team.html', $html_content);
 
     $s->setClass('team-ban');
-    $html_content = $twig->render('templates/overlay-base.twig', ['stripe' => $s]);
+    $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
     file_put_contents(OVERLAY_DIR . 'team-ban.html', $html_content);
 
+	$s->setClass('team-ban');
+	$html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s, 'autorefresh' => 30]);
+	file_put_contents(OVERLAY_DIR . 'team-ban-refresh.html', $html_content);
+
+	$redis = new Redis();
+	$redis->pconnect('127.0.0.1');
+	$redis->publish('overlay', 'update');
+	$redis->close();
+
 } else {
-    if (file_exists($last_json)) {
-        $raw_json = file_get_contents($last_json);
+    if (file_exists(STRIPE_JSON)) {
+        $raw_json = file_get_contents(STRIPE_JSON);
         $stateArray = json_decode($raw_json, true);
         if (is_array($stateArray)) {
             $s->loadFromArray($stateArray);
@@ -34,16 +43,19 @@
 
 $teams = new \EOG\Models\TeamList();
 
-if (file_exists(OVERLAY_DIR . 'teams.json')) {
-    var_dump($teams->fromJson(file_get_contents(OVERLAY_DIR . 'teams.json')));
+if (file_exists(TEAMS_JSON)) {
+    $teams->fromJson(file_get_contents(TEAMS_JSON));
 }
+$page = isset($_GET['page']) ? $_GET['page'] : 'overlay';
+$page = in_array($page,['overlay','interview','update']) ? $page : 'overlay';
 
 $var = [
+    'page' => $page,
     'stripe' => $s,
     'teamNames' => $teams->getTeamNames(),
     'operators' => $s->getOperators(),
     'post' => !empty($_POST['stripe'])
 ];
 
-echo $twig->render('templates/admin/stripe-form.twig', $var);
+echo $twig->render('admin/modules/'.$page .'.twig', $var);
 

--
Gitblit v1.8.0