1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Phase\TakeATicketBundle\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
6
|
|
|
|
7
|
|
|
class DefaultController extends BaseController |
8
|
|
|
{ |
9
|
|
|
public function indexAction() |
10
|
|
|
{ |
11
|
|
|
$viewParams = $this->defaultViewParams(); |
12
|
|
|
$viewParams['freeze'] = $this->getDataStore()->fetchSetting('freeze'); |
13
|
|
|
$viewParams['freezeMessage'] = $this->getDataStore()->fetchSetting('freezeMessage'); |
14
|
|
|
|
15
|
|
|
// replace this example code with whatever you need |
16
|
|
|
return $this->render('default/upcoming.html.twig', $viewParams); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function songSearchAction() |
20
|
|
|
{ |
21
|
|
|
$viewParams = $this->defaultViewParams(); |
22
|
|
|
$viewParams['freeze'] = $this->getDataStore()->fetchSetting('freeze'); |
23
|
|
|
return $this->render('default/songSearch.html.twig', $viewParams); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function announceAction($section) |
27
|
|
|
{ |
28
|
|
|
/** @noinspection RealpathInSteamContextInspection */ |
29
|
|
|
$rootDir = realpath(__DIR__.'/../../../../'); // FIXME get from Kernel |
30
|
|
|
$announceDir = $rootDir.'/docs/announcements'; |
31
|
|
|
|
32
|
|
|
if (!preg_match('/^\w+$/', $section)) { |
33
|
|
|
throw new NotFoundHttpException(); // don't give access to anything but plain names |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
$candidateFile = $announceDir.'/'.$section.'.md'; |
37
|
|
|
|
38
|
|
|
if (!file_exists($candidateFile)) { |
39
|
|
|
throw new NotFoundHttpException(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
$markdown = file_get_contents($candidateFile); |
43
|
|
|
|
44
|
|
|
return $this->render( |
45
|
|
|
':default:announce.html.twig', |
46
|
|
|
[ |
47
|
|
|
'announcement' => $markdown, |
48
|
|
|
'messageClass' => $section, |
49
|
|
|
'displayOptions' => $this->getDisplayOptions(), |
50
|
|
|
] |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|