Ejemplo n.º 1
0
        }
        exit;
    }
    if ($mode == 'delete_vote') {
        if (!empty($_REQUEST['vote_id'])) {
            $p_id = db_get_field("SELECT page_id FROM ?:polls_votes WHERE vote_id = ?i", $_REQUEST['vote_id']);
            db_query("DELETE FROM ?:polls_votes WHERE vote_id = ?i", $_REQUEST['vote_id']);
            db_query("DELETE FROM ?:polls_answers WHERE vote_id = ?i", $_REQUEST['vote_id']);
            return array(CONTROLLER_STATUS_OK, 'pages.update?selected_section=poll_statistics&page_id=' . $p_id);
        }
    }
    return;
}
if ($mode == 'poll_reports') {
    if ($_REQUEST['report'] == 'votes') {
        list($votes, $search) = fn_polls_get_votes($_REQUEST, Registry::get('addons.polls.polls_votes_on_page'));
        Tygh::$app['view']->assign('votes', $votes);
        Tygh::$app['view']->assign('search', $search);
        Tygh::$app['view']->display('addons/polls/views/pages/components/votes.tpl');
    } elseif ($_REQUEST['report'] == 'answers') {
        list($comments, $search) = fn_polls_get_comments($_REQUEST, Registry::get('addons.polls.polls_comments_on_page'));
        Tygh::$app['view']->assign('comments', $comments);
        Tygh::$app['view']->assign('search', $search);
        Tygh::$app['view']->display('addons/polls/views/pages/components/comments.tpl');
    }
    exit;
} elseif ($mode == 'add') {
    if (!empty($_REQUEST['page_type']) && $_REQUEST['page_type'] == PAGE_TYPE_POLL) {
        Registry::set('navigation.tabs.poll', array('title' => __('poll'), 'js' => true));
    }
} elseif ($mode == 'update') {
Ejemplo n.º 2
0
            db_query("DELETE FROM ?:polls_votes WHERE page_id = ?i", $p_id);
            return array(CONTROLLER_STATUS_OK, "pages.update?page_id=" . $p_id);
        }
    }
    exit;
} elseif ($mode == 'delete_vote') {
    if (!empty($_REQUEST['vote_id'])) {
        $p_id = db_get_field("SELECT page_id FROM ?:polls_votes WHERE vote_id = ?i", $_REQUEST['vote_id']);
        db_query("DELETE FROM ?:polls_votes WHERE vote_id = ?i", $_REQUEST['vote_id']);
        db_query("DELETE FROM ?:polls_answers WHERE vote_id = ?i", $_REQUEST['vote_id']);
        return array(CONTROLLER_STATUS_OK, "pages.update?page_id={$p_id}&selected_section=poll_statistics");
    }
    return;
} elseif ($mode == 'poll_reports') {
    if ($_REQUEST['report'] == 'votes') {
        $votes = fn_polls_get_votes($_REQUEST, Registry::get('addons.polls.polls_votes_on_page'));
        $view->assign('votes', $votes);
        $view->display('addons/polls/views/pages/components/votes.tpl');
    } elseif ($_REQUEST['report'] == 'answers') {
        $comments = fn_polls_get_comments($_REQUEST, Registry::get('addons.polls.polls_comments_on_page'));
        $view->assign('comments', $comments);
        $view->display('addons/polls/views/pages/components/comments.tpl');
    }
    exit;
} elseif ($mode == 'add') {
    if (!empty($_REQUEST['page_type']) && $_REQUEST['page_type'] == PAGE_TYPE_POLL) {
        Registry::set('navigation.tabs.poll', array('title' => fn_get_lang_var('poll'), 'js' => true));
    }
} elseif ($mode == 'update') {
    $page_data = $view->get_var('page_data');
    if ($page_data['page_type'] == PAGE_TYPE_POLL) {