forked from stunningpixels/yearbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQuestion.php
27 lines (22 loc) · 830 Bytes
/
Question.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
require_once '../Composer/vendor/autoload.php';
require_once 'Configuration.php';
require_once 'Controllers/Authenticator.php';
if (!Authenticator::IsLoggedIn())
{
Redirect('/login');
return;
}
$TaskStates = TaskState::GetTaskStates();
if ($TaskStates[TaskIds::Question]->Task->Status != Task::Available)
{
http_response_code(403);
return;
}
if (isset($_POST['Question']))
{
$GLOBALS['YearbookModel']->AddQuestionProposal($_SESSION['StudentId'], $_POST['Question']);
}
$Proposals = $GLOBALS['YearbookModel']->FindQuestionsByStudentId($_SESSION['StudentId']);
$Template = new Twig_Environment(new Twig_Loader_Filesystem(array('Templates', 'Templates/Modules')), array('cache' => '../Cache', 'auto_reload' => true));
$Template->display('Question.html', array('TaskStates' => $TaskStates, 'Proposals' => $Proposals));