當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Invitation::insert方法代碼示例

本文整理匯總了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);
 }
開發者ID:himmelex,項目名稱:NTW,代碼行數:22,代碼來源:invite.php

示例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;
 }
開發者ID:ConSked,項目名稱:scheduler,代碼行數:21,代碼來源:Invitation.php

示例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);
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:31,代碼來源:invite.php


注:本文中的Invitation::insert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。