本文整理汇总了PHP中Invitation类的典型用法代码示例。如果您正苦于以下问题:PHP Invitation类的具体用法?PHP Invitation怎么用?PHP Invitation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Invitation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: create
public static function create(Member $login, array $data, PropelPDO $con)
{
$type = $data['type'];
$hash = SystemStats::getIncreasedInvitationIncrementer($con);
$invitation = new Invitation();
if ($type === \Member::TYPE_SUB_PROMOTER) {
$invitation->setMeta(['promoter_num' => $data['promoter_num'], 'promoter_id' => $data['promoter_id']]);
}
$invitation->setHash($hash)->setMemberId($login->getId())->setType($type)->setFreeSignup(isset($data['free_signup']) && $data['free_signup'] ? 1 : 0)->setCreationDate(time())->save($con);
return $invitation;
}
示例3: 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();
}
示例4: getInvitationMessage
function getInvitationMessage($invitation)
{
$search = array("\n", "\r");
$replace = array("<br/>", "");
$messageObj = Invitation::GetInstance()->GetInvitationMessageById($invitation['invitemessageid']);
return str_replace($search, $replace, $messageObj['message']);
}
示例5: GetInstance
static function GetInstance()
{
if (self::$instance == NULL) {
self::$instance = new Invitation();
}
return self::$instance;
}
示例6: it_can_invite_someone
/**
* @test
*/
public function it_can_invite_someone()
{
$id = $this->generator->generate();
$this->scenario->when(function () use($id) {
return Invitation::invite($id, 'asm89');
})->then([new InvitedEvent($id, 'asm89')]);
}
示例7: execute
/**
* Shows the page to the user.
* @param string $sub: The subpage string argument (if any).
* [[Special:HelloWorld/subpage]].
*/
public function execute($sub)
{
$out = $this->getOutput();
$request = $this->getRequest();
$user = $this->getUser();
// Set the page title, robot policies, etc.
$this->setHeaders();
// If the user doesn't have the required 'SendToFollowers' permission, display an error
if (!$user->isAllowed('getinvitationcode')) {
$out->permissionRequired('getinvitationcode');
return;
}
$out->setPageTitle($this->msg('huijimiddleware-invitationcode'));
// Is the database locked?
if (wfReadOnly()) {
$out->readOnlyPage();
return false;
}
// Blocked through Special:Block? No access for you!
if ($user->isBlocked()) {
$out->blockedPage(false);
return false;
}
// Parses message from .i18n.php as wikitext and adds it to the
// page output.
$num = $request->getVal('num');
if ($num == '') {
$num = 1;
}
Invitation::generateInvCode($num);
$code = Invitation::getInvList($num);
$out->addHtml($code);
// $out->addWikiMsg( 'huijimiddleware-helloworld-intro' );
}
示例8: show
public static function show(Inputter $inputter, JSONOutputter $outputter)
{
// Show
//
$id = $inputter->additional_uri_arguments[0];
$error = null;
UniversallyUniqueIdentifier::propertyIsValid('rawIdentifier', $id, $error);
if (isset($error)) {
$outputter->print_error($error);
}
// User ID
//
$client = new Everyman\Neo4j\Client('events.sb04.stations.graphenedb.com', 24789);
$client->getTransport()->setAuth('Events', '3TP9LHROhv8LIcGmbYzq');
$query_string = 'MATCH (object:Invitation)
WHERE object.' . UNIVERSALLY_UNIQUE_OBJECT_KEY_IDENTIFICATION . ' = \'' . $id . '\'
RETURN object';
$query = new Everyman\Neo4j\Cypher\Query($client, $query_string);
$result = $query->getResultSet();
if (count($result) > 0) {
// Compare sent data is equal to data retrieved
//
$object = $result[0]['object'];
// Print data
//
$outputter->print_data(array(Invitation::printer_dictionary($object)));
} else {
// Throw error, user doesn't exists
//
$error = Error::withDomain(PRIVATE_EVENTS_REST_CONTROLLER_ERROR_DOMAIN, PRIVATE_EVENTS_REST_CONTROLLER_ERROR_CODE_ENTITY_DOES_NOT_EXIST, 'Invitation with ID does not exist.');
$outputter->print_error($error);
}
}
示例9: fire
public function fire()
{
$this->info(date('Y-m-d') . ' Running SendRecurringInvoices...');
$today = new DateTime();
$invoices = Invoice::with('account.timezone', 'invoice_items', 'client')->whereRaw('is_deleted IS FALSE AND deleted_at IS NULL AND is_recurring IS TRUE AND start_date <= ? AND (end_date IS NULL OR end_date >= ?)', array($today, $today))->get();
$this->info(count($invoices) . ' recurring invoice(s) found');
foreach ($invoices as $recurInvoice) {
if ($recurInvoice->client->deleted_at) {
continue;
}
date_default_timezone_set($recurInvoice->account->getTimezone());
$this->info('Processing Invoice ' . $recurInvoice->id . ' - Should send ' . ($recurInvoice->shouldSendToday() ? 'YES' : 'NO'));
if (!$recurInvoice->shouldSendToday()) {
continue;
}
$invoice = Invoice::createNew($recurInvoice);
$invoice->client_id = $recurInvoice->client_id;
$invoice->recurring_invoice_id = $recurInvoice->id;
$invoice->invoice_number = 'R' . $recurInvoice->account->getNextInvoiceNumber();
$invoice->amount = $recurInvoice->amount;
$invoice->balance = $recurInvoice->amount;
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->discount = $recurInvoice->discount;
$invoice->po_number = $recurInvoice->po_number;
$invoice->public_notes = $recurInvoice->public_notes;
$invoice->terms = $recurInvoice->terms;
$invoice->tax_name = $recurInvoice->tax_name;
$invoice->tax_rate = $recurInvoice->tax_rate;
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
if ($invoice->client->payment_terms) {
$invoice->due_date = date_create()->modify($invoice->client->payment_terms . ' day')->format('Y-m-d');
}
$invoice->save();
foreach ($recurInvoice->invoice_items as $recurItem) {
$item = InvoiceItem::createNew($recurItem);
$item->product_id = $recurItem->product_id;
$item->qty = $recurItem->qty;
$item->cost = $recurItem->cost;
$item->notes = Utils::processVariables($recurItem->notes);
$item->product_key = Utils::processVariables($recurItem->product_key);
$item->tax_name = $recurItem->tax_name;
$item->tax_rate = $recurItem->tax_rate;
$invoice->invoice_items()->save($item);
}
foreach ($recurInvoice->invitations as $recurInvitation) {
$invitation = Invitation::createNew($recurInvitation);
$invitation->contact_id = $recurInvitation->contact_id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invoice->invitations()->save($invitation);
}
$this->mailer->sendInvoice($invoice);
$recurInvoice->last_sent_date = Carbon::now()->toDateTimeString();
$recurInvoice->save();
}
$this->info('Done');
}
示例10: 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']);
}
示例11: create
/**
* Show the form for creating a new resource.
*
* @param string $code
* @return Response
*/
public function create($code = null)
{
if ($code != null && is_null(Invitation::where('code', '=', $code)->where('used_by', '=', '0')->first())) {
return View::make('admin.login.register')->withErrors(array('mainError' => 'Кодът Ви е грешен. Ако мислите, че няма грешка, моля въведете кода и имейла по-отдолу.'));
} elseif (!is_null(Invitation::where('code', '=', $code)->where('used_by', '=', '0')->first())) {
$email = Invitation::where('code', '=', $code)->first()->email;
return View::make('admin.login.register')->with('code', $code)->with('email', $email);
}
return View::make('admin.login.register');
}
示例12: 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);
}
示例13: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$invitation = Invitation::find($id);
if (!is_null($invitation)) {
if ($invitation->delete()) {
return Redirect::route('admin.invitations.index')->withErrors(array('mainSuccess' => 'Поканата е успешно изтрита.'));
} else {
return Redirect::route('admin.invitations.index')->withErrors(array('mainError' => 'Грешка с базата данни.'));
}
} else {
return Redirect::route('admin.invitations.index')->withErrors(array('mainError' => 'Поканата не е намерена.'));
}
}
示例14: getClientDatatable
public function getClientDatatable()
{
$search = Input::get('sSearch');
$invitationKey = Session::get('invitation_key');
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->first();
if (!$invitation || $invitation->is_deleted) {
return [];
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return [];
}
return $this->invoiceRepo->getClientDatatable($invitation->contact_id, ENTITY_QUOTE, $search);
}
示例15: inviteAction
public function inviteAction(Team $team, Player $player, Player $me)
{
if (!$me->canEdit($team)) {
throw new ForbiddenException("You are not allowed to invite a player to that team!");
} elseif ($team->isMember($player->getId())) {
throw new ForbiddenException("The specified player is already a member of that team.");
} elseif (Invitation::hasOpenInvitation($player->getId(), $team->getId())) {
throw new ForbiddenException("This player has already been invited to join the team.");
}
return $this->showConfirmationForm(function () use($team, $player, $me) {
$invite = Invitation::sendInvite($player->getId(), $me->getId(), $team->getId());
Service::getDispatcher()->dispatch(Events::TEAM_INVITE, new TeamInviteEvent($invite));
return new RedirectResponse($team->getUrl());
}, "Are you sure you want to invite {$player->getEscapedUsername()} to {$team->getEscapedName()}?", "Player {$player->getUsername()} has been invited to {$team->getName()}");
}