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


PHP Relation::lookup_relation_type方法代码示例

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


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

示例1: getMessageSpecificData

 public function getMessageSpecificData()
 {
     if (is_array($this->associated_obj)) {
         // to keep compatibility with some old code, we must accept parameters given in arrays also
         foreach ($this->associated_obj as $name => $value) {
             $this->template_vars["%{$name}%"] = $value;
         }
     } else {
         if (is_object($this->associated_obj)) {
             if (is_a($this->associated_obj, 'User')) {
                 $this->addUserData($this->associated_obj, 'related.user');
             } else {
                 if (is_a($this->associated_obj, 'Content')) {
                     $author = new User();
                     $author->load((int) $this->associated_obj->author_id);
                     $this->addUserData($author, 'content.author');
                     $this->template_vars["%content.title%"] = $this->associated_obj->title;
                     $this->template_vars["%content.url%"] = UrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id));
                     $this->template_vars["%content.link%"] = UrlHelper::link_to(PA_ROUTE_CONTENT, $this->associated_obj->title, null, array('cid' => $this->associated_obj->content_id));
                     $this->template_vars["%content.delete_url%"] = UrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id, 'action' => 'deleteContent'));
                     $this->template_vars["%content.delete_link%"] = UrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%content.delete_url%"], null, array('cid' => $this->associated_obj->content_id, 'action' => 'deleteContent'));
                     $this->template_vars["%content.moderation_url%"] = UrlHelper::url_for(PA::$url . '/' . FILE_NETWORK_MANAGE_CONTENT);
                     $this->template_vars["%content.moderation_link%"] = UrlHelper::link_to(PA::$url . '/' . FILE_NETWORK_MANAGE_CONTENT, $this->template_vars["%content.moderation_url%"]);
                     if (get_class($this->associated_obj) == 'Image' || get_class($this->associated_obj) == 'Audio' || get_class($this->associated_obj) == 'Video') {
                         if (!empty($this->associated_obj->group_id)) {
                             // if Group Media
                             $this->group = new Group();
                             $this->group->load((int) $this->associated_obj->group_id);
                             $this->addGroupData($this->group);
                         }
                         $this->template_vars["%media.title%"] = $this->associated_obj->title;
                         $this->template_vars["%media.full_view_url%"] = UrlHelper::url_for(PA::$url . '/' . FILE_MEDIA_FULL_VIEW, array('cid' => $this->associated_obj->content_id, 'login_required' => 'true'));
                         $this->template_vars["%media.full_view_link%"] = UrlHelper::link_to(PA::$url . '/' . FILE_MEDIA_FULL_VIEW, $this->template_vars["%media.full_view_url%"], null, array('cid' => $this->associated_obj->content_id, 'login_required' => 'true'));
                     }
                 } else {
                     if (is_a($this->associated_obj, 'Comment')) {
                         $author = new User();
                         $author->load((int) $this->associated_obj->user_id);
                         $this->addUserData($author, 'comment.author');
                         $this->template_vars["%comment.text%"] = $this->associated_obj->comment;
                         $this->template_vars["%comment.url%"] = UrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id));
                         $this->template_vars["%comment.link%"] = UrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%comment.url%"], null, array('cid' => $this->associated_obj->content_id));
                         $this->template_vars["%comment.delete_url%"] = UrlHelper::url_for(PA::$url . '/deletecomment.php', array('comment_id' => $this->associated_obj->comment_id));
                         $this->template_vars["%comment.delete_link%"] = UrlHelper::link_to(PA::$url . '/deletecomment.php', $this->template_vars["%comment.delete_url%"], null, array('comment_id' => $this->associated_obj->comment_id));
                     } else {
                         if (is_a($this->associated_obj, 'Invitation')) {
                             $inviter = new User();
                             $inviter->load((int) $this->associated_obj->user_id);
                             $this->addUserData($inviter, 'invite.inviter');
                             if (!empty($this->associated_obj->inv_collection_id) && $this->associated_obj->inv_collection_id != -1) {
                                 $group = new Group();
                                 $group->load((int) $this->associated_obj->inv_collection_id);
                                 $this->group = $group;
                                 $this->addGroupData($this->group);
                             }
                             if (empty($this->associated_obj->inv_user_id) || $this->associated_obj->inv_summary == "internal_invitation") {
                                 // invitation sent
                                 $reg_link_desc = abbreviate_text($this->associated_obj->register_url, 52, 36);
                                 $acc_link_desc = abbreviate_text($this->associated_obj->accept_url, 52, 36);
                                 $reg_link = "<a href=\"{$this->associated_obj->register_url}\">{$reg_link_desc}</a>";
                                 $acc_link = "<a href=\"{$this->associated_obj->accept_url}\">{$acc_link_desc}</a>";
                                 $this->template_vars["%invite.message%"] = $this->associated_obj->inv_message;
                                 $this->template_vars["%invite.accept_url%"] = $this->associated_obj->accept_url;
                                 $this->template_vars["%invite.accept_link%"] = $acc_link;
                                 $this->template_vars["%invite.register_url%"] = $this->associated_obj->register_url;
                                 $this->template_vars["%invite.register_link%"] = $reg_link;
                                 $this->template_vars["%invite.invited_user_name%"] = $this->associated_obj->inv_user_first_name;
                                 $this->template_vars["%invite.invited_user_email%"] = $this->associated_obj->inv_email;
                                 $this->template_vars["%recipient.email_address%"] = $this->associated_obj->inv_email;
                             } else {
                                 // invitation accepted
                                 $invited = new User();
                                 $invited->load((int) $this->associated_obj->inv_user_id);
                                 $this->addUserData($invited, 'invite.invited');
                                 if (!empty($this->associated_obj->inv_relation_type)) {
                                     $this->template_vars["%invite.relation_type%"] = $this->associated_obj->inv_relation_type;
                                 }
                             }
                         } else {
                             if (is_a($this->associated_obj, 'RelationData')) {
                                 $requester = new User();
                                 $relateduser = new User();
                                 $requester->load((int) $this->associated_obj->user_id);
                                 $relateduser->load((int) $this->associated_obj->relation_id);
                                 $this->addUserData($requester, 'relation.inviter');
                                 $this->addUserData($relateduser, 'relation.invited');
                                 $this->template_vars["%relation.type%"] = Relation::lookup_relation_type($this->associated_obj->relationship_type);
                                 $this->template_vars["%relation.friend_list_url%"] = UrlHelper::url_for(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->user_id, 'login_required' => 'true'));
                                 $this->template_vars["%relation.friend_list_link%"] = UrlHelper::link_to(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, $this->template_vars["%relation.friend_list_url%"], null, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->user_id, 'login_required' => 'true'));
                                 $this->template_vars["%relation.appr_deny_url%"] = UrlHelper::url_for(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->relation_id, 'login_required' => 'true'));
                                 $this->template_vars["%relation.appr_deny_link%"] = UrlHelper::link_to(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, $this->template_vars["%relation.appr_deny_url%"], null, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->relation_id, 'login_required' => 'true'));
                             } else {
                                 if (is_a($this->associated_obj, 'ReportAbuse')) {
                                     $author = new User();
                                     $author->load((int) $this->associated_obj->reporter_id);
                                     $this->addUserData($author, 'abuse.reporter');
                                     $this->template_vars["%abuse.report%"] = $this->associated_obj->body;
                                     $this->template_vars["%abuse.url%"] = UrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->parent_id));
                                     $this->template_vars["%abuse.link%"] = UrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%abuse.url%"], null, array('cid' => $this->associated_obj->parent_id));
                                     $this->template_vars["%abuse.delete_comment_url%"] = UrlHelper::url_for(PA::$url . '/deletecomment.php', array('comment_id' => $this->associated_obj->parent_id));
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:MessageRenderer.class.php

