本文整理汇总了PHP中Invitation类的典型用法代码示例。如果您正苦于以下问题:PHP Invitation类的具体用法?PHP Invitation怎么用?PHP Invitation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Invitation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:nikonehauser,项目名称:pt,代码行数:9,代码来源:Invitation.php
示例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;
}
开发者ID:nikonehauser,项目名称:ptclient,代码行数:11,代码来源:Invitation.php
示例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();
}
开发者ID:nikonehauser,项目名称:ptclient,代码行数:34,代码来源:InvitationTest.php
示例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']);
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:7,代码来源:invite.php
示例5: GetInstance
static function GetInstance()
{
if (self::$instance == NULL) {
self::$instance = new Invitation();
}
return self::$instance;
}
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:7,代码来源:class.invitation.php
示例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')]);
}
开发者ID:franiglesias,项目名称:broadway,代码行数:10,代码来源:InvitesTest.php
示例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' );
}
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:39,代码来源:SpecialInvitationCode.php
示例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);
}
}
开发者ID:adamcarter93,项目名称:university-final-year-project-rest-api,代码行数:33,代码来源:invitations.php
示例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');
}
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:56,代码来源:SendRecurringInvoices.php
示例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']);
}
开发者ID:nikonehauser,项目名称:pt,代码行数:10,代码来源:account.controller.php
示例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');
}
开发者ID:mertindervish,项目名称:registerbg,代码行数:16,代码来源:AdminUserController.php
示例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);
}
开发者ID:nikonehauser,项目名称:pt,代码行数:12,代码来源:account.invitation.tab.view.php
示例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' => 'Поканата не е намерена.'));
}
}
开发者ID:mertindervish,项目名称:registerbg,代码行数:19,代码来源:AdminInvitationController.php
示例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);
}
开发者ID:stewartadam,项目名称:invoice-ninja,代码行数:14,代码来源:QuoteController.php
示例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()}");
}
开发者ID:kleitz,项目名称:bzion,代码行数:15,代码来源:InvitationController.php
示例16: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if (MODULE_INVITATION) {
if ($eventName === 'readParameters') {
if (isset($_GET['invitationCode']) && !empty($_GET['invitationCode'])) {
$eventObj->additionalFields['invitationCode'] = intval($_GET['invitationCode']);
self::$invitation = new InvitationEditor(null, null, $eventObj->additionalFields['invitationCode']);
} else {
$eventObj->additionalFields['invitationCode'] = '';
}
if (isset($_GET['email']) && !empty($_GET['email'])) {
$eventObj->email = $_GET['email'];
}
} else {
if ($eventName === 'readFormParameters') {
if (isset($_POST['invitationCode']) && !empty($_POST['invitationCode'])) {
$eventObj->additionalFields['invitationCode'] = intval($_POST['invitationCode']);
self::$invitation = new InvitationEditor(null, null, $eventObj->additionalFields['invitationCode']);
}
} else {
if ($eventName === 'assignVariables') {
WCF::getTPL()->assign('invitationCode', $eventObj->additionalFields['invitationCode']);
} else {
if ($eventName === 'show') {
WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('registerInviteField'));
} else {
if ($eventName === 'validate') {
try {
if (REGISTER_INVITATION_NECESSARY && empty($eventObj->additionalFields['invitationCode'])) {
throw new UserInputException('invitationCode');
}
if (!Invitation::isValid($eventObj->email, $eventObj->additionalFields['invitationCode'])) {
throw new UserInputException('invitationCode', 'false');
}
} catch (UserInputException $e) {
$eventObj->errorType[$e->getField()] = $e->getType();
}
} else {
if ($eventName === 'saved') {
self::$invitation->seal();
}
}
}
}
}
}
}
}
开发者ID:0xLeon,项目名称:com.leon.wcf.form.user.invitation,代码行数:51,代码来源:RegisterFormInviteListener.class.php
示例17: setup_module
function setup_module($column, $module, $obj)
{
global $login_uid, $paging, $page_uid, $page_user, $total_groups;
switch ($module) {
// TODO Remove the Search Module ...
case 'SearchGroupsModule':
return "skip";
break;
case 'MyGroupsModule':
if (!$login_uid) {
return "skip";
}
if ($page_uid && $page_uid != $login_uid) {
$obj->uid = $page_uid;
$page_user = get_user();
$obj->title = ucfirst($page_user->first_name) . '\'s Groups';
$obj->user_name = $page_user->login_name;
} else {
$obj->uid = $login_uid;
}
// get pending group invitations for the logged-in user.
$obj->mode = PUB;
$pending_invitations = Invitation::get_pending_invitations_for_user_by_email($_SESSION["user"]["email"], $login_uid);
$obj->pending_invitations = $pending_invitations;
$obj->Paging["page"] = $paging["page"];
$obj->Paging["show"] = $paging["show"];
break;
case 'GroupsCategoryModule':
$obj->mode = PUB;
$obj->total_groups = $total_groups;
break;
case 'GroupsDirectoryModule':
$obj->Paging["page"] = $paging["page"];
$obj->Paging["show"] = $paging["show"];
$obj->total_groups = $total_groups;
$obj->sort_by = @$_GET['sort_by'];
if (@$_GET['keyword']) {
$obj->name_string = $_GET['name_string'];
$obj->keyword = $_GET['keyword'];
$obj->uid = @$_GET['uid'];
}
if (@$_GET['uid']) {
$obj->uid = $_GET['uid'];
}
break;
}
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:47,代码来源:groups_home.php
示例18: render
function render()
{
// invite status
// if we have array of collection ids then find the invitation of each collection (group)
if (is_array($this->collection_id_array) && count($this->collection_id_array) > 0) {
$accepted = Invitation::get_accepted_invitations($_SESSION['user']['id'], '-1', $this->collection_id_array);
} else {
$accepted = Invitation::get_accepted_invitations($_SESSION['user']['id']);
}
$accepted_invitation = array();
if (!empty($accepted)) {
$i = 0;
foreach ($accepted as $ac) {
$inv_user = new User();
$inv_user->load((int) $ac['inv_user_id']);
$accepted_invitation[$i]['user_name'] = $inv_user->login_name;
$accepted_invitation[$i]['first_name'] = $inv_user->first_name;
$accepted_invitation[$i]['last_name'] = $inv_user->last_name;
$accepted_invitation[$i]['picture'] = $inv_user->picture;
$accepted_invitation[$i]['user_id'] = $inv_user->user_id;
$i++;
}
}
// if we have array of collection ids then find the invitation of each collection (group)
if (is_array($this->collection_id_array) && count($this->collection_id_array) > 0) {
$pending = Invitation::get_pending_invitations($_SESSION['user']['id'], '-1', $this->collection_id_array);
} else {
$pending = Invitation::get_pending_invitations($_SESSION['user']['id']);
}
$pending_invitation = array();
if (!empty($pending)) {
$i = 0;
foreach ($pending as $pe) {
$pending_invitation[$i]['user_email'] = $pe['inv_user_email'];
$i++;
}
}
$this->accepted_invitation = $accepted_invitation;
$this->pending_invitation = $pending_invitation;
$this->inner_HTML = $this->generate_inner_html();
$content = parent::render();
return $content;
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:43,代码来源:InvitationStatusModule.php
示例19: handle
/**
* Handle the site
*
* @param array $remitem type of reminder to send and any special options
* @return boolean true on success, false on failure
*/
function handle($remitem)
{
list($type, $opts) = $remitem;
$qm = QueueManager::get();
try {
switch ($type) {
case UserConfirmRegReminderHandler::REGISTER_REMINDER:
$confirm = new Confirm_address();
$confirm->address_type = $type;
$confirm->find();
while ($confirm->fetch()) {
try {
$qm->enqueue(array($confirm, $opts), 'uregrem');
} catch (Exception $e) {
common_log(LOG_WARNING, $e->getMessage());
continue;
}
}
break;
case UserInviteReminderHandler::INVITE_REMINDER:
$invitation = new Invitation();
// Only send one reminder (the latest one), regardless of how many invitations a user has
$sql = 'SELECT * FROM (SELECT * FROM invitation WHERE registered_user_id IS NULL ORDER BY created DESC) invitees GROUP BY invitees.address';
$invitation->query($sql);
while ($invitation->fetch()) {
try {
$qm->enqueue(array($invitation, $opts), 'uinvrem');
} catch (Exception $e) {
common_log(LOG_WARNING, $e->getMessage());
continue;
}
}
break;
default:
// WTF?
common_log(LOG_ERR, "Received unknown confirmation address type", __FILE__);
}
} catch (Exception $e) {
common_log(LOG_ERR, $e->getMessage());
return false;
}
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:49,代码来源:siteconfirmreminderhandler.php
示例20: 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;
}
开发者ID:nikonehauser,项目名称:ptclient,代码行数:19,代码来源:helper.php
注:本文中的Invitation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论