Esempio n. 1
0


$questions[] = array(
	'key' => 'damagetoday',
	'name' => 'Date of Damage',
	'prompt' => 'Did the damage happen today?',
	'prompt2' => didntUnderstand() . 'Was today the day the damage happened?',
	'choices' => '[BOOLEAN]'
);

if(defined('SURVEY_MODE') && ($today = surveyVal('damagetoday')) !== FALSE)
{
	if($today)
	{
		storeSurveyResponse('date', date('Y-m-d'));
	}
	else
	{
		$questions[] = array(
			'key' => 'date',
			'name' => 'Date of Damage',
			'prompt' => 'What day did the damage happen?',
			'prompt2' => 'Please tell me the full date.',
			'choices' => '[DATE]'
		);
	}
}

$questions[] = array(
	'key' => 'damage_type',
Esempio n. 2
0
		// If no rows were updated, that means there wasn't already a row for this key, so insert it now
		if($query->rowCount() == 0)
		{
			$query = db()->prepare('INSERT INTO `responses` (`callID`, `key`, `recording`) VALUES(:callID, :key, :recording)');
			$query->bindValue(':callID', $_SESSION['callID']);
			$query->bindValue(':key', $key);
			$query->bindValue(':recording', $filename);
			$query->execute();
		}

		die();
	}
	elseif(isset($responseValue))
	{
		storeSurveyResponse($key, $responseValue);
	}

	// After processing the input, include the questions file so logic can happen in it based on the session values set above
	include('survey.php');

	// Find the next question and ask it
	foreach($questions as $i=>$q)
	{
		if(array_key_exists('key', $q) && $q['key'] == $key)
		{
			$thisQuestion = $q;
			if(array_key_exists($i+1, $questions))
			{
				$nextQuestionIndex = $i + 1;
				$nextQuestion = $questions[$i + 1];