当前位置: 首页>>代码示例>>PHP>>正文


PHP Invitation::send方法代码示例

本文整理汇总了PHP中Invitation::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::send方法的具体用法?PHP Invitation::send怎么用?PHP Invitation::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Invitation的用法示例。


在下文中一共展示了Invitation::send方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handlePOST_inviteSelected

 private function handlePOST_inviteSelected($request_data)
 {
     $message = trim($request_data['message']);
     if (empty($message)) {
         $msg = __("Invite message can't be empty.");
     } else {
         $msg = null;
         $message = nl2br($message);
         $selected_contacts = !empty($request_data['invite_selected']) ? $request_data['invite_selected'] : null;
         if ($selected_contacts) {
             foreach ($selected_contacts as $key => $cntct_id) {
                 $contact = $this->contacts[$key];
                 // selected index = contacts index
                 $inv = new Invitation();
                 $inv->user_id = PA::$login_uid;
                 $inv->username = PA::$login_user->login_name;
                 $user = PA::$login_user;
                 // for invitation not for any group invitation collection id is -1
                 $inv->inv_collection_id = -1;
                 $inv->inv_status = INVITATION_PENDING;
                 $auth_token = get_invitation_token(LONG_EXPIRES, $contact['email']);
                 $token = '&token=' . $auth_token;
                 $link_desc = wordwrap(PA::$url . "/register.php?InvID={$inv->inv_id}", 120, "<br>", 1);
                 $inv->register_url = "<a href=\"" . PA::$url . "/register.php?InvID={$inv->inv_id}\">{$link_desc}</a>";
                 $acc_link_desc = wordwrap(PA::$url . "/login.php?action=accept&InvID={$inv->inv_id}{$token}", 120, "<br>", 1);
                 $inv->accept_url = "<a href=\"" . PA::$url . "/login.php?action=accept&InvID={$inv->inv_id}{$token}\">{$acc_link_desc}</a>";
                 $inv->inv_user_id = NULL;
                 $inv->inv_user_first_name = $contact['name'];
                 $inv->inv_email = $contact['email'];
                 $inv->inv_summary = "Invitation from {$user->first_name} {$user->last_name} to join " . PA::$site_name;
                 if ($message != CUSTOM_INVITATION_MESSAGE) {
                     $inv->inv_message = !empty($message) ? $message : null;
                 }
                 try {
                     $inv->send();
                 } catch (PAException $e) {
                     $msg = "{$e->message}";
                     $save_error = true;
                 }
                 if (isset($save_error) && $save_error == true) {
                     $msg = "Sorry: you are unable to invite a friend. <br /> Reason: " . $msg;
                 } else {
                     // invitation has been sent, now send mail
                     PAMail::send('invite_pa', $inv->inv_email, PA::$login_user, $inv);
                     $msg .= "<br />" . $contact['name'] . ", " . $contact['email'];
                 }
             }
             // end for : invitation to multiple email
             $msg = "<br />Invitation message has been sent to: " . $msg;
         } else {
             $msg = __("Please, select one or more contacts.");
         }
     }
     $redirect_url = PA::$url . PA_ROUTE_USER_CONTACTS . "?type=contacts&stype=" . $this->type . "&msg=" . urlencode($msg);
     $this->controller->redirect($redirect_url);
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:56,代码来源:UserContactsModule.php

示例2: handlePOST_GroupInvitationSubmit


//.........这里部分代码省略.........
                         $invalid_cnt = count($invalid);
                         $invalid_msg = '';
                         for ($counter = 0; $counter < $invalid_cnt; $counter++) {
                             if (!empty($invalid[$counter])) {
                                 $invalid_msg .= $invalid[$counter] . ', ';
                             }
                         }
                         if (!empty($invalid_msg)) {
                             $invalid_msg = substr($invalid_msg, 0, -2);
                             $msg[] = sprintf(__('Invitation could not be sent to following email addresses- %s'), $invalid_msg);
                         }
                     }
                 }
             }
         }
         if (empty($error)) {
             // At this point invitation could be made
             if (!empty($valid_email) && !empty($valid_usr_name_email)) {
                 $valid_email = array_merge($valid_email, $valid_usr_name_email);
                 $valid_user_first_emails = array_merge($valid_user_first_emails, $valid_user_login_names);
             } else {
                 if (!empty($valid_usr_name_email)) {
                     $valid_email = $valid_usr_name_email;
                     $valid_user_first_emails = $valid_user_login_names;
                 }
             }
             if (!empty($valid_email)) {
                 $valid_cnt = count($valid_email);
                 $invitation_message = nl2br($request_data['message']);
                 for ($counter = 0; $counter < $valid_cnt; $counter++) {
                     $group = new Group();
                     $group->load((int) $gid);
                     $inv = new Invitation();
                     $inv->user_id = PA::$login_uid;
                     $inv->username = PA::$login_user->login_name;
                     // for invitation not for any group invitation collection id is -1
                     $inv->inv_collection_id = $gid;
                     $inv->inv_group_name = $group->title;
                     $inv->inv_status = INVITATION_PENDING;
                     $auth_token = get_invitation_token(LONG_EXPIRES, $valid_email[$counter]);
                     $token = '&amp;token=' . $auth_token;
                     $link_desc = wordwrap(PA::$url . '/' . FILE_REGISTER . "?GInvID={$inv->inv_id}", 120, "<br>", 1);
                     $inv->register_url = "<a href=\"" . PA::$url . '/' . FILE_REGISTER . "?GInvID={$inv->inv_id}\">{$link_desc}</a>";
                     $acc_link_desc = wordwrap(PA::$url . "/" . FILE_LOGIN . "?action=accept&GInvID={$inv->inv_id}{$token}", 120, "<br>", 1);
                     $inv->accept_url = "<a href=\"" . PA::$url . "/" . FILE_LOGIN . "?action=accept&GInvID={$inv->inv_id}{$token}\">{$acc_link_desc}</a>";
                     $inv->inv_user_id = null;
                     $inv->inv_user_first_name = $valid_user_first_emails[$counter];
                     $inv->inv_email = $valid_email[$counter];
                     $inv->inv_summary = sprintf(__("Invitation from %s %s to join %s"), PA::$login_user->first_name, PA::$login_user->last_name, $inv->inv_group_name);
                     $inv->inv_message = !empty($invitation_message) ? $invitation_message : null;
                     $save_error = false;
                     try {
                         $inv->send();
                     } catch (PAException $e) {
                         $save_msg = "{$e->message}";
                         $save_error = true;
                     }
                     if ($save_error == true) {
                         $msg[] = sprintf(__('Sorry: you are unable to invite a friend.  Reason: %s'), $sav_msg);
                     } else {
                         // invitation has been sent, now send email
                         $user_type = Group::get_user_type(PA::$login_uid, $gid);
                         if ($user_type == OWNER) {
                             $mail_type = 'invite_group';
                             $requester = $group;
                         } else {
                             if ($user_type == MEMBER) {
                                 $mail_type = 'invite_group_by_member';
                                 $requester = PA::$login_user;
                             }
                         }
                         PAMail::send($mail_type, $inv->inv_email, $requester, $inv);
                         $succ_msg .= $valid_user_first_emails[$counter] . ', ';
                         if ($counter == $valid_cnt - 1) {
                             $succ_msg = substr($succ_msg, 0, -2);
                             //$msg_1[] = "Invitation has been sent successfully to -" . $succ_msg;
                         }
                     }
                 }
                 // end for : invitation to multiple email
             }
         }
     }
     //..do invite
     if (!empty($msg)) {
         $msg = array_reverse($msg);
         $message = NULL;
         for ($counter = 0; $counter < count($msg); $counter++) {
             $message .= $msg[$counter] . "<br />";
         }
     }
     $msg_array = array();
     $msg_array['failure_msg'] = $message;
     $msg_array['success_msg'] = 6004;
     $redirect_url = PA::$url . PA_ROUTE_GROUP;
     if (!empty($request_data['groups'])) {
         $query_str = "gid=" . $request_data['groups'];
     }
     set_web_variables($msg_array, $redirect_url, $query_str);
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:GroupInvitationModule.php

示例3: catch

                        $inv->inv_user_first_name = $u->first_name;
                        $inv->inv_user_last_name = $u->last_name;
                        $inv->inv_email = NULL;
                    } catch (PAException $e) {
                        $err = 'No such user registered with PA';
                    }
                } else {
                    $inv->inv_user_id = NULL;
                    $inv->inv_username = NULL;
                    $inv->inv_user_first_name = $fName;
                    $inv->inv_user_last_name = $lName;
                    $inv->inv_email = $invEmail;
                }
                $inv->inv_message = $mesg;
                if (!$err) {
                    $inv->send();
                    $msg = "Your invitation has been sent.";
                }
            }
            break;
        case 'accept':
            $inv = Invitation::load($_GET['group_InvID']);
            $inv->accept();
            header("Location: " . $base_url . "/groupmembers.php?action=join&gid=" . $inv->inv_collection_id);
            break;
        case 'deny':
            $inv = Invitation::load($_GET['group_InvID']);
            $inv->deny();
            $msg = "Your denial has been sent to the group owner.";
    }
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:groupinvite.php

示例4: handlePOSTPageSubmit


//.........这里部分代码省略.........
             // if email field is left empty
             if (PA::$network_info->type == MOTHER_NETWORK_TYPE) {
                 $msg = 6003;
             } else {
                 $msg = 6001;
             }
             $error_email = TRUE;
             $error = TRUE;
         } else {
             if (!empty($friend_email) && !empty($friend_user_name)) {
                 $msg = 7026;
                 $error = TRUE;
             } else {
                 if (!empty($self_invite)) {
                     // if self invitation is made
                     $msg = 6002;
                     $error_email = TRUE;
                     $error = TRUE;
                 } else {
                     if (sizeof($invalid) > 0) {
                         // if invalid email addresses are supplied
                         $invalid_cnt = count($invalid);
                         $msg = '';
                         for ($counter = 0; $counter < $invalid_cnt; $counter++) {
                             if (!empty($invalid[$counter])) {
                                 $msg .= '<br />' . $invalid[$counter];
                             }
                         }
                         if (!empty($msg)) {
                             $msg = sprintf(__('Following email addresses are not valid: %s'), $msg);
                         } else {
                             $msg = __(' Invalid Email addresses');
                         }
                         $error_email = TRUE;
                         $error = TRUE;
                     } else {
                         if (empty($msg)) {
                             // At this point invitation could be made
                             $msg = '';
                             if (!empty($valid_email) && !empty($valid_usr_name_email)) {
                                 $valid_email = array_merge($valid_email, $valid_usr_name_email);
                                 $valid_user_first_emails = array_merge($valid_user_first_emails, $valid_user_login_names);
                             } else {
                                 if (!empty($valid_usr_name_email)) {
                                     $valid_email = $valid_usr_name_email;
                                     $valid_user_first_emails = $valid_user_login_names;
                                 }
                             }
                             $valid_cnt = count($valid_email);
                             $message = nl2br($request_data['message']);
                             for ($counter = 0; $counter < $valid_cnt; $counter++) {
                                 $inv = new Invitation();
                                 $inv->user_id = PA::$login_user->user_id;
                                 $inv->username = PA::$login_user->login_name;
                                 // for invitation not for any group invitation collection id is -1
                                 $inv->inv_collection_id = -1;
                                 $inv->inv_status = INVITATION_PENDING;
                                 $auth_token = get_invitation_token(LONG_EXPIRES, $valid_email[$counter]);
                                 $token = '&amp;token=' . $auth_token;
                                 $inv->register_url = PA::$url . "/" . FILE_REGISTER . "?InvID={$inv->inv_id}";
                                 $inv->accept_url = PA::$url . "/" . FILE_LOGIN . "?action=accept&InvID={$inv->inv_id}{$token}";
                                 $inv->inv_user_id = NULL;
                                 $inv->inv_user_first_name = $valid_user_first_emails[$counter];
                                 $inv->inv_email = $valid_email[$counter];
                                 $inv->inv_summary = 'Invitation from' . PA::$login_user->first_name . ' ' . PA::$login_user->last_name . ' to join ' . PA::$site_name;
                                 if ($message != CUSTOM_INVITATION_MESSAGE) {
                                     $inv->inv_message = !empty($message) ? $message : NULL;
                                 }
                                 if (empty($error)) {
                                     try {
                                         $inv->send();
                                     } catch (PAException $e) {
                                         $msg = "{$e->message}";
                                         $save_error = TRUE;
                                     }
                                 }
                                 if (isset($save_error) && $save_error == TRUE) {
                                     $msg = sprintf(__('Sorry: you are unable to invite a friend. Reason: %s'), $msg);
                                 } else {
                                     // invitation has been sent, now send mail
                                     PAMail::send('invite_pa', $inv->inv_email, PA::$login_user, $inv);
                                     $msg .= $valid_user_first_emails[$counter];
                                     if ($counter == $valid_cnt - 1) {
                                         $msg = sprintf(__('An Invitation has been sent to - %s'), $msg);
                                     }
                                 }
                             }
                             // end for : invitation to multiple email
                         }
                     }
                 }
             }
         }
         $this->message = $msg;
         $this->redirect2 = NULL;
         $this->queryString = NULL;
         $this->isError = TRUE;
         $this->setWebPageMessage();
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:InvitationModule.php


注:本文中的Invitation::send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。