public function initializeModule($request_method, $request_data)
 {
     global $paging;
     if (!empty(PA::$page_uid)) {
         //Approved pending will be shown for the page user.
         $count = Testimonials::count_testimonials(PA::$page_uid, APPROVED);
         if (!$count) {
             return 'skip';
         }
         $this->testimonial_status = APPROVED;
         $this->title = ucfirst(PA::$page_user->first_name) . '\'s ';
         $this->title .= __('Testimonials');
     } else {
         if (!empty(PA::$login_uid)) {
             //Pending testimonal will be shown for the logged in user.
             $this->mode = PRI;
             $count = Testimonials::count_testimonials(PA::$login_uid, PENDING);
             if (!$count) {
                 return 'skip';
             }
             $this->testimonial_status = PENDING;
             $this->title = __('New Testimonials');
             $this->recipient_id = PA::$login_uid;
         } else {
             return 'skip';
         }
     }
     $this->Paging = $paging;
 }
Пример #2
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;
    }
}
Пример #3
0
        if ($file == false) {
            $msg = "Unable to upload photo <br>" . $myUploadobj->error;
            $error = TRUE;
        } else {
            $login_user->picture = $file;
            $_SESSION['user']['picture'] = $file;
        }
    }
    try {
        $login_user->save();
    } catch (PAException $e) {
        $msg = "{$e->message}";
        $save_error = TRUE;
    }
}
$count_testimonial = Testimonials::count_testimonials($login_uid, PENDING);
$page_id = PAGE_USER_PRIVATE;
// load all support code
// these should eventually be collapsed into one file
$parameter = js_includes('iutil.js');
$parameter .= js_includes('json.js');
$parameter .= js_includes('idrag.js');
$parameter .= js_includes('idrop.js');
$parameter .= js_includes('isortables.js');
// load code to initialize drag&drop in this page
$parameter .= js_includes('userpage.js');
$parameter .= build_rsd_link_rel("user:"******"<script language='javascript' type='text/javascript'>\n  // var uid = {$login_uid};\n  var page_id = {$page_id};\n  </script>";
}
// accessing page settings data