本文整理汇总了PHP中Invitation::initInvitationForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::initInvitationForm方法的具体用法?PHP Invitation::initInvitationForm怎么用?PHP Invitation::initInvitationForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::initInvitationForm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public static function create(Member $login, array $data, PropelPDO $con)
{
$formData = \Invitation::initInvitationForm($data);
$invitationsCount = InvitationQuery::create()->count();
$hash = \Tbmt\Cryption::getInvitationHash($login, $formData['type'], $invitationsCount . time());
$invitation = new Invitation();
$invitation->setHash($hash)->setMemberId($login->getId())->setType($formData['type'])->setFreeSignup($formData['free_signup'] ? 1 : 0)->setCreationDate(time())->save($con);
return $invitation;
}
示例2: render
public function render(array $params = array())
{
if (!isset($params['member']) && !$params['member'] instanceof \Member) {
throw new \Exception('Invalid param member for account index view.');
}
$this->member = $params['member'];
$this->formVal = \Invitation::initInvitationForm(isset($params['formVal']) ? $params['formVal'] : $_REQUEST);
$this->formErrors = isset($params['formErrors']) ? $params['formErrors'] : [];
$this->invitations = \InvitationQuery::create()->filterByMemberId($this->member->getId())->orderBy('AcceptedDate', \Criteria::DESC)->orderBy('CreationDate', \Criteria::DESC)->limit(100)->find();
$this->invitationDateFormat = \Tbmt\Localizer::get('datetime_format_php.long');
return $this->renderFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tab.invitation.account.html', $params);
}
示例3: action_invitation_create
public function action_invitation_create()
{
$login = Session::getLogin();
$type = Arr::init($_REQUEST, 'type', TYPE_INT);
if ($login->getType() < $type || $type < \Member::TYPE_MEMBER || $type > $login->getType() || $login->getFundsLevel() != \Member::FUNDS_LEVEL2) {
throw new PermissionDeniedException();
}
if ($type === \Member::TYPE_SUB_PROMOTER) {
list($valid, $data, $recipient) = \Invitation::validateInvitationForm($_REQUEST);
if ($valid !== true) {
return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'index', ['member' => $login, 'tab' => 'invitation', 'formErrors' => $data, 'recipient' => $recipient, 'formVal' => $_REQUEST]);
}
if ($data['promoter_id'] === '') {
$data['promoter_id'] = $recipient->getId();
return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'index', ['member' => $login, 'tab' => 'invitation', 'formVal' => $data, 'recipient' => $recipient]);
}
} else {
$data = \Invitation::initInvitationForm($_REQUEST);
}
\Invitation::create($login, $data, \Propel::getConnection());
return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'index', ['member' => $login, 'tab' => 'invitation', 'successmsg' => true, 'formVal' => []]);
}