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


PHP Invitation::load方法代码示例

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


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

示例1: header

                    $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.";
    }
}
$header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('user_name', $user->first_name . ' ' . $user->last_name);
$left_page =& new Template(CURRENT_THEME_FSPATH . "/left_page.tpl");
$left_page->set('img_path', $img_path);
$center_content =& new Template(CURRENT_THEME_FSPATH . "/groupinvite.tpl");
$center_content->set('content_details', $content_details);
$center_content->set('user_details', $user_details);
$center_content->set('group_id', $group_details['id']);
$center_content->set('group_title', $group_details['title']);
$center_content->set('message', $msg);
$center_content->set('error', $err);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:groupinvite.php

示例2: handleGET_join

 private function handleGET_join($request_data)
 {
     require_once "api/Activities/Activities.php";
     global $error_msg;
     if (PA::$login_uid && !empty($this->shared_data['group_info'])) {
         $group = $this->shared_data['group_info'];
         if (!Group::member_exists((int) $request_data['gid'], (int) PA::$login_uid)) {
             $user = PA::$login_user;
             $login_name = $user->login_name;
             $group_invitation_id = !empty($request_data['GInvID']) ? $request_data['GInvID'] : null;
             try {
                 $user_joined = $group->join((int) PA::$login_uid, $user->email, $group_invitation_id);
                 // for rivers of people
                 $activity = 'group_joined';
                 //for rivers of people
                 $activity_extra['info'] = $login_name . ' joined a new group';
                 $activity_extra['group_name'] = $group->title;
                 $activity_extra['group_id'] = $request_data['gid'];
                 $extra = serialize($activity_extra);
                 $object = $request_data['gid'];
                 Activities::save(PA::$login_uid, $activity, $object, $extra);
                 if (!empty($group_invitation_id)) {
                     // if group is joined through group invitation
                     $Ginv = Invitation::load($group_invitation_id);
                     $gid = $Ginv->inv_collection_id;
                     $user_obj = new User();
                     $user_obj->load((int) $Ginv->user_id);
                     $group = ContentCollection::load_collection((int) $gid, $Ginv->user_id);
                     $user_type = Group::get_user_type($user_obj->user_id, $gid);
                     if ($group->reg_type == REG_MODERATED && $user_type == OWNER) {
                         $group->collection_id = $gid;
                         $group->approve(PA::$login_uid, 'user');
                     }
                     $user_accepting_ginv_obj = new User();
                     $user_accepting_ginv_obj->load((int) PA::$login_uid);
                     $Ginv->inv_user_id = PA::$login_uid;
                     PANotify::send("invite_accept_group", $user_obj, $user_accepting_ginv_obj, $Ginv);
                 }
             } catch (PAException $e) {
                 if ($e->code == GROUP_NOT_INVITED) {
                     $error_msg = $e->message;
                     //          header("Location: groups_home.php");
                     //          exit;
                 }
                 $error_msg = $e->message;
             }
         } else {
             $error_msg = sprintf(__("You are already a member of \"%s\""), stripslashes($group->title));
         }
         if (@$user_joined) {
             // deal with TypedGroup Relations
             require_once "api/Entity/TypedGroupEntityRelation.php";
             $uid = PA::$login_uid;
             $gid = $group->collection_id;
             $type = @$request_data['relation'];
             try {
                 TypedGroupEntityRelation::set_relation($uid, $gid, $type);
             } catch (PAException $e) {
                 $error_msg = $e->getMessage();
             }
             $gid = (int) $request_data['gid'];
             if (!Group::member_exists($gid, (int) PA::$login_uid) && $group->reg_type == REG_MODERATED) {
                 // if it is a manual join not an invited join
                 $mail_type = 'group_join_request';
                 $error_msg = sprintf(__("Your request to join \"%s\" has been submitted to the owner of the group."), stripslashes($group->title));
             } else {
                 $mail_type = 'group_join';
                 $error_msg = sprintf(__("You have joined \"%s\" successfully."), stripslashes($group->title));
             }
             PANotify::send($mail_type, $group, PA::$login_user, array());
             if ($type == 'child') {
                 // if user type == child remove LoginUser and GroupMember roles
                 PA::$login_user->delete_user_role();
                 // then assign 'Child' role only
                 $_extra = serialize(array('user' => false, 'network' => false, 'groups' => array($gid)));
                 $user_roles[] = array('role_id' => CHILD_MEMBER_ROLE, 'extra' => $_extra);
                 PA::$login_user->set_user_role($user_roles);
             }
         }
     } else {
         // redirect to login
         $msg = urlencode(__("You need to be logged in to join a group."));
         header("Location: " . PA::$url . "/login.php?" . $msg . "&return=" . urlencode($_SERVER['REDIRECT_URL'] . '?' . @$_SERVER['REDIRECT_QUERY_STRING']));
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:85,代码来源:FamilyModule.php

示例3: header

         $error = TRUE;
         print $msg;
     }
     if (!empty($gid)) {
         header("Location: " . PA::$url . PA_ROUTE_GROUP . "/gid={$gid}&action=join&GInvID={$group_invitation_id}");
     }
     exit;
 }
 if (!empty($_GET['InvID'])) {
     $invitation_id = $_GET['InvID'];
     try {
         $new_invite = new Invitation();
         $new_invite->inv_id = $invitation_id;
         $new_invite->inv_user_id = $_SESSION['user']['id'];
         $new_invite->accept();
         $inv_obj = Invitation::load($invitation_id);
         $user_obj = new User();
         $user_obj->load((int) $inv_obj->user_id);
         $user_accepting_inv_obj = new User();
         $user_accepting_inv_obj->load((int) $_SESSION['user']['id']);
         $relation_type_id = Relation::get_relation((int) $inv_obj->user_id, (int) $user_accepting_inv_obj->user_id, PA::$network_info->network_id);
         $relation_type = Relation::lookup_relation_type($relation_type_id);
         $new_invite->inv_relation_type = $relation_type;
         PANotify::send("invitation_accept", $user_obj, $user_accepting_inv_obj, $new_invite);
         if (!Network::member_exists(PA::$network_info->network_id, (int) $_SESSION['user']['id'])) {
             Network::join(PA::$network_info->network_id, $_SESSION['user']['id']);
             PANotify::send("network_join", PA::$network_info, $user_accepting_inv_obj, array());
         }
         header("Location: " . PA::$url . PA_ROUTE_USER_PRIVATE . '/' . "msg_id=7016");
         exit;
     } catch (CNException $e) {
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:31,代码来源:cnuser_login.php

示例4: validate_group_invitation_id

 public static function validate_group_invitation_id($invitation_id)
 {
     Logger::log("Enter: Invitation::validate_invitation_id() | Args: \$invitation_id = {$invitation_id}");
     $valid = Invitation::validate_invitation_id($invitation_id);
     if (!$valid) {
         return false;
     }
     //get collection_id
     $Ginv = Invitation::load($invitation_id);
     //find if group is deleted or not
     $g = Group::load_group_by_id($Ginv->inv_collection_id);
     if (!$g) {
         return false;
     }
     //if we have come this far it means invitaion id is valid and  group is active
     Logger::log("Exit: Invitation::validate_invitation_id() | Args: \$invitation_id = {$invitation_id}");
     return true;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:18,代码来源:Invitation.php

示例5: catch

             $is_valid_ginv = Invitation::validate_group_invitation_id($group_invitation_id);
             if (!$is_valid_ginv) {
                 $msg = 3001;
             }
         } catch (PAException $e) {
             $inv_error = "{$e->message}";
         }
         if (empty($msg)) {
             //if group invitation is valid, and no error yet
             try {
                 $new_invite = new Invitation();
                 $new_invite->inv_id = $group_invitation_id;
                 $new_invite->inv_user_id = $newuser->user_id;
                 $new_invite->accept();
                 //get collection_id
                 $Ginv = Invitation::load($group_invitation_id);
                 $gid = $Ginv->inv_collection_id;
             } catch (PAException $e) {
                 $inv_error = "{$e->message}";
             }
             $redirect_url = "group.php?gid={$gid}&action=join&GInvID={$group_invitation_id}";
         } else {
             //else redirect registered user to its page.
             $redirect_url = "user.php?msg_id=7014";
         }
         // end of if group invitation is valid
     } else {
         $redirect_url = "user.php?msg_id=7014";
     }
 }
 header("Location: {$base_url}/{$redirect_url}");
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:mail_action.php

