Beispiel #1
0
To start, simply look at the list of foods below and for each one, tell us if you would try it, or, if you have already
had that recipe or something like it, whether you liked it or not. Then, we'll be able to tell you which of your
friends you should be trading recipes with!
</p>
<div id="quiz">
	<form action="" method="POST">
	<table>
		<tbody>
<?php 
$quiz_ids = array();
foreach ($quiz_questions as $quiz_question) {
    $quiz_ids[] = $quiz_question['id'];
    $lastColumn = <<<EOF
    <div style="width: 80px; text-align: center; font-size: 10px"><input type="radio" name="scale_{$quiz_question['id']}" value="0" /><br>Not interested</div></td>
    <td><div style="width: 80px; text-align: center; font-size: 10px"><input type="radio" name="scale_{$quiz_question['id']}" value="1" /><br>Didn't like it</div></td>
    <td><div style="width: 80px; text-align: center; font-size: 10px"><input type="radio" name="scale_{$quiz_question['id']}" value="2" /><br>Would try it</div></td>
    <td><div style="width: 80px; text-align: center; font-size: 10px"><input type="radio" name="scale_{$quiz_question['id']}" value="3" /><br>Loved it!</div>
    </div>
EOF;
    render_quiz_question_row($quiz_question, $lastColumn);
}
?>
		</tbody>
	</table>
	<input type="hidden" name="quiz_ids" value="<?php 
echo join(',', $quiz_ids);
?>
" />
	<input type="submit" name="submit" value="Finish Quiz &gt;" />
	</form>
</div>
Beispiel #2
0
 */
/**
 * Document this file.
 *
 * @author Jason Kinner <*****@*****.**>
 */
$difference_description = array(0 => '<span style="font-size: 18px; color: #75ae29">Perfect!</span>', 1 => '<span style="font-size: 18px;">Good</span>', 2 => '<span style="font-size: 18px;">Good</span>', 3 => '<span style="font-size: 18px; color: #ee701e">Awful!</span>');
?>
<h1>Welcome to Foody, <fb:name uid="loggedinuser" useyou="false" firstnameonly="true">!</h1>
<h2>Find your Food Compatibility Quotient</h2>
<?php 
if ($best_friend_quiz != null) {
    echo '<div style="width: 100%; text-align: center;">Your Food Mate is:<br><span style="font-size: 28px; font-weight: bold">' . $friend_infos[$i]['first_name'] . " " . $friend_infos[$i]['last_name'] . "</span></div><br />\n";
    foreach ($best_friend_quiz->answers as $friend_answer) {
        $my_score = 0;
        foreach ($quiz->answers as $answer) {
            if ($answer->quiz_item == $friend_answer->quiz_item) {
                $my_score = $answer->score;
            }
        }
        $score_difference = abs($my_score - $friend_answer->score);
        $our_difference = $difference_description[$score_difference];
        render_quiz_question_row($quiz_questions[intval($friend_answer->quiz_item) - 1], <<<EOF
        <div style="text-align: center; width: 80px; font-size: 18px;">{$friend_answer->score}<br><span style="font-size: 10px">(Their score)</span></div></td>
        <td><div style="text-align: center; width: 150px; font-size: 18px;">{$my_score}<br><span style="font-size: 10px">(My score)</span></td><td>{$our_difference}
EOF
);
    }
} else {
    echo '<div style="font-size: 18px">None of your friends responded yet!</div>';
}