<?php date_default_timezone_set('Europe/London'); require_once '../-functions.php'; require_once '../toolkit/sc_page_generator.php'; if (session_id() == '') { session_start(); } //Check for survey id if (!($sid = get_survey_id())) { //Get array of survey ids $arr_sids = array(); $arr_files = glob('../surveys/*.yaml'); foreach ($arr_files as $filepath) { $arr_path = explode('/', $filepath); $filename = array_pop($arr_path); $arr_filename = explode('-', $filename); array_pop($arr_filename); $id = implode('-', $arr_filename); foreach ($arr_sids as $s) { if ($id == $s) { continue 2; } } $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) {
<?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');
<?php date_default_timezone_set('Europe/London'); require_once '../config/dbs.php'; require_once '../-functions.php'; require_once '../toolkit/sc_data_recording.php'; if (session_id() == '') { session_start(); } $sid = get_survey_id(); $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); $response = $_SESSION['sc']['response']; //Avoid duplication $duplicate_response = FALSE; if (isset($_SESSION['urids'])) { //Loop through stored urids foreach ($_SESSION['urids'] as $urid) { if ($urid == $response['h_unique_response_id']) { //Response has already been noted, so this must be a duplicate submission $duplicate_response = TRUE; break; } } //Store this urid $_SESSION['urids'][] = $response['h_unique_response_id']; } else { //Create urid library and store this urid for future testing $_SESSION['urids'] = array($response['h_unique_response_id']);
default: case 'on': $devMode = TRUE; break; } $_SESSION['devMode'] = $devMode; } else { $devMode = isset($_SESSION['devMode']) ? $_SESSION['devMode'] : FALSE; } # Check for reset if (isset($_GET['reset'])) { unset($_SESSION['wrapper']); unset($_SESSION['sc']); } # Check for survey id if (!($surveyID = get_survey_id())) { ## Get array of survey ids $arr_sids = array(); $arr_folders = glob(FOLDER_SURVEYS . '*', GLOB_ONLYDIR); foreach ($arr_folders as $path) { $arr_path = explode('/', $path); $id = array_pop($arr_path); if (substr($id, 0, 1) != '_' && $id !== 'assets') { $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) {