echo '<ul>'; foreach ($arr_sids as $s) { echo '<li><a href="?sid=' . $s . '">' . $s . '</a></li>'; } echo '</ul>'; exit; } else { throw new Exception('No surveys found'); } } $did = get_device_id(); $device_type = get_device_type($did); $langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en'; $config = get_config($device_type, $sid, $langCode); //Load page generator $page = new SC_Page_Generator($sid, FOLDER_SURVEYS); ?> <!DOCTYPE HTML> <html> <head> <title>Survey preview</title> <meta charset="utf-8"> <meta name="robots" content="noindex, nofollow, noarchive, nosnippet" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> </head> <body> <?php $page->display_survey_html(!$config['settings']);
pg_address: title: Address questions: - q_address cat_primary: title: Primary Questions pages: pg_fft: title: content: The **FFT** Question type: markdown questions: - content: q_fft - type: html content: And now: the <span>follow-up</span> question - q_fft_why cat_secondary: title: title: Secondary questions pages: pg_last: questions: - q_last EOT; $yaml_parser = new Parser(); $arr_questions = $yaml_parser->parse($questions); $arr_structure = $yaml_parser->parse($structure); var_dump(SC_Survey_Constructor::standardise($arr_questions), SC_Page_Generator::standardise($arr_structure));
$url_menu = config_var_exists($config, 'urls', 'menu') ? str_replace('{DID}', $deviceID, $config['urls']['menu']) : NULL; # Check for initial answers $initialAnswers = ['h_device' => $deviceID]; if (isset($_GET['init']) && strlen($_GET['init']) > 0) { // Prioritise querystring $initialAnswers = array_merge($initialAnswers, json_decode($_GET['init'], TRUE)); $_SESSION['wrapper']['init'] = $initialAnswers; } elseif (isset($_SESSION['wrapper']['init']) && count($_SESSION['wrapper']['init']) > 0) { // Use session, if available $initialAnswers = $_SESSION['wrapper']['init']; } # Get intro and outro paths $introPath = getFilePathWithFallbacks('intro.md', $surveyID, $langCode, !$devMode); $outroPath = getFilePathWithFallbacks('outro.md', $surveyID, $langCode, !$devMode); # Show page $page = new SC_Page_Generator($surveyID, FOLDER_SURVEYS, $langCode); $pageType = isset($_GET['pagetype']) ? $_GET['pagetype'] : 'intro'; ## Load intro if ($pageType === 'intro') { ### Load intro into string if (is_null($introPath)) { #### No intro - start survey $pageType = 'survey'; } elseif (isset($_SESSION['wrapper']['data'][$surveyID][$langCode]['intro.md'])) { #### Load intro from session $content = $_SESSION['wrapper']['data'][$surveyID][$langCode]['intro.md']; } else { #### Load intro from file $content = file_get_contents($introPath); if ($devMode === FALSE) { $_SESSION['wrapper']['data'][$surveyID][$langCode]['intro.md'] = $content;