Ejemplo n.º 1
0
}
?>
<h1 class="text-center">Poll Admin</h1>
		<article class="panel panel-default">
			<header class="panel-heading">
				<h3 class="panel-title">Polls</h3>
			</header>
			<div class="panel-body">
				<form method="get" class="form-horizontal" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
">
					<?php 
// TODO: the following save & delete should be in the header
if (isset($_POST['poll_title'])) {
    savePoll();
}
//TODO: We should probably sort out $_GET and $_POST stuff so that it's handled more consistently/nicely
// Would be nice to have the site send everything via POST, but still allow for navigation to an admin page via GET parameters
if (isset($_GET['poll']) && isset($_GET['deletePoll'])) {
    deletePoll($_GET['poll']);
}
showPollSelector('poll', isset($_GET['poll']) ? $_GET['poll'] : -1, True, 20);
echo <<<FORMGROUP
\t\t\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t\t\t<label for="deletePoll" class="col-lg-2 control-label">Delete</label>
\t\t\t\t\t\t\t\t<div class="col-lg-10">
\t\t\t\t\t\t\t\t\t<input type="checkbox" id="deletePoll" name="deletePoll">
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="form-group">
Ejemplo n.º 2
0
require_once $mainframe->getPath('admin_html');
require_once $mainframe->getPath('class');
$task = mosGetParam($_REQUEST, 'task', '');
$cid = mosGetParam($_REQUEST, 'cid', array(0));
if (!is_array($cid)) {
    $cid = array(0);
}
switch ($task) {
    case "new":
        editPoll(0, $option);
        break;
    case "edit":
        editPoll($cid[0], $option);
        break;
    case "save":
        savePoll($option);
        break;
    case "remove":
        removePoll($cid, $option);
        break;
    case "publish":
        publishPolls($cid, 1, $option);
        break;
    case "unpublish":
        publishPolls($cid, 0, $option);
        break;
    case "cancel":
        cancelPoll($option);
        break;
    default:
        showPolls($option);
Ejemplo n.º 3
0
$breadcrumbs->addElement($lang->get('detailedpoll'), makeURL($mod));
switch ($mode) {
    case 'create':
        if (!$right['editor'] || $poll['state'] != 0) {
            break;
        }
        $breadcrumbs->addElement($lang->get('poll_create'), makeURL($mod, array('mode' => 'create')));
        $polltitle = @trim($_POST['poll']['title']);
        $polldescription = @$_POST['poll']['description'];
        if (isset($_POST['send']) && $polltitle != '') {
            // Poll exists
            if ($poll) {
                updatePoll($pollid, $polltitle, $polldescription);
                // Create new poll
            } else {
                $pollid = savePoll($polltitle, $polldescription, $login->currentUserId());
                redirect(makeUrl('detailedpoll', array('mode' => 'create', 'pollid' => $pollid)));
            }
            foreach ($_POST['data'] as $key => $dataset) {
                if (isset($dataset['delete'])) {
                    deleteQuestion($key);
                }
                $rank = $dataset['rank'];
                $parentid = $dataset['parentid'];
                $title = trim($dataset['title']);
                $description = $dataset['description'];
                $percent = $dataset['percent'];
                if (!parentExists($pollid, $parentid)) {
                    $notify->add($lang->get('detailedpoll'), sprintf($lang->get('notify_parent_missing'), $parentid, $title));
                } else {
                    if ($title != '') {