* obtain it through the world-wide-web, please send a note to * license@php.net so we can mail you a copy immediately. * * @category pearweb * @package pearweb_election * @author Gregory Beaver <*****@*****.**> * @copyright Copyright (c) 2006 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License * @version $Id$ */ auth_require('pear.election'); require 'election/pear-election.php'; $new = 'edit'; $year = date('Y'); $years = array($year + 1, $year--, $year--, $year--); $election = new PEAR_Election(); if (isset($_GET['election'])) { $info = $election->getInfo($_GET['election']); if (!$info) { $error = 'Unknown election'; $elections = $election->listElections(); require PEARWEB_TEMPLATEDIR . '/election/listforedit.tpl.php'; exit; } if (!$election->canEdit($_GET['election'])) { $error = 'Cannot edit that election'; $elections = $election->listElections(); require PEARWEB_TEMPLATEDIR . '/election/listforedit.tpl.php'; exit; } $error = array();
require PEARWEB_TEMPLATEDIR . '/election/new-step3.tpl.php'; } elseif ($_POST['step'] == 4) { if (isset($_POST['cancel'])) { require 'election/pear-voter.php'; $voter = new PEAR_Voter(); $currentelections = $voter->listCurrentElections(); $completedelections = $voter->listCompletedElections(); $allelections = $voter->listAllElections(); $error = 'Election creation cancelled'; $retrieval = false; $old = false; require PEARWEB_TEMPLATEDIR . '/election/vote.tpl.php'; exit; } require 'election/pear-election.php'; $election = new PEAR_Election(); $error = $election->validateStep1(); $info['purpose'] = $_POST['purpose']; $info['detail'] = $_POST['detail']; $info['choices'] = (int) $_POST['choices']; $info['year'] = (int) $_POST['year']; $info['month'] = $_POST['month']; $info['day'] = $_POST['day']; $info['length'] = (int) $_POST['length']; $info['minimum'] = (int) $_POST['minimum']; $info['maximum'] = (int) $_POST['maximum']; $info['eligiblevoters'] = (int) $_POST['eligiblevoters']; if ($error) { // this should never happen. It will only occur // if the user manually fills POST data without going // through the official form, and makes a mistake.