示例6: handle_join

 function handle_join()
 {
     $error_inv = false;
     $invitation_id = isset($_REQUEST['InvID']) ? $_REQUEST['InvID'] : null;
     $group_invitation_id = isset($_REQUEST['GInvID']) ? $_REQUEST['GInvID'] : null;
     $mother_network_info = Network::get_mothership_info();
     $extra = unserialize($mother_network_info->extra);
     if (!$this->reg_user->register($_POST, PA::$network_info)) {
         // registration failed
         return;
     }
     // If the user is joining a network other than the
     if ($mother_network_info->network_id != PA::$network_info->network_id) {
         Network::join(1, $this->reg_user->newuser->user_id, NETWORK_MEMBER);
     }
     if ($extra['email_validation'] == NET_NO || $this->silent) {
         // silent registration - no email validation!
         // Success!
         if (!$this->silent) {
             register_session($this->reg_user->newuser->login_name, $this->reg_user->newuser->user_id, $this->reg_user->newuser->role, $this->reg_user->newuser->first_name, $this->reg_user->newuser->last_name, $this->reg_user->newuser->email, $this->reg_user->newuser->picture);
             $_SESSION['login_source'] = 'password';
             // password recently entered, so enable access to edit profile
             PANotify::send("new_user_registered", PA::$network_info, $this->reg_user->newuser, array());
         }
         if ($invitation_id) {
             // if an invitation to join a network
             $this->inv_error = "";
             $is_valid = Invitation::validate_invitation_id($invitation_id);
             if (!$is_valid) {
                 $msg = 7017;
                 // invalid network invitation
             }
             if (empty($msg)) {
                 try {
                     // try to except invitation
                     $new_invite = new Invitation();
                     $new_invite->inv_id = $invitation_id;
                     $new_invite->inv_user_id = $this->reg_user->newuser->user_id;
                     $new_invite->accept();
                     $inv_obj = Invitation::load($invitation_id);
                     $user_obj = new User();
                     $user_obj->load((int) $inv_obj->user_id);
                     //if invitation is for private network
                     if (PA::$network_info->type == PRIVATE_NETWORK_TYPE) {
                         $user_type = NULL;
                         if (PA::$network_info->owner_id == $inv_obj->user_id) {
                             $user_type = NETWORK_MEMBER;
                         }
                         Network::join(PA::$network_info->network_id, $this->reg_user->newuser->user_id, $user_type);
                     }
                     $msg = 7016;
                     $relation_type = null;
                     $relationship_level = 2;
                     //default relation level id is 2 for friend
                     try {
                         $relation_type_id = Relation::get_relation((int) $inv_obj->user_id, (int) $this->reg_user->newuser->user_id, PA::$network_info->network_id);
                     } catch (PAException $e) {
                         Relation::add_relation((int) $inv_obj->user_id, (int) $this->reg_user->newuser->user_id, $relationship_level, PA::$network_info->address, PA::$network_info->network_id, NULL, NULL, NULL, true, APPROVED);
                         $relation_type = Relation::lookup_relation_type($relation_type_id);
                     }
                     $new_invite->inv_relation_type = $relation_type;
                     if (!$this->silent) {
                         PANotify::send("invitation_accept", $user_obj, $this->reg_user->newuser, $new_invite);
                     }
                 } catch (PAException $e) {
                     $this->inv_error = $e->message;
                     $this->reg_user->msg = "{$e->message}";
                     $error_inv = TRUE;
                 }
                 if ($error_inv == TRUE) {
                     // if invitation fails, then do login again
                     header("Location: " . PA::$url . "/login.php?msg=" . $this->reg_user->msg . "&return={$return_url}");
                     exit;
                 }
             }
             $redirect_url = PA_ROUTE_HOME_PAGE . '/msg=' . $msg;
         } else {
             if ($group_invitation_id) {
                 // if an invitation to join a group
                 // User registration is in response to a group invitation, so
                 // now that the user is registered, handle the group invitation.
                 try {
                     $is_valid_ginv = Invitation::validate_group_invitation_id($group_invitation_id);
                     if (!$is_valid_ginv) {
                         $msg = 3001;
                     }
                 } catch (PAException $e) {
                     $this->inv_error = "{$e->message}";
                 }
                 if (empty($msg)) {
                     //if group invitation is valid, and no error yet
                     try {
                         $new_invite = new Invitation();
                         $new_invite->inv_id = $group_invitation_id;
                         $new_invite->inv_user_id = $this->reg_user->newuser->user_id;
                         $new_invite->accept();
                         //get collection_id
                         $Ginv = Invitation::load($group_invitation_id);
                         $gid = $Ginv->inv_collection_id;
                         $relationship_level = 2;
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:RegistrationPage.php

示例7: handle_join

 function handle_join()
 {
     global $network_info;
     $invitation_id = isset($_REQUEST['InvID']) ? $_REQUEST['InvID'] : null;
     $group_invitation_id = isset($_REQUEST['GInvID']) ? $_REQUEST['GInvID'] : null;
     $mother_network_info = Network::get_mothership_info();
     $extra = unserialize($mother_network_info->extra);
     if (!$this->reg_user->register($_POST, $network_info)) {
         // registration failed
         return;
     }
     if ($extra['email_validation'] == NET_NO) {
         // Success!
         register_session($this->reg_user->newuser->login_name, $this->reg_user->newuser->user_id, $this->reg_user->newuser->role, $this->reg_user->newuser->first_name, $this->reg_user->newuser->last_name, $this->reg_user->newuser->email, $this->reg_user->newuser->picture);
         if ($invitation_id) {
             // if an invitation to join a network
             $this->inv_error = "";
             $is_valid = Invitation::validate_invitation_id($invitation_id);
             if (!$is_valid) {
                 $msg = 7017;
                 // invalid network invitation
             }
             if (empty($msg)) {
                 try {
                     // try to except invitation
                     $new_invite = new Invitation();
                     $new_invite->inv_id = $invitation_id;
                     $new_invite->inv_user_id = $this->reg_user->newuser->user_id;
                     $new_invite->accept();
                     $inv_obj = Invitation::load($invitation_id);
                     $user_obj = new User();
                     $user_obj->load((int) $inv_obj->user_id);
                     //if invitation is for private network
                     if ($network_info->type == PRIVATE_NETWORK_TYPE) {
                         $user_type = NULL;
                         if ($network_info->owner_id == $inv_obj->user_id) {
                             $user_type = NETWORK_MEMBER;
                         }
                         Network::join($network_info->network_id, $this->reg_user->newuser->user_id, $user_type);
                     }
                     $msg = 7016;
                     $relation_type_id = Relation::get_relation((int) $inv_obj->user_id, (int) $this->reg_user->newuser->user_id);
                     $relation_type = Relation::lookup_relation_type($relation_type_id);
                     $invited_user_url = url_for('user_blog', array('login' => $this->reg_user->newuser->login_name));
                     // data for passing in common mail method
                     $array_of_data = array('first_name' => $this->reg_user->newuser->first_name, 'last_name' => $this->reg_user->newuser->last_name, 'user_name' => $this->reg_user->newuser->login_name, 'user_id' => $this->reg_user->newuser->user_id, 'invited_user_id' => $inv_obj->user_id, 'invited_user_name' => $user_obj->login_name, 'mail_type' => 'invite_accept_pa', 'to' => $user_obj->email, 'network_name' => $network_info->name, 'relation_type' => $relation_type, 'config_site_name' => PA::$site_name, 'invited_user_url' => $invited_user_url);
                     auto_email_notification_members('invitation_accept', $array_of_data);
                 } catch (PAException $e) {
                     $this->inv_error = $e->message;
                     $this->reg_user->msg = "{$e->message}";
                     $error_inv = TRUE;
                 }
                 if ($error_inv == TRUE) {
                     // if invitation fails, then do login again
                     header("Location: " . PA::$url . "/login.php?msg=" . $this->reg_user->msg . "&return={$return_url}");
                     exit;
                 }
             }
             $redirect_url = 'homepage.php?msg=' . $msg;
         } else {
             if ($group_invitation_id) {
                 // if an invitation to join a group
                 // User registration is in response to a group invitation, so
                 // now that the user is registered, handle the group invitation.
                 try {
                     $is_valid_ginv = Invitation::validate_group_invitation_id($group_invitation_id);
                     if (!$is_valid_ginv) {
                         $msg = 3001;
                     }
                 } catch (PAException $e) {
                     $this->inv_error = "{$e->message}";
                 }
                 if (empty($msg)) {
                     //if group invitation is valid, and no error yet
                     try {
                         $new_invite = new Invitation();
                         $new_invite->inv_id = $group_invitation_id;
                         $new_invite->inv_user_id = $this->reg_user->newuser->user_id;
                         $new_invite->accept();
                         //get collection_id
                         $Ginv = Invitation::load($group_invitation_id);
                         $gid = $Ginv->inv_collection_id;
                     } catch (PAException $e) {
                         $this->reg_user->msg = "{$e->message}";
                         $this->reg_user->error = TRUE;
                         print $this->reg_user->msg;
                     }
                     $redirect_url = "group.php?gid={$gid}&action=join&GInvID={$group_invitation_id}";
                 } else {
                     //else redirect registered user to its page.
                     $redirect_url = "user.php?msg_id={$msg}";
                 }
                 // end of if group invitation is valid
             }
         }
         if (empty($redirect_url)) {
             // if no url is set yet
             // not a group invitation, so redirect to private user page when done
             $redirect_url = "user.php";
         }
//.........这里部分代码省略.........
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:register.php

示例8: ProjectUser

<?php

require_once "../../global.php";
$inviteID = Filter::numeric($_POST['inviteID']);
$invite = Invitation::load($inviteID);
$response = Filter::alphanum($_POST['response']);
if ($response == 'accept') {
    // add the user to the project
    if ($invite->getTrusted()) {
        $relationship = ProjectUser::TRUSTED;
    } else {
        $relationship = ProjectUser::MEMBER;
    }
    $pu = new ProjectUser(array('project_id' => $invite->getProjectID(), 'user_id' => $invite->getInviteeID(), 'relationship' => $relationship));
    $pu->save();
    // update the invite
    $invite->setResponse(Invitation::ACCEPTED);
    $invite->setDateResponded(date("Y-m-d H:i:s"));
    $invite->save();
    // prep for logging
    $eventTypeID = 'accept_member_invitation';
    $successMsg = 'You accepted the invitation.';
} else {
    // update the invite
    $invite->setResponse(Invitation::DECLINED);
    $invite->setDateResponded(date("Y-m-d H:i:s"));
    $invite->save();
    // prep for logging
    $eventTypeID = 'decline_member_invitation';
    $successMsg = 'You declined the invitation.';
}
开发者ID:malimu,项目名称:Pipeline,代码行数:31,代码来源:dashboard.process.php


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