コード例 #1
0
			redirect("ballots.php?period=".$period->id);
		}
		$ballot->name = trim($_POST['name']);
		$ballot->agents = trim($_POST['agents']);
		$ballot->opening = sprintf("%02d:%02d:00", $_POST['opening_hour'], $_POST['opening_minute']);
		$ballot->ngroup = intval($_POST['ngroup']);
		if (!$ballot->name) {
			warning(_("The ballot name must not be empty."));
			break;
		}
		if (!$ballot->agents) {
			warning(_("The ballot agents must not be empty."));
			break;
		}
		if ($ballot->id) {
			$ballot->update();
		} else {
			if ($period->state=="ballot_assignment") {
				warning(_("Ballot assignment has already begun, so ballot applications are not allowed anymore."));
				redirect("ballots.php?period=".$period->id);
			}
			$ballot->create();
			if (!$ballot->id) {
				warning(_("The ballot could not be created!"));
				redirect();
			}
		}
		$period->select_ballot($ballot, true);
		redirect("ballots.php?period=".$period->id);

	default: