Fibinger Ádám
2019-10-17 3305a7d3f084065190f72c0335e84d959d45322d
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())) {
10         file_put_contents($last_json, $s->getJson());
11     }
cc3ac8 12
b40e93 13     $s->setClass('simple');
3305a7 14     $html_content = $twig->render('overlay-base.twig', ['stripe' => $s]);
b40e93 15     file_put_contents(OVERLAY_DIR . 'simple.html', $html_content);
1867e1 16
b40e93 17     $s->setClass('team');
3305a7 18     $html_content = $twig->render('overlay-base.twig', ['stripe' => $s]);
b40e93 19     file_put_contents(OVERLAY_DIR . 'team.html', $html_content);
1867e1 20
b40e93 21     $s->setClass('team-ban');
3305a7 22     $html_content = $twig->render('overlay-base.twig', ['stripe' => $s]);
b40e93 23     file_put_contents(OVERLAY_DIR . 'team-ban.html', $html_content);
1867e1 24
b40e93 25 } else {
26     if (file_exists($last_json)) {
27         $raw_json = file_get_contents($last_json);
28         $stateArray = json_decode($raw_json, true);
29         if (is_array($stateArray)) {
30             $s->loadFromArray($stateArray);
31         }
32     }
1867e1 33 }
b40e93 34
35 $teams = new \EOG\Models\TeamList();
36
37 if (file_exists(OVERLAY_DIR . 'teams.json')) {
3305a7 38     $teams->fromJson(file_get_contents(OVERLAY_DIR . 'teams.json'));
1867e1 39 }
268b32 40
cc3ac8 41 $var = [
b40e93 42     'stripe' => $s,
43     'teamNames' => $teams->getTeamNames(),
44     'operators' => $s->getOperators(),
45     'post' => !empty($_POST['stripe'])
cc3ac8 46 ];
b40e93 47
3305a7 48 echo $twig->render('admin/stripe-form.twig', $var);
812087 49