예제 #1
0
            $smarty->display('static/doc/export.tpl');
            break;
        case 'faq':
            $smarty->assign('active_page', 'about');
            $smarty->assign('content', get_wiki_page('FAQ'));
            $smarty->assign('title', 'FAQ');
            $smarty->display('static/faq.tpl');
            break;
        case 'achievements':
            $am = new AchievementsManager($_SESSION['user_id']);
            $smarty->assign('stats', $am->pull_stats());
            $smarty->assign('manager', $am);
            $smarty->display('achievements/all_achievements.tpl');
            break;
        default:
            header("Location:index.php");
            break;
    }
} else {
    if (!is_admin()) {
        if (is_logged()) {
            $smarty->assign('available', get_available_tasks($_SESSION['user_id'], true, $config['misc']['mainpage_tasks_limit'], true));
            $tagset_id = get_current_tagset();
            $smarty->assign('ner_tagset_id', $tagset_id);
            $smarty->assign('ner_tasks', get_books_with_NE($tagset_id));
        }
        $smarty->assign('answer_count', count_all_answers());
    }
    $smarty->display('index.tpl');
}
log_timing();
예제 #2
0
파일: api.php 프로젝트: ayunah/opencorpora
             $parts[] = $p['title'];
         }
         $res['text_fullname'] = join(': ', array_reverse($parts));
     }
     break;
 case 'login':
     $user_id = user_check_password($_POST['login'], $_POST['password']);
     if ($user_id) {
         $token = remember_user($user_id, false, false);
         $answer['answer'] = array('user_id' => $user_id, 'token' => $token);
     } else {
         $answer['error'] = 'Incorrect login or password';
     }
     break;
 case 'get_available_morph_tasks':
     $answer['answer'] = array('tasks' => get_available_tasks($user_id, true));
     break;
 case 'get_morph_task':
     if (empty($_POST['pool_id']) || empty($_POST['size'])) {
         throw new UnexpectedValueException("Wrong args");
     }
     // timeout is in seconds
     $answer['answer'] = get_annotation_packet($_POST['pool_id'], $_POST['size'], $user_id, $_POST['timeout']);
     break;
 case 'update_morph_task':
     throw new Exception("Not implemented");
     // currently no backend
     break;
 case 'save_morph_task':
     // answers is expected to be an array(array(id, answer), array(id, answer), ...)
     update_annot_instances($user_id, $_POST['answers']);
예제 #3
0
                $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:
        $smarty->assign('available', get_available_tasks($_SESSION['user_id']));
        $smarty->assign('complexity', array(0 => 'Сложность неизвестна', 1 => 'Очень простые задания', 2 => 'Простые задания', 3 => 'Сложные задания', 4 => 'Очень сложные задания'));
        $smarty->display('qa/tasks.tpl');
}
log_timing();