本文整理汇总了PHP中Invitation::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::insert方法的具体用法?PHP Invitation::insert怎么用?PHP Invitation::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendInvitation
function sendInvitation($email, $user, $personal)
{
$profile = $user->getProfile();
$bestname = $profile->getBestName();
$sitename = common_config('site', 'name');
$invite = new Invitation();
$invite->address = $email;
$invite->address_type = 'email';
$invite->code = common_confirmation_code(128);
$invite->user_id = $user->id;
$invite->created = common_sql_now();
if (!$invite->insert()) {
common_log_db_error($invite, 'INSERT', __FILE__);
return false;
}
$recipients = array($email);
$headers['From'] = mail_notify_from();
$headers['To'] = trim($email);
$headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
$body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n" . "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n" . "You can also share news about yourself, your thoughts, or your life online with people who know about you. " . "It's also great for meeting new people who share your interests.\n\n" . "%1\$s said:\n\n%4\$s\n\n" . "You can see %1\$s's profile page on %2\$s here:\n\n" . "%5\$s\n\n" . "If you'd like to try the service, click on the link below to accept the invitation.\n\n" . "%6\$s\n\n" . "If not, you can ignore this message. Thanks for your patience and your time.\n\n" . "Sincerely, %2\$s\n"), $bestname, $sitename, common_root_url(), $personal, common_local_url('showstream', array('nickname' => $user->nickname)), common_local_url('register', array('code' => $invite->code)));
mail_send($recipients, $headers, $body);
}
示例2: inviteWorkers
public static function inviteWorkers(Expo $expo, $expirationDate, array $workerArray)
{
$body = "Hello FIRSTNAME,\n\nYou are invited to join EXPONAME.\nPlease login and proceed to the following page to register.\n\n" . BASE_URL . "/pages/WorkerRegistrationPage.php";
$paramNames = array("FIRSTNAME", "EXPONAME");
// using NAME and EXPONAME leads to bad results; because NAME might get replaced first!
$body .= "\n\nSincerely,\nThe " . SITE_NAME . " Team";
$welcomeForm = new FormMail(SITE_NAME . " Expo Invitation", $paramNames, $body);
$welcomeParams = array("EXPONAME" => $expo->title);
$invite = new Invitation();
$invite->expoid = $expo->expoid;
$invite->expirationDate = is_null($expirationDate) ? $expo->stopTime : $expirationDate;
foreach ($workerArray as $worker) {
$invite->email = $worker->email;
$invite->workerid = $worker->workerid;
$welcomeParams["FIRSTNAME"] = $worker->firstName;
$invite->insert($welcomeForm, $welcomeParams);
}
// $worker
$invite = NULL;
return;
}
示例3: sendInvitation
function sendInvitation($email, $user, $personal)
{
$profile = $user->getProfile();
$bestname = $profile->getBestName();
$sitename = common_config('site', 'name');
$invite = new Invitation();
$invite->address = $email;
$invite->address_type = 'email';
$invite->code = common_confirmation_code(128);
$invite->user_id = $user->id;
$invite->created = common_sql_now();
if (!$invite->insert()) {
common_log_db_error($invite, 'INSERT', __FILE__);
return false;
}
$confirmUrl = common_local_url('register', array('code' => $invite->code));
$recipients = array($email);
$headers['From'] = mail_notify_from();
$headers['To'] = trim($email);
$headers['Content-Type'] = 'text/html; charset=UTF-8';
// TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral
// TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is
// TRANS: the StatusNet sitename.
$headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
$title = empty($personal) ? 'invite' : 'invitepersonal';
// @todo FIXME: i18n issue.
$inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths());
$body = $inviteTemplate->toHTML(array('inviter' => $bestname, 'inviterurl' => $profile->profileurl, 'confirmurl' => $confirmUrl, 'personal' => $personal));
common_debug('Confirm URL is ' . common_local_url('register', array('code' => $invite->code)));
mail_send($recipients, $headers, $body);
}