Fibinger Ádám
2020-02-26 3ac2acb75dbc5b9d8674cd733f96e95f15826961
commit | author | age
812087 1 <?php
b40e93 2 include_once "common/base.php";
812087 3
cc3ac8 4 $s = new \EOG\Models\Stripe();
5
b40e93 6 if (!empty($_POST['stripe'])) {
7     $s->loadFromArray($_POST['stripe']);
812087 8
b40e93 9     if (!empty($s->getState())) {
a4186a 10         file_put_contents(STRIPE_JSON, $s->getJson());
b40e93 11     }
cc3ac8 12
b40e93 13     $s->setClass('simple');
c5946f 14     $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
b40e93 15     file_put_contents(OVERLAY_DIR . 'simple.html', $html_content);
1867e1 16
b40e93 17     $s->setClass('team');
c5946f 18     $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
b40e93 19     file_put_contents(OVERLAY_DIR . 'team.html', $html_content);
1867e1 20
b40e93 21     $s->setClass('team-ban');
c5946f 22     $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s]);
b40e93 23     file_put_contents(OVERLAY_DIR . 'team-ban.html', $html_content);
1867e1 24
cffd2c 25     $s->setClass('team-ban');
26     $html_content = $twig->render('overlays/stripe.twig', ['stripe' => $s, 'autorefresh' => 30]);
27     file_put_contents(OVERLAY_DIR . 'team-ban-refresh.html', $html_content);
28
b40e93 29 } else {
a4186a 30     if (file_exists(STRIPE_JSON)) {
31         $raw_json = file_get_contents(STRIPE_JSON);
b40e93 32         $stateArray = json_decode($raw_json, true);
33         if (is_array($stateArray)) {
34             $s->loadFromArray($stateArray);
35         }
36     }
1867e1 37 }
b40e93 38
39 $teams = new \EOG\Models\TeamList();
40
a4186a 41 if (file_exists(TEAMS_JSON)) {
42     $teams->fromJson(file_get_contents(TEAMS_JSON));
1867e1 43 }
f6a0dc 44 $page = isset($_GET['page']) ? $_GET['page'] : 'overlay';
45 $page = in_array($page,['overlay','interview','update']) ? $page : 'overlay';
268b32 46
cc3ac8 47 $var = [
f6a0dc 48     'page' => $page,
b40e93 49     'stripe' => $s,
50     'teamNames' => $teams->getTeamNames(),
51     'operators' => $s->getOperators(),
52     'post' => !empty($_POST['stripe'])
cc3ac8 53 ];
b40e93 54
f6a0dc 55 echo $twig->render('admin/modules/'.$page .'.twig', $var);
812087 56