本文整理汇总了PHP中Invitation::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::create方法的具体用法?PHP Invitation::create怎么用?PHP Invitation::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLevelApplyingWithFreeRegistration
public function testLevelApplyingWithFreeRegistration()
{
$sylvheim = Member::getByNum(\SystemStats::ACCOUNT_SYLVHEIM);
$sylvheim_total = new TransactionTotalsAssertions($sylvheim, $this);
/* Setup - This member is set as paid but no money is spread.
* Because this one is just for testing purpose
---------------------------------------------*/
$marketingLeader = DbEntityHelper::createMember($sylvheim, ['Type' => Member::TYPE_MARKETINGLEADER]);
$marketingLeader->reload(self::$propelCon);
$marketingLeader_total = new TransactionTotalsAssertions($marketingLeader, $this);
/* Create invitation
---------------------------------------------*/
$invitation = Invitation::create($marketingLeader, ['type' => Member::TYPE_ORGLEADER, 'free_signup' => 1], self::$propelCon);
/* Create member with created invitation code
---------------------------------------------*/
list($valid, $data, $referralMember, $invitation) = \Member::validateSignupForm(array_merge(self::$singupFormData, ['referral_member_num' => $marketingLeader->getNum(), 'invitation_code' => $invitation->getHash()]));
// Because the marketing leader is level 1 this org leader will be
// transfered to be child of sylvheim
$orgLeader = \Member::createFromSignup($data, $marketingLeader, $invitation, self::$propelCon);
$orgLeader->reload(self::$propelCon);
// Because orgleaders parent has to be sylvhelm, advertising someone first time
// needs to bonus sylvheim
DbEntityHelper::createSignupMember($orgLeader);
// Spread money for creating this last member
$sylvheim_total->add(Transaction::REASON_SYLVHEIM, 1);
$sylvheim_total->add(Transaction::REASON_ADVERTISED_INDIRECT, 1);
// VL_BONUS - because, orgleader was VL first member and got transferred to
// sylvheimm, therefore there is no VL between sylvheim and ol when ol
// inviteds member
$sylvheim_total->add(Transaction::REASON_VL_BONUS, 1);
// marketing leader gets nothing from ol's advertising.
$sylvheim_total->assertTotals();
$marketingLeader_total->assertTotals();
}
示例2: 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 >= \Member::TYPE_CEO) {
throw new PermissionDeniedException();
}
\Invitation::create($login, $_REQUEST, \Propel::getConnection());
return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'index', ['member' => Session::getLogin(), 'tab' => 'invitation']);
}
示例3: createMemberWithInvitation
public static function createMemberWithInvitation($referrer, $invitationData, $data = [])
{
if (is_numeric($invitationData)) {
$invitationData = ['type' => $invitationData];
}
$data = array_merge(self::$memberInvitation, $data);
/* Create invitation
---------------------------------------------*/
$invitation = Invitation::create($referrer, $invitationData, self::$con);
/* Create member with created invitation code
---------------------------------------------*/
list($valid, $data, $referralMember, $invitation) = \Member::validateSignupForm(array_merge($data, ['referral_member_num' => $referrer->getNum(), 'invitation_code' => $invitation->getHash()]));
$member = \Member::createFromSignup($data, $referrer, $invitation, self::$con);
$member->reload(self::$con);
if (!isset($invitationData['free_signup']) || !$invitationData['free_signup']) {
$member->onReceivedMemberFee(self::$currency, time(), false, self::$con);
}
return $member;
}
示例4: 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' => []]);
}
示例5: testInvitationCanFreeFromFee
public function testInvitationCanFreeFromFee()
{
// NOTE: This tests what happen if one of my third+ advertisings gets
// deleted due to not paiing fee.
/* Setup
---------------------------------------------*/
DbEntityHelper::setCon(self::$propelCon);
$marketingLeader = DbEntityHelper::createMember(null, ['type' => Member::TYPE_MARKETINGLEADER]);
$marketingLeader->reload(self::$propelCon);
/* Create invitation
---------------------------------------------*/
$invitation = Invitation::create($marketingLeader, ['type' => Member::TYPE_ORGLEADER, 'free_signup' => 1], self::$propelCon);
/* Create member with created invitation code
---------------------------------------------*/
list($valid, $data, $referralMember, $invitation) = \Member::validateSignupForm(array_merge(self::$singupFormData, ['referral_member_num' => $marketingLeader->getNum(), 'invitation_code' => $invitation->getHash()]));
$member = \Member::createFromSignup($data, $marketingLeader, $invitation, self::$propelCon);
$member->reload(self::$propelCon);
/* Assert proper member type
---------------------------------------------*/
$this->assertEquals(Member::TYPE_ORGLEADER, $member->getType());
$this->assertNotNull($member->getPaidDate());
}
示例6: testSubPromoterBonusSpreading
public function testSubPromoterBonusSpreading()
{
// Deprecated
$this->assertTrue(true);
return;
/**
* PM
* 1$
*
* VL - S_PM - Neues Mitglied
* 1$ - 1$ - 5$
* ------------------------------------------*/
/* Setup
---------------------------------------------*/
DbEntityHelper::setCon(self::$propelCon);
$marketingLeader = DbEntityHelper::createMember(null, ['Type' => Member::TYPE_MARKETINGLEADER, 'FundsLevel' => Member::FUNDS_LEVEL2]);
$marketingLeader->reload(self::$propelCon);
$mLeaderTransfer = new TransactionTotalsAssertions($marketingLeader, $this);
$promoter = DbEntityHelper::createSignupMember($marketingLeader);
$mLeaderTransfer->add(Transaction::REASON_ADVERTISED_LVL2);
$mLeaderTransfer->add(Transaction::REASON_VL_BONUS);
$mLeaderTransfer->add(Transaction::REASON_OL_BONUS);
$mLeaderTransfer->add(Transaction::REASON_PM_BONUS);
/* Create invitation
---------------------------------------------*/
$invitation = Invitation::create($marketingLeader, ['type' => Member::TYPE_SUB_PROMOTER, 'free_signup' => 1, 'promoter_num' => $promoter->getNum(), 'promoter_id' => $promoter->getId()], self::$propelCon);
/* Create member with created invitation code
---------------------------------------------*/
list($valid, $data, $referralMember, $invitation) = \Member::validateSignupForm(array_merge(self::$singupFormData, ['referral_member_num' => $marketingLeader->getNum(), 'invitation_code' => $invitation->getHash()]));
$subPromoter = \Member::createFromSignup($data, $marketingLeader, $invitation, self::$propelCon);
$subPromoter->reload(self::$propelCon);
/* Sub promoter recruits anyone
---------------------------------------------*/
DbEntityHelper::createSignupMember($subPromoter);
$subPromoterTransfer = new TransactionTotalsAssertions($subPromoter, $this);
$promoterTransfer = new TransactionTotalsAssertions($promoter, $this);
$mLeaderTransfer->add(Transaction::REASON_VL_BONUS);
$mLeaderTransfer->add(Transaction::REASON_ADVERTISED_INDIRECT);
$promoterTransfer->add(Transaction::REASON_SUB_PM_REF_BONUS);
$subPromoterTransfer->add(Transaction::REASON_SUB_PM_BONUS);
$subPromoterTransfer->add(Transaction::REASON_ADVERTISED_LVL1);
$mLeaderTransfer->assertTotals();
$promoterTransfer->assertTotals();
$subPromoterTransfer->assertTotals();
}