function render()
 {
     switch ($this->view) {
         case "public":
             // default PA view
             break;
         case 'user':
             if (empty($this->uid)) {
                 return "user_id is required";
             }
             break;
         default:
             return "Unknown RelationsModule view: {$this->view}";
     }
     $extra = array();
     if (isset(PA::$network_info->extra)) {
         $extra = unserialize(PA::$network_info->extra);
     }
     $this->isfriend = FALSE;
     $relations = Relation::get_all_relations((int) $this->uid);
     foreach ($relations as $i => $rel) {
         $relations[$i]['no_of_relations'] = count(Relation::get_relations($rel['user_id'], APPROVED));
         if ($rel['status'] == PENDING) {
             $this->pending_relations[] = $rel;
             unset($relations[$i]);
         }
     }
     $this->links = $this->relations = $relations;
     if (!empty(PA::$login_user->user_id)) {
         // get the relation between page user and loged in user
         $my_relations = Relation::get_all_relations(PA::$login_user->user_id);
         foreach ($my_relations as $i => $rel) {
             if ($rel['user_id'] == $this->uid) {
                 $this->isfriend = $rel['status'];
             }
         }
         // get the friend requests
         $this->myfriends = Relation::get_all_user_ids(PA::$login_user->user_id);
         $this->to_confirm = array();
         foreach ($this->myfriends as $i => $rel) {
             $rel['no_of_relations'] = count(Relation::get_relations($rel['user_id'], APPROVED));
             if ($rel['user_id'] == $this->uid) {
                 $this->isfriend = $rel['status'];
             }
             if ($rel['status'] == PENDING) {
                 $this->to_confirm[] = $rel;
                 unset($this->myfriends[$i]);
             }
         }
     }
     if (count($this->relations) > 0) {
         $this->view_all_url = "{$base_url}/view_all_members.php?view_type=relations&uid={$uid}";
     }
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 function handle_field_param($data)
 {
     global $login_uid, $page_uid;
     if (isset($login_uid)) {
         $Image_owner = $login_uid == $data->author_id ? TRUE : FALSE;
         $relations_ids = Relation::get_all_relations((int) $data->author_id);
         $user_in_relation = array();
         foreach ($relations_ids as $ids) {
             $user_in_relation['friends_id'][] = $ids['user_id'];
             /*
                      if(!empty($ids['in_family']))
                      $user_in_relation['in_family'][] = $ids['in_family'];*/
         }
     }
     // No one can view the media
     $param = FALSE;
     $network_owner = PA::$network_info->owner_id;
     switch ($data->file_perm) {
         case NONE:
             if (isset($login_uid) && $Image_owner || $login_uid == SUPER_USER_ID || $login_uid == $network_owner) {
                 $param = TRUE;
             }
             break;
         case ANYONE:
             $param = TRUE;
             break;
         case WITH_IN_DEGREE_1:
             if (isset($login_uid) && (in_array($login_uid, $user_in_relation['friends_id']) || $Image_owner || $login_uid == SUPER_USER_ID || $login_uid == $network_owner)) {
                 $param = TRUE;
             }
             break;
             /*
                  case IN_FAMILY:
                      if (isset($login_uid) &&(is_array($user_in_relation)) && (in_array($login_uid,$user_in_relation['in_family']) || ($Image_owner)) ) {
                        $param = TRUE;
                      }
                   break;*/
     }
     // When user wants to see the Group image
     if (isset($login_uid) && isset($_GET['gid'])) {
         $is_author_member = $this->is_author_group_member($login_uid, $_GET['gid']);
         // any group member can view group gallery!
         if ($is_author_member) {
             $param = TRUE;
         }
     }
     return $param;
 }
 function render()
 {
     $links = array();
     if ($this->page_id == PAGE_USER_PUBLIC) {
         $links = Comment::get_comment_for_user(PA::$page_uid, 5);
     } else {
         if ($this->page_id == PAGE_USER_PRIVATE) {
             $relations_ids = Relation::get_all_relations((int) PA::$login_uid, 0, FALSE, 'ALL', 0, 'created', 'DESC', 'internal', APPROVED, PA::$network_info->network_id);
             $tmp_links = array();
             foreach ($relations_ids as $relation) {
                 $tmp_links[] = Comment::get_comment_for_user((int) $relation['user_id'], 5);
             }
             $cnt = 0;
             $links = array();
             $link_cnts = array();
             do {
                 foreach ($tmp_links as $idx => $rel_links) {
                     if (empty($link_cnts[$idx])) {
                         $link_cnts[$idx] = 0;
                     }
                     if (isset($rel_links[$link_cnts[$idx]])) {
                         $links[] = $rel_links[$link_cnts[$idx]++];
                         $cnt++;
                     }
                     if ($cnt >= 5) {
                         break;
                     }
                 }
             } while ($cnt++ <= 5);
         } else {
             $links = Comment::get_comment_for_content(NULL, $count = 5, 'DESC', TRUE);
         }
     }
     foreach ($links as &$link) {
         if (!empty($link['content_id'])) {
             $post = Content::load_content((int) $link['content_id'], PA::$login_uid);
             $link['post_title'] = $post->title;
         } else {
             $link['post_title'] = __('No title');
         }
     }
     $this->inner_HTML = $this->generate_inner_html($links);
     $content = parent::render();
     return $content;
 }
 public function render()
 {
     $status = null;
     if (!empty(PA::$extra['reciprocated_relationship']) && PA::$extra['reciprocated_relationship'] == NET_YES) {
         $status = APPROVED;
     }
     $relations = Relation::get_all_relations((int) PA::$uid, 6, FALSE, 'ALL', 0, 'created', 'DESC', 'internal', $status, PA::$network_info->network_id);
     for ($i = 0; $i < count($relations); $i++) {
         $count_relations = Relation::get_relations($relations[$i]['user_id'], $status, PA::$network_info->network_id);
         $relations[$i]['no_of_relations'] = count($count_relations);
     }
     $this->links = $relations;
     if (!empty($this->links)) {
         $this->view_all_url = PA::$url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=relations&uid=' . PA::$uid;
     }
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }
 function handle_field_param($data)
 {
     global $login_uid, $page_uid;
     if (isset($login_uid)) {
         $Image_owner = $login_uid == $data->author_id ? TRUE : FALSE;
         $relations_ids = Relation::get_all_relations((int) $data->author_id);
         $user_in_relation = array();
         foreach ($relations_ids as $ids) {
             $user_in_relation['friends_id'][] = $ids['user_id'];
             /*
                      if(!empty($ids['in_family']))
                      $user_in_relation['in_family'][] = $ids['in_family'];*/
         }
     }
     // No one can view the media
     $param = FALSE;
     switch ($data->file_perm) {
         case NONE:
             if (isset($login_uid) && $Image_owner) {
                 $param = TRUE;
             }
             break;
         case ANYONE:
             $param = TRUE;
             break;
         case WITH_IN_DEGREE_1:
             if (isset($login_uid) && (in_array($login_uid, $user_in_relation['friends_id']) || $Image_owner)) {
                 $param = TRUE;
             }
             break;
             /*
                  case IN_FAMILY:
                      if (isset($login_uid) &&(is_array($user_in_relation)) && (in_array($login_uid,$user_in_relation['in_family']) || ($Image_owner)) ) {
                        $param = TRUE;
                      }
                   break;*/
     }
     // When user wants to see the Group image
     $param = isset($_GET['gid']) ? TRUE : $param;
     return $param;
 }
 function render()
 {
     if (empty(PA::$login_user->user_id)) {
         return '';
     }
     // login required
     $params = array();
     $params['limit'] = $this->show;
     switch ($this->view) {
         case 'user':
             if ($this->uid != PA::$login_user->user_id) {
                 return "";
                 // no display in this case
             }
             // get relations, we are only interested in Activities for Friends
             $this->relations = array();
             $this->relations[] = '-1';
             // add one bogus to workaround empty array issue in Activities
             // it would otherwise return ALL activities, unfiltered
             $relations = Relation::get_all_relations((int) $this->uid);
             foreach ($relations as $i => $rel) {
                 if ($rel['status'] != PENDING) {
                     $this->relations[] = $relations[$i]['user_id'];
                 }
             }
             $params['relation_ids'] = $this->relations;
             break;
         default:
             break;
     }
     $this->activities = Activities::get_activities($params);
     $tmp_file = dirname(__FILE__) . "/" . $this->skin . "_" . $this->inner_template;
     $inner_html_gen =& new Template($tmp_file, $this);
     $this->inner_HTML = $inner_html_gen->fetch();
     $content = parent::render();
     return $content;
 }
 public function loadRelations()
 {
     // load all this users relations
     $this->user->{'local_relations'} = Relation::get_all_relations($this->user->user_id);
     $this->user->{'external_relations'} = Relation::get_external_relations($this->user->user_id);
 }
 function set_vars()
 {
     global $login_uid;
     /* For handling the Album according to thier type */
     switch ($this->type) {
         case 'Images':
             $all_albums = Album::load_all($this->uid, IMAGE_ALBUM);
             break;
         case 'Videos':
             $all_albums = Album::load_all($this->uid, VIDEO_ALBUM);
             break;
         case 'Audios':
             $all_albums = Album::load_all($this->uid, AUDIO_ALBUM);
             break;
         default:
             // Treating Images are the default parameters
             break;
     }
     /* setting all the album for this page */
     /* Retrive the All album of user */
     $album = array();
     $j = 0;
     if (!empty($all_albums)) {
         foreach ($all_albums as $alb) {
             $album[$j]['id'] = $alb['collection_id'];
             $album[$j]['name'] = $alb['title'];
             $j++;
         }
         $this->default_album_id = @$album[0]['id'];
         $this->default_album_name = @$album[0]['name'];
         $this->my_all_album = $album;
     }
     /* For handling Users Friend Album*/
     if (isset($login_uid)) {
         /* Here we calculate all the relation (Friend's) Ids
            TODO: add a check to load it only when a user wants to see his friend's gallery
            */
         /*
               $relations_ids = Relation::get_all_relations((int)$login_uid);
               $users = array();
               $users_ids = array();
               $users = Network::get_members(array('network_id'=>PA::$network_info->network_id));
         
               if ( $users['total_users'] ) {
                 for( $i = 0; $i < $users['total_users']; $i++) {
                     $users_ids[] = $users['users_data'][$i]['user_id'];
                 }
               }
         
               if (!empty($relations_ids)) {
                 $cnt = count($relations_ids);
                 for ($i = 0; $i < $cnt; $i++) {
                   if (!in_array($relations_ids[$i]['user_id'], $users_ids)) {
                     unset($relations_ids[$i]);
                   }
                 }
               }
               // extracting some name who are not member of that network ;)
         */
         $relations_ids = Relation::get_all_relations((int) PA::$login_uid, 0, FALSE, 'ALL', 0, 'created', 'DESC', 'internal', APPROVED, PA::$network_info->network_id);
         /* Here varify that users has any relation or not ... as well as loads all album */
         if (!empty($relations_ids)) {
             /* Here we get all the frnds list of login User */
             $frnd_albums = array();
             $i = 0;
             sortByFunc($relations_ids, create_function('$relations_ids', 'return $relations_ids["login_name"];'));
             foreach ($relations_ids as $frnd_id) {
                 $frnd_list[$i]['name'] = $frnd_id['login_name'];
                 $frnd_list[$i]['id'] = $frnd_id['user_id'];
                 $i++;
             }
         }
     }
     // End of Friend Album
     $this->friend_list = @$frnd_list;
     // can be empty
 }
    function _render_friends($scope) {
	$section = ($scope == 'internal') ? 'friends' : 'friends_ext';
	$section_singular = $this->section_singular_names[$section];
	$page = (int)@$_REQUEST['friend_page'];
	$friend_state =& $this->state[$section];

	// paging controls
	$total_friends = Relation::count_relations($this->user->user_id, $scope);
	$total_pages = (int)ceil((float)$total_friends / $this->friends_per_page);
	if ($page > $total_pages) $page = $total_pages;
	if ($page < 1) $page = 1;
	$paging = "Show page: ";
	for ($i = 1; $i < $total_pages+1; ++$i) {
	  if ($i == $page) {
	    $paging .= "$i ";
	  } else {
	    $paging .= "<a href=\"javascript:badge.reload_section('badge_$section', '$this->url/$this->badge_tag/$section?friend_page=$i');\">$i</a> ";
	  }
	}
	$first_friend = ($page-1)*$this->friends_per_page + 1;
	$last_friend = min($first_friend + $this->friends_per_page - 1, $total_friends);
	$paging .= "(showing $first_friend-$last_friend of $total_friends friends)";

	// 'showing XXX' link
	$showing = $this->make_showing_link($friend_state, $section, "friend_page=$page");

	// facewall display
	$facewall = "";
	foreach (Relation::get_all_relations($this->user->user_id, 0, FALSE, $this->friends_per_page, $page, 'created', 'desc', $scope) as $rel) {
	    $facewall .= '<div id="'.$section_singular.'_'.($scope == 'internal' ? $rel['user_id'] : md5($rel['user_id'])).'">'.$this->render_friend_image($rel, $scope).'</div>';
	}

	// outer template
	return <<<ENS
<p>$showing</p>

<!--<p>How many items to show at once: <select id="item_count" onchange="badge.update()">
<option value="5">5</option>
<option value="10">10</option>
<option value="15" selected="selected">15</option>
<option value="20">20</option>
</select></p>-->

<div>
$facewall
<div style="clear: both"></div>
</div>

<p>$paging</p>
ENS;
    }
Exemple #10
0
 /**
  * Load EXTERNAL relations of all types and their information
  * @param $user_id user_id of the user
  * @return $user_relation_data an array having user relation's information
  */
 static function get_external_relations($user_id, $no_of_relations = 0, $cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC')
 {
     // this is just a convenience wrapper
     return Relation::get_all_relations($user_id, $no_of_relations, $cnt, $show, $page, $sort_by, $direction, 'external');
 }
$setting_data = ModuleSetting::load_setting(4, $uid);
// user general info
$user_data_general = array();
$user_generaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], GENERAL);
for ($i = 0; $i < count($user_generaldata); $i++) {
    $name = $user_generaldata[$i]['name'];
    $value = $user_generaldata[$i]['value'];
    $perm_name = $name . "_perm";
    $perm_value = $user_generaldata[$i]['perm'];
    $user_data_general["{$name}"] = $value;
    $user_data_general["{$perm_name}"] = $perm_value;
}
// relations
if ($_SESSION['user']['id']) {
    // user Relations (user relations with all informations)
    $relations = Relation::get_all_relations((int) $uid);
}
$users = User::allUsers_with_paging(1, 10);
$module1 = new ImagesModule($pictures);
if ($page_type == 'public') {
    $module1->mode = PUB;
} else {
    $module1->mode = PRI;
}
$module1->title = "My Pictures";
$module1->orientation = LEFT;
$module2 = new RelationsModule($relations);
if ($page_type == 'public') {
    $module2->mode = PUB;
} else {
    $module2->mode = PRI;
 function get_users()
 {
     if ($this->mode == 'alphabetical') {
         $this->sort_by = 'UP.field_value';
         $sorting_direction = 'ASC';
     } else {
         $this->sort_by = 'U.created';
         $sorting_direction = 'DESC';
     }
     $this->search = array('field_type' => $this->skin, 'field_name' => 'login_name');
     if (@$this->q) {
         $this->search['operator'] = 'LIKE';
         $this->search['value'] = "%{$this->q}%";
     }
     $users = array();
     if ($this->mode == 'friends') {
         $this->users = Relation::get_all_relations((int) $this->uid);
         foreach ($relations as $i => $rel) {
             $relations[$i]['no_of_relations'] = count(Relation::get_relations($rel['user_id'], APPROVED));
         }
         foreach ($this->users as $i => $u) {
             if ($u['status'] == PENDING) {
                 unset($this->users[$i]);
             } else {
                 // we make Object of Array
                 $r = NULL;
                 foreach ($u as $k => $v) {
                     $r->{$k} = $v;
                 }
                 $this->users[$i] = $r;
                 $this->users[$i]->pa_id = $r->user_id;
             }
         }
         $this->user_count = count($this->users);
         if (!$this->user_count) {
             // this user has no friends
             $this->mode = 'newest';
         }
     }
     if (!$this->user_count) {
         // load users on the basis of the search parameters.
         $this->users = ShadowUser::search($this->search, $this->show, $this->page, $this->sort_by, $sorting_direction);
         $this->user_count = ShadowUser::search($this->search, "COUNT");
     }
     if ($this->user_count) {
         // prepare paging info
         $this->n_pages = (int) ceil($this->user_count / $this->show);
     }
 }
Exemple #13
0
<a href="{$url_enc}" target="_blank"><div class="person_image">{$img}</div><div class="person_name">{$title_enc}</div></a>
</div>
EOS;
                    $items_html[] = array("item", $h);
                }
                $html .= badge_render_section($items_html);
            }
        }
    } else {
        // old-style friends / groups badge
        $html .= "<p><b><a target=\"_blank\" href=\"{$base_url}/user.php?uid={$user->user_id}\">{$user->first_name} {$user->last_name}</a></b>'s {$show_what}:</p>";
        $show_all_url = "";
        switch ($show_what) {
            case 'friends':
                $perpage = (int) $param;
                $relations = Relation::get_all_relations($user->user_id, 0, FALSE, $param, $page);
                $n = count($relations);
                $rows = intval($n / 3) + ($n % 3 ? 1 : 0);
                $pos = 0;
                $html .= "<table>";
                for ($y = 0; $y < $rows; ++$y) {
                    $html .= "<tr>";
                    for ($x = 0; $x < $cols && $pos < $n; ++$x, ++$pos) {
                        $html .= '<td valign="bottom">';
                        $rel = $relations[$pos];
                        $html .= '<a target="_blank" href="' . $base_url . '/user.php?uid=' . $rel['user_id'] . '">';
                        if ($rel['picture'] && file_exists("files/" . $rel['picture'])) {
                            $html .= uihelper_resize_mk_user_img($rel['picture'], 50, 50) . "<br/>";
                        }
                        $html .= htmlspecialchars($rel['login_name']) . '</a>';
                        $html .= "</td>";
function peopleaggregator_getUserRelations($args)
{
    $login = $args['login'];
    $page = $args['page'];
    $perpage = $args['resultsPerPage'];
    //	$detail = $args['detailLevel'];
    $imageSize = $args['profileImageSize'];
    if (preg_match("/^(\\d+)x(\\d+)\$/", $imageSize, $m)) {
        $imageWidth = (int) $m[1];
        $imageHeight = (int) $m[2];
    } else {
        $imageWidth = $imageHeight = 0;
    }
    // look up user ID
    $user = new User();
    $user->load($login);
    $total = Relation::count_relations($user->user_id);
    $total_pages = api_n_pages($total, $perpage);
    $relations_out = array();
    foreach (Relation::get_all_relations($user->user_id, 0, FALSE, $perpage, $page) as $rel) {
        $rel_out = array('id' => 'user:'******'user_id'], 'login' => $rel['login_name'], 'relation' => $rel['relation_type'], 'url' => PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $rel['user_id']);
        $img_info = api_resize_user_image($rel['picture'], $imageWidth, $imageHeight);
        if ($img_info) {
            $rel_out['image'] = $img_info;
        }
        $relations_out[] = $rel_out;
    }
    if (sizeof($relations_out)) {
        $first = ($page - 1) * $perpage + 1;
        $msg = "Retrieved relations {$first}-" . ($first + sizeof($relations_out)) . " of {$total} for user {$user->login_name}.";
    } else {
        $msg = "Retrieved zero relations.";
        if ($page > $total_pages) {
            $msg .= "  Try specifying a page number between 1 and {$total_pages}.";
        }
    }
    return array('success' => TRUE, 'msg' => $msg, 'login' => $user->login_name, 'totalPages' => $total_pages, 'resultsPerPage' => $perpage, 'totalResults' => $total, 'page' => $page, 'relations' => $relations_out);
}
 /** !!
  * Called by web/dynamic.php, which does the page generation.
  *
  * @param string $request_method Not used. But here for standards.
  * @param array $request_data POST data to save.
  */
 public function handleRequest($request_method, $request_data)
 {
     $msg = NULL;
     $action = isset($request_data['do']) ? $request_data['do'] : NULL;
     if ($action == 'delete') {
         $this->delete_id = $this->relation_uid;
         Relation::delete_relation($this->uid, $this->delete_id, PA::$network_info->network_id);
         $this->cache_id = 'relation_private_' . $this->uid;
         CachedTemplate::invalidate_cache($this->cache_id);
         $this->cache_id = 'relation_public_' . $this->uid;
         CachedTemplate::invalidate_cache($this->cache_id);
         // invalidate cache of user who is being added in relation module
         $this->cache_id = 'in_relation_private_' . $this->delete_id;
         CachedTemplate::invalidate_cache($this->cache_id);
         $this->cache_id = 'in_relation_public_' . $this->delete_id;
         CachedTemplate::invalidate_cache($this->cache_id);
         header('Location:' . PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $this->delete_id . '&delete=1');
     }
     //getting relations of logged in user
     $this->all_relations = Relation::get_all_relations((int) $this->uid);
     $this->relationship_level = 2;
     //default relation level id is 2 for friend
     foreach ($this->all_relations as $relation) {
         if ($this->relation_uid == $relation['user_id']) {
             $this->relationship_level = $relation['relation_type_id'];
             $this->in_family = $relation['in_family'];
             $this->status = $relation['status'];
             if ($this->status == PENDING) {
                 if (PA::$extra['reciprocated_relationship'] == NET_YES && $action == 'add') {
                     $msg = sprintf(__('Your request for adding %s as a relation has already been sent'), $relation['display_name']);
                 }
             }
         }
     }
     try {
         $this->user->load((int) $this->relation_uid);
         $this->title = __('Edit Relationship') . ' - ' . $this->user->display_name;
         //title of the web page
         //picture and login relation
         $this->relation_picture = $this->user->picture;
         $this->login_name = $this->user->login_name;
         $this->display_name = $this->user->display_name;
     } catch (PAException $e) {
         $mesg = $e->message;
         $this->is_error = TRUE;
     }
     if (isset($request_data['submit'])) {
         $this->rel_creater = PA::$user;
         $this->relationship_level = $request_data['level'];
         if (PA::$extra['reciprocated_relationship'] == NET_YES) {
             if (Relation::getRelationData($this->relation_uid, $this->uid, PA::$network_info->network_id)) {
                 Relation::update_relation_status($this->relation_uid, $this->uid, APPROVED, PA::$network_info->network_id);
                 Relation::add_relation($this->uid, $this->relation_uid, $this->relationship_level, PA::$network_info->address, PA::$network_info->network_id, NULL, NULL, NULL, true, APPROVED);
                 $relation_obj = Relation::getRelationData($this->relation_uid, $this->uid, PA::$network_info->network_id);
                 PANotify::send("reciprocated_relation_estab", PA::$network_info, PA::$login_user, $relation_obj);
                 // recipient is network owner
                 $location = PA_ROUTE_USER_PRIVATE . '/msg=' . urlencode(__("The relationship request was approved."));
                 header('Location:' . PA::$url . $location);
                 exit;
             }
             $this->status = PENDING;
         } else {
             $this->status = APPROVED;
         }
         try {
             $this->relation = Relation::get_relation($this->rel_creater->user_id, $this->relation_uid, PA::$network_info->network_id);
             $this->edit = $this->relation ? TRUE : FALSE;
         } catch (PAException $e) {
             $this->edit = FALSE;
         }
         try {
             if (isset($request_data['in_family'])) {
                 // If the user has checked the in_family checkbox.
                 Relation::add_relation($this->uid, $this->relation_uid, $this->relationship_level, PA::$network_info->address, PA::$network_info->network_id, NULL, NULL, NULL, true, $this->status);
             } else {
                 Relation::add_relation($this->uid, $this->relation_uid, $this->relationship_level, PA::$network_info->address, PA::$network_info->network_id, NULL, NULL, NULL, NULL, $this->status);
             }
             $this->user = PA::$user;
             // relationship establisher image
             $relation_obj = Relation::getRelationData($this->uid, $this->relation_uid, PA::$network_info->network_id);
             if ($this->edit == FALSE) {
                 if (PA::$extra['reciprocated_relationship'] == NET_YES) {
                     PANotify::send("friend_request_sent", PA::$user, PA::$login_user, $relation_obj);
                 } else {
                     PANotify::send("relation_added", PA::$network_info, PA::$login_user, $relation_obj);
                     // recipient is network owner
                     PANotify::send("relationship_created_with_other_member", PA::$user, PA::$login_user, $relation_obj);
                     //for rivers of people
                     $activity = 'user_friend_added';
                     //for rivers of people
                     $activities_extra['info'] = $this->display_name . ' added new friend with id =' . $request_data['uid'];
                     $extra = serialize($activities_extra);
                     $object = $this->relation_uid;
                     Activities::save(PA::$login_uid, $activity, $object, $extra);
                 }
             }
             //invalidate cache of logged in user's relation module
             $this->cache_id = 'relation_private_' . $this->uid;
             CachedTemplate::invalidate_cache($this->cache_id);
             $this->cache_id = 'relation_public_' . $this->uid;
             CachedTemplate::invalidate_cache($this->cache_id);
             // invalidate cache of user who is being added in relation module
             $this->cache_id = 'in_relation_private_' . $this->relation_uid;
             CachedTemplate::invalidate_cache($this->cache_id);
             $this->cache_id = 'in_relation_public_' . $this->relation_uid;
             CachedTemplate::invalidate_cache($this->cache_id);
             if (PA::$extra['reciprocated_relationship'] == NET_NO) {
                 if ($request_data['do']) {
                     $location = PA_ROUTE_USER_PUBLIC . '/' . $this->relation_uid . "&msg=" . urlencode(__("Relationship estabilished."));
                 }
             } else {
                 $location = PA_ROUTE_USER_PRIVATE . '/msg_id=' . urlencode(__("Your request has been sent for approval"));
             }
             header('Location:' . PA::$url . $location);
         } catch (PAException $e) {
             $message = $e->message;
         }
     }
     $msg_array = array();
     $msg_array['failure_msg'] = $msg;
     $msg_array['success_msg'] = NULL;
     $redirect_url = NULL;
     $query_str = NULL;
     set_web_variables($msg_array, $redirect_url, $query_str);
 }
 function render()
 {
     if ($this->view_type == 'all') {
         $this->Paging["count"] = Network::get_members(array('network_id' => $this->network_info->network_id, 'cnt' => TRUE));
         $param = array('show' => $this->Paging["show"], 'page' => $this->Paging["page"], 'network_id' => $this->network_info->network_id);
         $users_info = Network::get_members($param);
         $this->links = $users_info['users_data'];
     } else {
         if ($this->view_type == 'relations') {
             $extra = unserialize($this->network_info->extra);
             $this->reciprocated_relationship_set = FALSE;
             $this->relations = FALSE;
             if ($extra['reciprocated_relationship'] == NET_YES) {
                 $this->reciprocated_relationship_set = TRUE;
                 $this->relations = TRUE;
             }
             $this->Paging["count"] = Relation::get_all_relations($this->uid, $no_of_relations = 0, TRUE);
             $this->title = "View all ";
             if ($_SESSION['user']['id'] == $this->uid) {
                 $this->title .= "my";
             } else {
                 $this->title .= $this->page_user . ' \'s';
             }
             $this->title .= " friends";
             $this->sub_title = $this->title;
             $users_info = Relation::get_all_relations($this->uid, $no_of_relations = 0, FALSE, $this->Paging["show"], $this->Paging["page"]);
             $this->links = $users_info;
         } else {
             if ($this->view_type == 'in_relations') {
                 $extra = unserialize($this->network_info->extra);
                 $this->reciprocated_relationship_set = FALSE;
                 $this->in_relations = FALSE;
                 if ($extra['reciprocated_relationship'] == NET_YES) {
                     $this->reciprocated_relationship_set = TRUE;
                     $this->in_relations = TRUE;
                 }
                 $count = Relation::get_user_ids($this->uid);
                 $this->Paging["count"] = count($count);
                 $this->title = "View all people who call ";
                 if ($_SESSION['user']['id'] == $this->uid) {
                     $this->title .= "me a friend";
                 } else {
                     $this->title .= $this->page_user . " as a friend";
                 }
                 $this->sub_title = strstr($this->title, 'who');
                 $users_info = Relation::get_all_user_ids($this->uid, $no_of_relations = 0, FALSE, $this->Paging["show"], $this->Paging["page"]);
                 $this->links = $users_info;
             }
         }
     }
     if ($this->gid) {
         $group = ContentCollection::load_collection((int) $this->gid, $_SESSION['user']['id']);
         $this->Paging["count"] = $group->get_members(TRUE);
         $members = $group->get_members(FALSE, $this->Paging["show"], $this->Paging["page"]);
         $this->title = "View All Group Members";
         if (is_array($members)) {
             foreach ($members as $member) {
                 $user = new User();
                 $user->load((int) $member['user_id']);
                 $tmp_arr[] = array('user_id' => $user->user_id, 'user_id' => $user->user_id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'picture' => $user->picture, 'login_name' => $user->login_name, 'created' => $user->created);
             }
             $this->links = $tmp_arr;
         }
     }
     global $network_info;
     $usr_array = array();
     $usr_array = $this->links;
     $network_users = $this->get_networks_users_id();
     // Disply Only 1 who is the member of this network
     if (is_array($usr_array)) {
         $cnt = count($usr_array);
         for ($i = 0; $i < $cnt; $i++) {
             if (!in_array($usr_array[$i]['user_id'], $network_users)) {
                 unset($usr_array[$i]);
             }
         }
     }
     $this->links = $usr_array;
     $this->inner_HTML = $this->generate_inner_html();
     $content = parent::render();
     return $content;
 }