Esempio n. 1
0
<?php

session_start();
include "setting.php";
if (!isset($_SESSION['id']) || !isset($_SESSION['ipaddress'])) {
    gotoindex();
}
check_login();
$_GET['pagename'] = 'log';
include "header.php";
$result = get_my_answers($_SESSION['id']);
print_list($result);
include "footer.php";
function print_list($result)
{
    $num = pg_num_rows($result);
    if ($num == 0) {
        print "まだ診断を行っていません。<br>\n";
    } else {
        print "<table>\n";
        print "<tr><th>診断名</th><th>回答</th><th>結果</th></tr>\n";
        for ($i = 0; $i < $num; $i++) {
            $row = pg_fetch_assoc($result, $i);
            $ans = getAnswer($row['answer']);
            print "<tr><td>{$row['content']}</td><td>{$row['choice']}</td><td>{$ans}</td></tr>\n";
        }
        print "</table>\n";
    }
}
function get_my_answers($id)
{
Esempio n. 2
0
         $smarty->display('qa/morph_annot.tpl');
     } else {
         $smarty->assign('next_pool_id', get_next_pool($_SESSION['user_id'], (int) $_GET['pool_id']));
         $smarty->assign('final', true);
         if (game_is_on()) {
             $am2 = new AchievementsManager($_SESSION['user_id']);
             $smarty->assign('achievement', $am2->get_closest());
         }
         $smarty->display('qa/morph_annot_thanks.tpl');
     }
     break;
 case 'my':
     if (!isset($_GET['pool_id']) || !$_GET['pool_id']) {
         throw new UnexpectedValueException('Wrong pool_id');
     }
     if ($t = get_my_answers((int) $_GET['pool_id'], 0)) {
         $smarty->assign('packet', $t);
         $smarty->display('qa/morph_annot.tpl');
     } else {
         show_error("Не нашлось примеров.");
     }
     break;
 case 'pause':
     $smarty->assign('next_pool_id', get_next_pool($_SESSION['user_id'], (int) $_GET['pool_id']));
     if (game_is_on()) {
         $am2 = new AchievementsManager($_SESSION['user_id']);
         $smarty->assign('achievement', $am2->get_closest());
     }
     $smarty->display('qa/morph_annot_thanks.tpl');
     break;
 default: