1234567891011121314151617181920212223242526272829303132 |
- <?php
- session_start();
- $admin = isset($_SESSION['auth']);
- require_once('../templates/templates.php');
- require_once('../controller/forms.php');
- require_once('../controller/validator.php');
- require_once('../controller/formparser.php');
- require_once('../controller/generateform.php');
- Validator::check(['id'],$_GET);
- $view_hash = Validator::str($_GET['id']);
- $info = getQuestionaireInfo($view_hash,$admin);
- if (is_null($info)) {
- $template = getTemplate('no_form.html');
- echo parseTemplate($template,[]);
- exit;
- }
- $form = ['title'=>$info['title'], 'description' => $info['description']];
- $reader = new SourceReader($info['source']);
- $parser = new Parser($reader);
- $form['questions'] = $parser->parse();
- if (boolval($info['active'])) {
- $form['id'] = $view_hash;
- } else {
- $form['id'] = "null";
- }
- echo generateFormHTML($form);
|