$arr_sids[] = $id; } //Display links to surveys if (count($arr_sids) > 0) { echo '<h3>Please choose a survey to run</h3>'; 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>
<?php date_default_timezone_set('Europe/London'); require_once '../-functions.php'; require_once '../toolkit/sc_survey_flow.php'; if (session_id() == '') { session_start(); } $surveyID = get_survey_id(); $deviceID = get_device_id(); $device_type = get_device_type($deviceID); $langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en'; $config = get_config($device_type, $surveyID, $langCode); # Load rules if ($survey = new SC_Survey_Flow($surveyID, FOLDER_SURVEYS, $langCode)) { //Config $survey->bool_store_bwd = TRUE; //Process answers to questions if (isset($_POST['sc_page_id'])) { // Languages if (isset($_POST['q_language'])) { $langCode = $_POST['q_language']; if (!is_null($langCode) && !empty($langCode)) { $_SESSION['wrapper']['language'] = $langCode; } } $next_id = $survey->go(); } else { $first_id = $survey->obj_page_generator->get_first_page_id(); SC_Survey_Flow::reset_survey($first_id); throw new Exception('no page id posted');