当前位置: 首页>>代码示例>>PHP>>正文


PHP Period::select_ballot方法代码示例

本文整理汇总了PHP中Period::select_ballot方法的典型用法代码示例。如果您正苦于以下问题:PHP Period::select_ballot方法的具体用法?PHP Period::select_ballot怎么用?PHP Period::select_ballot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Period的用法示例。


在下文中一共展示了Period::select_ballot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_participant

/**
 * create a new member and let it become participant of the supplied ballot
 *
 * @param Period  $period
 * @param mixed   $ballot Ballot, true or null
 * @param integer $case
 * @param string  $i
 */
function add_participant(Period $period, $ballot, $case, $i) {
	global $date, $password;

	Login::$member = new Member;
	Login::$member->invite = Login::generate_token(24);
	Login::$member->eligible = true;
	Login::$member->verified = true;
	Login::$member->create();
	Login::$member->username = "t".$date."c".$case."p".(is_object($ballot)?$ballot->id:$ballot).$i;
	Login::$member->password = $password;
	$update_fields = array('username', 'password', 'eligible');

	// Enable this only in local development environment, because it may lead to a lot if notification mails!
	//Login::$member->mail = ERROR_MAIL;
	//$update_fields[] = "mail";

	Login::$member->update($update_fields, 'activated=now()');
	Login::$member->update_ngroups([1]);
	if ($ballot) {
		if (is_object($ballot)) $period->select_ballot($ballot); else $period->select_postal();
	}
}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:30,代码来源:test_ballots.php

示例2:

			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:
		warning(_("Unknown action"));
		redirect();
	}
}


if ($ballot->id) {
	html_head(sprintf(_("Edit Ballot %d"), $ballot->id), true);
} else {
	html_head(_("New ballot"), true);
}
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:30,代码来源:ballot_edit.php

示例3: Ballot

		Login::access_action("entitled", $_SESSION['ngroup']);
		action_required_parameters('ballot');
		$ballot = new Ballot($_POST['ballot']);
		if (!$ballot->id) {
			warning("The requested area does not exist!");
			redirect();
		}
		if ($period->state=="ballot_preparation") {
			warning(_("In ballot preparation phase it is not allowed anymore to select or change the ballot."));
			redirect();
		}
		if ($period->state=="ballot_assignment" and !$ballot->approved) {
			warning(_("In ballot assignment phase it is only allowed to select approved ballots."));
			redirect();
		}
		$period->select_ballot($ballot);
		redirect();
		break;
	case "select_postal":
		Login::access_action("entitled", $_SESSION['ngroup']);
		if ($period->state=="ballot_preparation") {
			warning(_("In ballot preparation phase it is not allowed anymore to select postal voting."));
			redirect();
		}
		$period->select_postal();
		redirect();
		break;
	case "unselect":
		Login::access_action("entitled", $_SESSION['ngroup']);
		if ($period->state=="ballot_preparation") {
			warning(_("In ballot preparation phase it is not allowed anymore to change the ballot choice."));
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:31,代码来源:ballots.php


注:本文中的Period::select_ballot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。