function moder_agree_with_all($pool_id) { $samples = get_morph_samples_page($pool_id, true, 1, 0, 'not_moderated'); sql_begin(); foreach ($samples['samples'] as $sample) { if ($sample['disagreed'] === 0) { save_moderated_answer($sample['id'], $sample['instances'][0]['answer_num'], 0); } } sql_commit(); }
if (isset($_GET['tabs'])) { $smarty->assign('pool', get_morph_samples_page($_GET['pool_id'], true, 100)); header("Content-type: application/csv; charset=utf-8"); header("Content-disposition: attachment; filename=pool_" . (int) $_GET['pool_id'] . ".tab"); $smarty->display('qa/pool_tabs.tpl'); } else { $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']);