function get_moderated_groups_by_sentence($sent_id)
{
    return get_groups_by_sentence($sent_id, get_sentence_moderator($sent_id));
}
Example #2
0
    case 'save':
        sentence_save($id);
        header("Location:sentence.php?id={$id}");
        break;
    case 'save_src':
        sentence_save_source($id, $_POST['src_text']);
        header("Location:sentence.php?id={$id}");
        break;
    default:
        $smarty->assign('sentence', $sentence = get_sentence($id));
        if ($mode == 'syntax') {
            if ($sentence['syntax_moder_id'] && $_SESSION['user_id'] == $sentence['syntax_moder_id']) {
                $smarty->assign('group_types', get_syntax_group_types());
                $smarty->assign('groups', get_groups_by_sentence($id, $_SESSION['user_id']));
                $smarty->assign('all_groups', $all = get_all_groups_by_sentence($id));
                $users = array();
                foreach (array_keys($all) as $uid) {
                    $users[$uid] = get_user_info($uid);
                }
                $smarty->assign('group_owners', $users);
                $smarty->display('sentence_syntax_moderator.tpl');
            } else {
                $smarty->assign('group_types', get_syntax_group_types());
                $smarty->assign('groups', get_groups_by_sentence($id, $_SESSION['user_id']));
                $smarty->display('sentence_syntax.tpl');
            }
        } else {
            $smarty->display('sentence.tpl');
        }
}
log_timing();
Example #3
0
            delete_group($_POST['gid']);
            break;
        case 'setGroupHead':
            set_group_head($_POST['gid'], $_POST['head_id']);
            break;
        case 'setGroupType':
            set_group_type($_POST['gid'], $_POST['type']);
            break;
        case 'getGroupsTable':
            // Решил это вынести в аякс, потому что перерисовывать такую
            // табличку на клиенте - сложно, не используя шаблонизатор.
            // TODO: проверка, свое ли спрашивает пользователь
            require_once 'Smarty.class.php';
            $smarty = new Smarty();
            $smarty->template_dir = $config['smarty']['template_dir'];
            $smarty->compile_dir = $config['smarty']['compile_dir'];
            $smarty->config_dir = $config['smarty']['config_dir'];
            $smarty->cache_dir = $config['smarty']['cache_dir'];
            $smarty->assign('group_types', get_syntax_group_types());
            $smarty->assign('groups', get_groups_by_sentence((int) $_POST['sentence_id'], $_SESSION['user_id']));
            $result['table'] = $smarty->fetch('sentence_syntax_groups.tpl');
            break;
        default:
            $result['message'] = "Action not implemented: {$_POST['act']}";
            throw new Exception();
    }
} catch (Exception $e) {
    $result['error'] = 1;
}
log_timing(true);
die(json_encode($result));