Exemplo n.º 1
0
function make_and_publish_pools()
{
    $res = sql_query("\n        SELECT pool_type, COUNT(tf_id) AS cnt\n        FROM morph_annot_candidate_samples cs\n        JOIN morph_annot_pool_types t\n            ON (cs.pool_type = t.type_id)\n        WHERE t.complexity > 0\n        AND t.doc_link != ''\n        GROUP BY pool_type\n    ");
    sql_begin();
    while ($r = sql_fetch_array($res)) {
        // how many pools can we make?
        $n_pools = floor($r['cnt'] / MA_DEFAULT_POOL_SIZE);
        if (!$n_pools) {
            continue;
        }
        // create and publish pools
        $pool_ids = promote_samples($r['pool_type'], 'random', MA_DEFAULT_POOL_SIZE, $n_pools, 0);
        foreach ($pool_ids as $pid) {
            publish_pool($pid, true);
        }
    }
    sql_commit();
}
Exemplo n.º 2
0
         $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
         $matches = NULL;
         if ($filter && !user_has_permission(PERM_MORPH_MODER) && preg_match('/^user:(\\d+)$/', $filter, $matches)) {
             if ($matches[1] != $_SESSION['user_id']) {
                 show_error("Можно просматривать только свои ответы.");
                 return;
             }
         }
         $smarty->assign('sortby', isset($_GET['sortby']) ? $_GET['sortby'] : '');
         $smarty->assign('pool', get_morph_samples_page($_GET['pool_id'], isset($_GET['ext']), $config['misc']['morph_annot_moder_context_size'], isset($_GET['skip']) ? $_GET['skip'] : 0, $filter, !user_has_permission(PERM_MORPH_MODER) || OPTION(OPT_MODER_SPLIT) == 1 ? $config['misc']['morph_annot_moder_page_size'] : 0, isset($_GET['sortby']) ? $_GET['sortby'] : ''));
         $smarty->display('qa/pool.tpl');
     }
     break;
 case 'promote':
     check_permission(PERM_MORPH_MODER);
     promote_samples((int) $_GET['pool_type'], $_POST['type'], (int) $_POST[$_POST['type'] . "_n"], (int) $_POST['pools_num'], $_SESSION['user_id']);
     header("Location:pools.php?type=2");
     break;
 case 'publish':
     publish_pool($_GET['pool_id']);
     header("Location:pools.php?type=2");
     break;
 case 'unpublish':
     unpublish_pool($_GET['pool_id']);
     header("Location:pools.php?act=samples&pool_id=" . $_GET['pool_id']);
     break;
 case 'begin_moder':
     moderate_pool($_GET['pool_id']);
     header("Location:pools.php?act=samples&pool_id=" . $_GET['pool_id']);
     break;
 case 'agree':