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 render()
 {
     $extra = unserialize(PA::$network_info->extra);
     $status = null;
     if (@$extra['reciprocated_relationship'] == NET_YES) {
         $status = APPROVED;
     }
     // moved this line down so that $status is actially defined --Martin
     $this->links = Relation::get_all_user_ids((int) $this->uid, 5, $cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC', $status);
     for ($i = 0; $i < count($this->links); $i++) {
         $count_relations = Relation::get_relations($this->links[$i]['user_id'], $status);
         $this->links[$i]['no_of_relations'] = count($count_relations);
     }
     $this->inner_HTML = $this->generate_inner_html();
     if (count($this->links) > 0) {
         $this->view_all_url = PA::$url . "/view_all_members.php?view_type=in_relations&amp;uid={$this->uid}";
     }
     $content = parent::render();
     return $content;
 }
 function render()
 {
     $extra = unserialize(PA::$network_info->extra);
     $status = null;
     if (@$extra['reciprocated_relationship'] == NET_YES) {
         $status = APPROVED;
     }
     //fix by Z.Hron: Show reciprocated relationship only for members of this network
     $added_by = Relation::get_all_user_ids((int) $this->uid, 5, $cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC', $status, PA::$network_info->network_id);
     $this->links = $added_by;
     foreach ($this->links as &$_link) {
         $count_relations = Relation::get_relations($_link['user_id'], $status, PA::$network_info->network_id);
         $_link['no_of_relations'] = count($count_relations);
     }
     $this->inner_HTML = $this->generate_inner_html();
     if (count($this->links) > 0) {
         $this->view_all_url = PA::$url . "/view_all_members.php?view_type=in_relations&amp;uid={$this->uid}";
     }
     $content = parent::render();
     return $content;
 }
$user_data_general = sanitize_user_data($user_generaldata);
// LOAD Personal data
$user_personaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], PERSONAL);
$user_data_personal = sanitize_user_data($user_personaldata);
// Load Professional Data
$user_professionaldata = User::load_user_profile($uid, (int) $_SESSION['user']['id'], PROFESSIONAL);
$user_data_professional = sanitize_user_data($user_professionaldata);
$data = array('user_data_general' => $user_data_general, 'user_data_personal' => $user_data_personal, 'user_data_professional' => $user_data_professional);
$user_data_external = sanitize_user_data(User::load_user_profile($uid, $uid, 'external'));
$delicious_id = @$user_data_external['delicious'];
$flickr_id = @$user_data_external['flickr_email'];
// try and get the Flickr nsid if user has imported profile
$user_data_flickr = sanitize_user_data(User::load_user_profile($uid, $uid, 'flickr'));
$flickr_nsid = @$user_data_flickr['nsid'];
// Loading user relations (relation ids)
$relations_ids = Relation::get_all_user_ids((int) $_SESSION['user']['id'], 5);
// $onload="ajax_call_method(ajax_titles, $uid, ajax_urls);";
// see if we have a user defined CSS
$user_data_ui = sanitize_user_data(User::load_user_profile($uid, $uid, 'ui'));
$skin_var = sanitize_user_data(User::load_user_profile($uid, $uid, 'skin'));
// accessing page settings data
$setting_data = ModuleSetting::load_setting(PAGE_USER_PRIVATE, $uid);
function setup_module($column, $moduleName, $obj)
{
    global $logged_user, $setting_data, $flickr_id, $flickr_nsid, $delicious_id, $uid, $data;
    global $content_type, $post_type_message, $paging, $relations_ids, $post_type_message, $post_type;
    global $type, $user_data_ui, $skin_var, $setting_data, $user_info;
    switch ($moduleName) {
        case 'CustomizeUIModule':
            $obj->uid = $uid;
            $obj->type = $type;
Example #5
0
/**
 *  Function : setup_module()
 *  Purpose  : call back function to set up variables 
 *             used in PageRenderer class
 *             To see how it is used see api/PageRenderer/PageRenderer.php 
 *  @param    $column - string - contains left, middle, right
 *            position of the block module 
 *  @param    $moduleName - string - contains name of the block module
 *  @param    $obj - object - object reference of the block module
 *  @return   type string - returns skip means skip the block module
 *            returns rendered html code of block module
 */
function setup_module($column, $module, $obj)
{
    global $network_info, $paging;
    $user_name = PA::$page_user->login_name;
    switch ($module) {
        case 'EventCalendarSidebarModule':
            $obj->assoc_id = PA::$page_uid;
            $obj->assoc_type = "user";
            // this is the personal calendar
            if (PA::$login_uid != PA::$page_uid) {
                $obj->may_edit = false;
            } else {
                $obj->may_edit = true;
            }
            break;
        case 'UserPhotoModule':
            $obj->block_type = 'UserPhotoBlock';
            $obj->uid = PA::$page_uid;
            break;
        case 'ImagesModule':
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Gallery' : ($obj->title = sprintf(__("%s's Gallery"), ucfirst($user_name)));
            $obj->uid = PA::$page_uid;
            break;
        case 'AboutUserModule':
            $obj->mode = PUB;
            $obj->title = 'About:';
            $obj->block_type = 'AboutUser';
            $obj->uid = PA::$page_uid;
            break;
        case 'FlickrModule':
            $obj->block_type = 'UserPhotoBlock';
            $obj->uid = PA::$page_uid;
            break;
        case 'RelationsModule':
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Relations' : ($obj->title = sprintf(__("%s's Relations"), ucfirst($user_name)));
            $obj->uid = PA::$page_uid;
            break;
        case 'MyNetworksModule':
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Networks' : ($obj->title = sprintf(__("%s's Networks"), ucfirst($user_name)));
            $obj->uid = PA::$page_uid;
            break;
        case 'MyLinksModule':
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Links' : ($obj->title = sprintf(__("%s's Links"), ucfirst($user_name)));
            $obj->uid = PA::$page_uid;
            break;
        case 'MyGroupsModule':
            $obj->block_type = 'usergroups';
            $obj->uid = PA::$page_uid;
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Groups' : ($obj->title = sprintf(__("%s's Groups"), ucfirst($user_name)));
            break;
        case 'InRelationModule':
            $status = null;
            $extra = unserialize($network_info->extra);
            if ($extra['reciprocated_relationship'] == NET_YES) {
                $status = APPROVED;
                // If the network operator has enabled reciprocated relationships, show only approved friends, otherwise all friends will be listed.
            }
            $relations_ids = Relation::get_all_user_ids((int) PA::$page_uid, 6, $cnt = FALSE, $show = 'ALL', $page = 0, $sort_by = 'created', $direction = 'DESC', $status);
            $obj->user_name = PA::$page_user->first_name;
            $obj->uid = PA::$page_uid;
            $obj->links = $relations_ids;
            break;
        case 'RecentCommentsModule':
            PA::$page_uid == PA::$login_uid ? $obj->title = 'My Comments' : ($obj->title = sprintf(__("%s's Comments"), ucfirst($user_name)));
            $obj->block_type = 'usercomments';
            $obj->uid = PA::$page_uid;
            break;
        case 'ShowContentModule':
            global $post_type_message;
            if (!empty($_GET['post_type'])) {
                $post_type = $_GET['post_type'];
            } else {
                $post_type = 'all';
            }
            $content_type = get_content_type($post_type);
            $obj->cid = @$_GET['cid'];
            $obj->mode = PUB;
            $obj->block_type = HOMEPAGE;
            $obj->content_type = $content_type;
            $obj->uid = PA::$page_uid;
            $obj->block_heading = sprintf(__("%s's Blog"), PA::$page_user->first_name);
            $obj->message = $post_type_message[$post_type];
            $obj->Paging["page"] = 1;
            $obj->Paging["show"] = 10;
            break;
        case 'LinkModule':
            $delicious_id = PA::$page_user->get_profile_field('external', 'delicious');
            if (!$delicious_id) {
                return "skip";
            }
            $obj->block_type = 'UserPhotoBlock';
            $obj->delicious_id = $delicious_id;
            $obj->title = 'Delicious';
            break;
        case 'ProfileFeedModule':
            $profile_feeds = UserProfileFeed::get_user_profile_feeds(PA::$page_uid, PA::$login_uid);
            if (empty($profile_feeds)) {
                return 'skip';
            }
            $obj->profile_feeds = $profile_feeds;
            $obj->title = PA::$page_user->first_name . "'s " . $obj->title;
            break;
        case 'ShowTestimonialModule':
            //FIXME: probably querying testimonials at least twice here -
            //once to determine whether to skip, and once or more inside
            //ShowTestimonialModule.
            $count_testimonial = Testimonials::count_testimonials(PA::$page_uid, APPROVED);
            if ($count_testimonial == 0) {
                return 'skip';
            }
            $obj->testimonial_status = APPROVED;
            $obj->title = ucfirst(PA::$page_user->first_name) . "'s testimonials";
            $obj->mode = PUB;
            $obj->Paging["page"] = $paging["page"];
            $obj->Paging["show"] = 3;
            break;
        case 'ShowUserCommentModule':
            //FIXME: probably querying comments at least twice here - once to
            //determine whether to skip, and once or more inside
            //ShowUserCommentModule to actually get the comments.
            $count_comment = Comment::count_comment(PA::$page_uid, TYPE_USER);
            if ($count_comment == 0) {
                return 'skip';
            }
            $obj->Paging["page"] = $paging["page"];
            $obj->Paging["show"] = 3;
            $obj->title = 'Comments for ' . ucfirst(PA::$page_user->first_name);
            break;
    }
}
 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;
 }