コード例 #1
0
ファイル: page.php プロジェクト: totalrandom/vaa2012-2
    $_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 regional info
if (isset($_GET['constituency_code'])) {
    $cc = $_GET['constituency_code'];
} else {
    $cc = 8;
}
$region_additional = code2constituency($cc);
//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));
$region->calc = $region->calc . ': ' . $region_additional;
//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');
コード例 #2
0
ファイル: index.php プロジェクト: totalrandom/vaa2012-2
$smarty->setCompileDir('../../../smarty/templates_c');
$smarty->setCacheDir('../../../smarty/cache');
$smarty->setConfigDir('../../../smarty/configs');
$parties_file = '../answers.json';
$rfile = '../region.json';
//extract user values
$user = get_user_values();
//read parties = candidates
$candidates = json_decode(file_get_contents($parties_file));
//read regional info
if (isset($_GET['constituency_code'])) {
    $cc = $_GET['constituency_code'];
} else {
    $cc = 8;
}
$region = code2constituency($cc);
//partner
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;
        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');
}