예제 #1
0
<?php

$page = "quiz_result";
include "header.php";
$task = isset($_POST['task']) && $_POST['task'] ? trim($_POST['task']) : '';
$task = !$task && (isset($_GET['task']) && $_GET['task']) ? $_GET['task'] : $task;
$quiz_id = isset($_GET['quiz_id']) && $_GET['quiz_id'] ? (int) $_GET['quiz_id'] : 0;
$result_id = he_quiz::user_result($user->user_info['user_id'], $quiz_id);
// DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION
if (!$user->user_exists || !$quiz_id || !$result_id) {
    $page = "error";
    $smarty->assign('error_header', 639);
    $smarty->assign('error_message', 656);
    $smarty->assign('error_submit', 641);
    include "footer.php";
}
$quiz_info = he_quiz::get_quiz_info($quiz_id);
$quiz_result = he_quiz::result_info($result_id);
$friend_list = $user->user_friend_list(0, 10);
$message = array('title' => SE_Language::get(690691154), 'text' => SE_Language::get(690691155), 'type' => 'success');
$photo_url = he_quiz::photo_url();
$smarty->assign('message', $message);
$smarty->assign('quiz_info', $quiz_info);
$smarty->assign('quiz_result', $quiz_result);
$smarty->assign('photo_url', $photo_url);
include "footer.php";
예제 #2
0
 function recent_taked_quizzes($count = 10)
 {
     $query = he_database::placeholder("SELECT `play`.`user_id` AS `play_user_id`, `play`.`play_stamp`, `quiz`.*\r\n\t\t\tFROM `se_he_quiz_play` AS `play`\r\n\t\t\tINNER JOIN ( \r\n\t\t\t    SELECT MAX(`play_stamp`) AS `play_stamp` FROM `se_he_quiz_play`\r\n\t\t\t    WHERE `play_stamp`!=0\r\n\t\t\t    GROUP BY `quiz_id`\r\n\t\t\t) AS `last` ON (`play`.`play_stamp`=`last`.`play_stamp`)\r\n\t\t\tINNER JOIN `se_he_quiz` AS `quiz` ON (`play`.`quiz_id`=`quiz`.`quiz_id`)\r\n\t\t\tWHERE `quiz`.approved = 1 AND `quiz`.`status`=1\r\n\t\t\tLIMIT ?", $count);
     $takes = array();
     $res = he_database::query($query);
     $quiz_arr = array();
     while ($quiz = he_database::fetch_row_from_resource($res)) {
         $quiz['user'] = new se_user(array($quiz['play_user_id']));
         $quiz['photo_url'] = $quiz['photo'] ? he_quiz::photo_url() . $quiz['photo'] : '';
         $quiz_arr[$quiz['quiz_id']] = $quiz;
     }
     return $quiz_arr;
 }