示例2: Invitation

         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) {
             $msg = $e->message;
         }
     }
 } else {
     $msg = $token_arr[0] == FALSE ? $token_arr[1] : 7018;
     header("Location: " . PA_ROUTE_HOME_PAGE . "/msg={$msg}");
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:31,代码来源:cnuser_login.php

示例3: peopleaggregator_getUserRelation

function peopleaggregator_getUserRelation($args)
{
    $login = $args['login'];
    $dest_login = $args['relation_login'];
    // look up user IDs
    $user = new User();
    $user->load($login);
    $dest_user = new User();
    $dest_user->load($dest_login);
    // get relation type id - this throws RELATION_NOT_EXIST if no relation exists
    $rel_type_id = Relation::get_relation($user->user_id, $dest_user->user_id);
    return array('success' => TRUE, 'msg' => 'Retrieved relation info.', 'relation' => Relation::lookup_relation_type($rel_type_id));
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:13,代码来源:api_impl.php

示例4: 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

示例5: 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

示例6: render_for_ajax


//.........这里部分代码省略.........
         // deny and remove are essentially equivalent
         case "remove_friend":
             do {
                 $user_id = PA::$login_user->user_id;
                 $remove_id = (int) $this->params['remove_id'];
                 if ($op == "deny_friend") {
                     try {
                         $res = Relation::delete_relation($remove_id, $user_id);
                         // relation reversed
                         $this->note = __("You denied the friend request successfully.");
                     } catch (PAException $e) {
                         $this->err = __("There was a problem with denying the relation: ") . $e->getMessage();
                     }
                 } else {
                     // remove
                     try {
                         $res = Relation::delete_relation($user_id, $remove_id);
                         $this->note = __("You removed the friend successfully.");
                     } catch (PAException $e) {
                         $this->err = __("There was a problem removing the relation: ") . $e->getMessage();
                     }
                     // make sure we don't leave the relation existing in the other direction
                     try {
                         $res2 = Relation::delete_relation($remove_id, $user_id);
                         // relation reversed
                     } catch (PAException $e) {
                         $this->err = __("There was a problem removing the reversed relation: ") . $e->getMessage();
                     }
                 }
                 if ($res) {
                     $requested_user = User::map_ids_to_logins((int) $remove_id);
                     $requested_user_name = $requested_user[$remove_id];
                     // defining array of values to fill message fram
                     $params = array('user_id' => $user_id, 'first_name' => PA::$login_user->first_name, 'last_name' => PA::$login_user->last_name, 'to' => $this->params['related_email'], 'requested_user_id' => $remove_id, 'requested_user_name' => $requested_user_name, 'network_name' => PA::$network_info->name, 'config_site_name' => PA::$site_name);
                     // send notification
                     auto_email_notification_members('relationship_denied', $params);
                 }
             } while (0);
             break;
         case "approve_friend":
             do {
                 $user_id = PA::$login_user->user_id;
                 $relation_id = (int) $this->params['approve_id'];
                 $status = APPROVED;
                 try {
                     $result = Relation::update_relation_status($user_id, $relation_id, $status);
                     if ($result) {
                         // if relationship has been made then send mail to the requestor
                         $this->note = __("You approved the friend request successfully.");
                         Relation::add_relation($user_id, $relation_id);
                         // for rivers of people
                         // notif approval
                         $activity = 'user_friend_approved';
                         $extra = serialize(array('info' => PA::$login_user->login_name . ' approved  relation with id = ' . $relation_id));
                         Activities::save(PA::$login_uid, $activity, $relation_id, $extra, array($activity));
                         // notify the originator direction also
                         $activity = 'user_friend_added';
                         $ou = new User();
                         $ou->load((int) $relation_id);
                         $extra = serialize(array('info' => $ou->login_name . ' added new relation with id = ' . PA::$login_user->login_name));
                         Activities::save($relation_id, $activity, PA::$login_uid, $extra, array($activity));
                         $from = PA::$login_user->email;
                         $requested_user = User::map_ids_to_logins($relation_id);
                         if (PA::$network_info->type == MOTHER_NETWORK_TYPE) {
                             $network_owner_id = SUPER_USER_ID;
                         } else {
                             $network_owner_id = PA::$network_info->owner_id;
                         }
                         $net_user = new User();
                         $net_user->load((int) $network_owner_id);
                         $relation_type = $relation_type = Relation::lookup_relation_type(Relation::get_relation($relation_id, $user_id));
                         $params['cnt'] = TRUE;
                         $rel_count = Relation::get($params, 'status =\'' . APPROVED . '\'');
                         $friend_list_url = PA::$url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=in_relations&uid=' . $relation_id;
                         $user_url = url_for(FILE_USER_BLOG, array('login' => $requested_user[$relation_id]));
                         $member_moderation_url = PA::$url . '/' . FILE_NETWORK_MANAGE_USER;
                         $params = array('first_name' => PA::$login_user->first_name, 'last_name' => PA::$login_user->last_name, 'user_name' => PA::$login_user->login_name, 'invited_user_id' => $relation_id, 'user_id' => $user_id, 'invited_user_name' => $requested_user[$relation_id], 'relation_type' => $relation_type, 'network_name' => PA::$network_info->name, 'member_count' => PA::$network_info->member_count, 'reci_relation_count' => $rel_count, 'network_owner_name' => $net_user->first_name, 'to' => $this->params['related_email'], 'mail_type' => 'friend_response', 'user_url' => $user_url, 'friend_list_url' => $friend_list_url, 'member_moderation_url' => $member_moderation_url, 'config_site_name' => PA::$site_name);
                         // send mail to proper notification
                         auto_email_notification_members('invitation_accept', $params);
                         // add check for network owner's notification
                         $extra = unserialize(PA::$network_info->extra);
                         if (@$extra['notify_owner']['relation_added']['value'] != NET_NONE) {
                             // send mail to network owner
                             $to = $net_user->email;
                             $mail_type = 'reciprocated_relation_estab';
                             $check = pa_mail($to, $mail_type, $params);
                         }
                     }
                 } catch (PAException $e) {
                     $this->err = __("There was a problem with adding the relation: ") . $e->getMessage();
                 }
             } while (0);
             break;
         default:
             // just ignore any others
             $this->note = "Unknown operation {$op}.";
             break;
     }
     return $this->render();
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:RelationsModule.php

示例7: User

 $status = APPROVED;
 try {
     $result = Relation::update_relation_status($user_id, $relation_id, $status);
     if ($result) {
         // if relationship has been made then send mail to the requestor
         Relation::add_relation($user_id, $relation_id);
         $from = $_SESSION['user']['email'];
         $requested_user = User::map_ids_to_logins($relation_id);
         if ($network_info->type == MOTHER_NETWORK_TYPE) {
             $network_owner_id = SUPER_USER_ID;
         } else {
             $network_owner_id = $network_info->owner_id;
         }
         $net_user = new User();
         $net_user->load((int) $network_owner_id);
         $relation_type = $relation_type = Relation::lookup_relation_type(Relation::get_relation($relation_id, $user_id));
         $params['cnt'] = TRUE;
         $rel_count = Relation::get($params, 'status =\'' . APPROVED . '\'');
         $friend_list_url = PA::$url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=in_relations&uid=' . $relation_id;
         $user_url = url_for(FILE_USER_BLOG, array('login' => $requested_user[$relation_id]));
         $member_moderation_url = PA::$url . '/' . FILE_NETWORK_MANAGE_USER;
         $array_of_data = array('first_name' => $_SESSION['user']['first_name'], 'last_name' => $_SESSION['user']['last_name'], 'user_name' => $_SESSION['user']['name'], 'invited_user_id' => $relation_id, 'user_id' => $user_id, 'invited_user_name' => $requested_user[$relation_id], 'relation_type' => $relation_type, 'network_name' => $network_info->name, 'member_count' => $network_info->member_count, 'reci_relation_count' => $rel_count, 'network_owner_name' => $net_user->first_name, 'to' => $_POST['related_email'], 'mail_type' => 'friend_response', 'user_url' => $user_url, 'friend_list_url' => $friend_list_url, 'member_moderation_url' => $member_moderation_url, 'config_site_name' => $config_site_name);
         // send mail to proper notification
         auto_email_notification_members('invitation_accept', $array_of_data);
         // add check for network owner's notification
         $extra = unserialize($network_info->extra);
         if ($extra['notify_owner']['relation_added']['value'] != NET_NONE) {
             // send mail to network owner
             $to = $net_user->email;
             $mail_type = 'reciprocated_relation_estab';
             $check = pa_mail($to, $mail_type, $array_of_data);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:view_all_members.php


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