forked from KohoVolit/vaa2012-2
/
index.php
executable file
·60 lines (49 loc) · 1.8 KB
/
index.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* VAA
* reads questions from json
*/
include("../setup.php");
$qfile = 'questions.json';
$rfile = 'region.json';
//$constitfile = '../backend/obvody.json';
if (!isset($_SESSION['started'])) {
session_start();
$_SESSION['started'] = true;
}
// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('../../smarty/templates');
$smarty->setCompileDir('../../smarty/templates_c');
$smarty->setCacheDir('../../smarty/cache');
$smarty->setConfigDir('../../smarty/configs');
//read questions
$questions = json_decode(file_get_contents($qfile));
$number_questions = count((array)$questions);
//$constits = json_decode(file_get_contents($constitfile));
//read regional info
$region = json_decode(file_get_contents($rfile));
//partners
if (isset($_GET['partner'])) {
switch ($_GET['partner']) {
case 'ihned':
$partner = array('name'=>'ihned','swatch_bar' => 'g', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
break;
case 'denik':
$partner = array('name'=>'denik','swatch_bar' => 'h', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a');
break;
case 'idnes':
$partner = array('name'=>'idnes','swatch_bar' => 'i', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'i');
break;
default:
$partner = array('name'=>'default','swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
}
} else $partner = array('name'=>'default','swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e');
$smarty->assign('partner',$partner);
$smarty->assignByRef('questions', $questions);
$smarty->assign('number_questions',$number_questions);
$smarty->assign('region',$region);
//$smarty->assignByRef('constits', $constits);
$smarty->display('page-region.tpl');
?>