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


PHP Relation::get_relations方法代码示例

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


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

示例1: render

 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;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:57,代码来源:RelationsModule.php

示例2: setup_module

function setup_module($column, $module, $obj)
{
    global $is_member, $is_admin, $group_data, $gid;
    $obj->gid = $gid;
    switch ($module) {
        case 'MembersFacewallModule':
            $group = new Group();
            $group->collection_id = $gid;
            $group->is_active = ACTIVE;
            $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
            if (is_array($members)) {
                $count = count($members);
                $group_members = members_to_array($members);
                $users_data = array();
                foreach ($members as $member) {
                    $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id);
                    $user = new User();
                    $user->load((int) $member['user_id']);
                    $login_name = $user->login_name;
                    $user_picture = $user->picture;
                    $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
                }
                $users = array('users_data' => $users_data, 'total_users' => $count);
            }
            $obj->links = $users;
            $obj->gid = $gid;
            break;
        case 'ImagesModule':
            $obj->block_type = 'Gallery';
            $obj->page = 'grouppage';
            $obj->title = 'Group Gallery';
            $obj->group_details['collection_id'] = $group_data->collection_id;
            break;
        case 'GroupForumModule':
            if ($group_data->reg_type == REG_INVITE) {
                if (!$is_member && !$is_admin) {
                    return "skip";
                }
            }
            $obj->is_member = $is_member;
            $obj->is_admin = $is_admin;
            $obj->group_details = $group_data;
            break;
        case 'RecentPostModule':
            $obj->type = 'group';
            $obj->gid = $_REQUEST['gid'];
            break;
    }
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:49,代码来源:forum_home.php

示例3: __construct

 /**
  * The default constructor for MembersFacewallModule class.
  * It initializes the default values of vars
  */
 function __construct()
 {
     $this->title = __("Members");
     $this->html_block_id = "members";
     $this->view_all_url = 'view_all_members.php';
     $users = Network::get_members(array('page' => 1, 'show' => 5, 'network_id' => PA::$network_info->network_id));
     $total_users = count($users['users_data']);
     // counting no of relation of each user
     for ($i = 0; $i < $total_users; $i++) {
         $count_relations = Relation::get_relations($users['users_data'][$i]['user_id']);
         $users['users_data'][$i]['no_of_relations'] = count($count_relations);
     }
     $this->links = $users;
     $this->sort_by = TRUE;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:19,代码来源:MembersFacewallModule.php

示例4: initializeModule

 public function initializeModule($request_method, $request_data)
 {
     if (!empty($this->shared_data['group_info'])) {
         $sort = $this->sort_by == 'last_login' ? 'last_login' : 'created';
         $group = $this->shared_data['group_info'];
         $this->gid = $group->collection_id;
         $users = $group->get_members($cnt = FALSE, 5, 1, $sort, 'DESC', FALSE);
         $total_users = count($users);
     } else {
         $this->title = __('Members');
         $net_params = array('page' => 1, 'show' => 5, 'network_id' => PA::$network_info->network_id);
         if ($this->sort_by == 'last_login') {
             $sort = array('sort_by' => 'U.last_login');
             $net_params = array_merge($net_params, $sort);
         }
         $users = Network::get_members($net_params);
         $total_users = count($users['users_data']);
     }
     $users_data = array();
     $status = null;
     if (!empty(PA::$extra['reciprocated_relationship']) && PA::$extra['reciprocated_relationship'] == NET_YES) {
         $status = APPROVED;
     }
     if (!empty($users)) {
         if (!empty($this->shared_data['group_info'])) {
             foreach ($users as $user) {
                 $count_relations = Relation::get_relations($user['user_id'], $status, PA::$network_info->network_id);
                 $group_member = new User();
                 $group_member->load((int) $user['user_id']);
                 $users_data[] = array('user_id' => $user['user_id'], 'picture' => $group_member->picture, 'login_name' => $group_member->login_name, 'display_name' => $group_member->display_name, 'no_of_relations' => count($count_relations));
             }
             $users = array('users_data' => $users_data, 'total_users' => $total_users);
         } else {
             // counting no of relation of each user
             for ($i = 0; $i < $total_users; $i++) {
                 $count_relations = Relation::get_relations($users['users_data'][$i]['user_id'], $status, PA::$network_info->network_id);
                 $curr_user_relations = $count_relations;
                 $users['users_data'][$i]['no_of_relations'] = count($count_relations);
             }
         }
         $this->links = $users;
         $this->sort_by = TRUE;
     } else {
         $this->do_skip = TRUE;
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:46,代码来源:MembersFacewallModule.php

示例5: render

 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;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:19,代码来源:RelationsModule.php

示例6: render

 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;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:20,代码来源:InRelationModule.php

示例7: render

 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;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:21,代码来源:InRelationModule.php

示例8: setup_module

function setup_module($column, $module, $obj)
{
    global $group_data, $gid, $request_info, $is_edit, $edit_data, $member_type;
    $obj->gid = $gid;
    switch ($module) {
        case 'MembersFacewallModule':
            $group = new Group();
            $group->collection_id = $gid;
            $group->is_active = 1;
            $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
            if (is_array($members)) {
                $count = count($members);
                foreach ($members as $member) {
                    $count_relations = Relation::get_relations($member['user_id']);
                    $user = new User();
                    $user->load((int) $member['user_id']);
                    $login_name = $user->login_name;
                    $user_picture = $user->picture;
                    $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
                }
                $users = array('users_data' => $users_data, 'total_users' => $count);
            }
            $obj->links = $users;
            $obj->gid = $gid;
            break;
        case 'ImagesModule':
            $obj->block_type = 'Gallery';
            $obj->page = 'grouppage';
            $obj->title = 'Group Gallery';
            break;
        case 'CreateForumTopicModule':
            if (!$is_edit) {
                return 'skip';
            }
            $obj->edit_data = $edit_data;
            $obj->is_edit = $is_edit;
            break;
    }
}
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:39,代码来源:edit_forum.php

示例9: load_user_profile

 /**
  * Method to load information of selected profile.
  * order by can be applied like $order_by => 'seq' or 'seq DESC' or 'seq ASC'
  */
 public static function load_user_profile($user_id, $my_user_id, $information_type = null, $order_by = null)
 {
     Logger::log("Enter: User::load_user_profile");
     $relations = array();
     $user_profile_data = array();
     $i = 0;
     if (is_null($information_type)) {
         $sql = 'SELECT * FROM {user_profile_data} WHERE user_id = ? ';
         $data = array($user_id);
     } else {
         $sql = 'SELECT * FROM {user_profile_data} WHERE user_id = ? AND field_type = ?';
         $data = array($user_id, $information_type);
     }
     //added for gurpreet
     if (!empty($order_by)) {
         $sql .= ' ORDER BY ' . $order_by;
     }
     $res = Dal::query($sql, $data);
     if ($res->numRows() > 0) {
         while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
             $array_of_data[$i]['uid'] = $row->user_id;
             $array_of_data[$i]['name'] = $row->field_name;
             $array_of_data[$i]['value'] = $row->field_value;
             $array_of_data[$i]['type'] = $row->field_type;
             $array_of_data[$i]['perm'] = $row->field_perm;
             $array_of_data[$i]['seq'] = $row->seq ? (int) $row->seq : NULL;
             $i++;
         }
     }
     if (!empty($array_of_data)) {
         // Getting degree 1 friendlist
         $relations = Relation::get_relations($user_id, null, PA::$network_info->network_id);
         if ($user_id == $my_user_id) {
             //Logged in user is viewing its own blog.
             $user_profile_data = $array_of_data;
         } else {
             if (in_array($my_user_id, $relations)) {
                 //some from user's relations is viewing its blog
                 //check whether relation is in user's family
                 $in_family = Relation::is_relation_in_family($user_id, $my_user_id);
                 foreach ($array_of_data as $user_data) {
                     //user data viewable to family members.
                     if ($user_data['perm'] == IN_FAMILY && $in_family) {
                         $user_profile_data[] = $user_data;
                     }
                     if ($user_data['perm'] == WITH_IN_DEGREE_1 || $user_data['perm'] == ANYONE) {
                         $user_profile_data[] = $user_data;
                     }
                 }
                 //end for
             } else {
                 //user data viewable to user which is not in relation wth given user.
                 foreach ($array_of_data as $user_data) {
                     if ($user_data['perm'] == ANYONE) {
                         $user_profile_data[] = $user_data;
                     }
                 }
             }
         }
     }
     //end outer if
     Logger::log("Exit: User::load_user_profile");
     return $user_profile_data;
 }
开发者ID:CivicCommons,项目名称:people-aggregator,代码行数:68,代码来源:User.php

示例10: __construct

 /**
   Purpose : this function is used to get navigation links for the whole page.
   Scope : public
   @param - it needs no direct input. But works only on the basis of current page initialized in __construct()
   @return - array of links
   **/
 public function get_links($optional = NULL)
 {
     //initialization
     global $page_uid, $login_uid;
     if (isset($_SESSION['user']['id'])) {
         $extra = unserialize($this->network_info->extra);
         if (@$extra['reciprocated_relationship'] == NET_YES) {
             $status = APPROVED;
         } else {
             $status = FALSE;
         }
         $relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status);
         $user_groups = Group::get_user_groups((int) $_SESSION['user']['id']);
         /* $gid isn't defined in this function, so the following call
          * will probably always return FALSE.  To get rid of the warning
          * under E_ALL, I've replaced the following expression with
          * FALSE.  Maybe $gid should be get_group_id()? */
         $is_owner_of_group = FALSE;
         //Group::is_admin($gid,(int)$_SESSION['user']['id']) ;
     }
     if (isset($relations_ids) && sizeof($relations_ids)) {
         $this->set_friend_uid($relations_ids[0]);
     }
     if (isset($user_groups) && sizeof($user_groups)) {
         $this->users_first_group_id($user_groups[0]['gid']);
     }
     if ($login_uid) {
         $this->set_uid($login_uid);
     } else {
         $this->set_anonymous();
     }
     $is_group_content = FALSE;
     if (@$_GET['gid']) {
         $this->set_group_id($_GET['gid']);
     } else {
         if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid'])) {
             $this->set_group_id($_REQUEST['ccid']);
             $is_group_content = TRUE;
         } else {
             if (FILE_CONTENT == $this->current_page && !empty($_GET['cid'])) {
                 try {
                     $content_data = Content::load_content($_GET['cid'], $this->get_uid());
                 } catch (PAException $e) {
                     if ($e->getCode() != CONTENT_NOT_FOUND) {
                         throw $e;
                     }
                 }
                 if (isset($content_data)) {
                     if ($content_data->parent_collection_id > 0) {
                         $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
                         if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
                             $this->set_group_id($content_data->parent_collection_id);
                             $is_group_content = TRUE;
                         }
                     }
                 }
             }
         }
     }
     //test
     //$this->current_page='test.php';
     // make links for current page
     $this->make_links();
     $level_1 = $this->get_level_1();
     $level_2 = $this->get_level_2();
     $level_3 = NULL;
     $left_user_public_links = NULL;
     if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) {
         $level_3 = $this->get_level_3('network');
     } else {
         if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) {
             $level_3 = $this->get_level_3('network');
         }
     }
     $level_3 = NULL;
     switch ($this->current_page) {
         /*----------------------------------------------------*/
         case FILE_HOMEPAGE:
             $level_3 = NULL;
             $level_2['highlight'] = 'home';
             break;
         case FILE_LOGIN:
             $level_2['highlight'] = 'home';
             break;
         case FILE_SEARCH_HOME:
             $level_2['highlight'] = 'search';
             break;
         case FILE_TAG_SEARCH:
             $level_2['highlight'] = 'tag_search';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_USER:
         case FILE_USER_BLOG:
//.........这里部分代码省略.........
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:Navigation.php

示例11: Category

    $group_details['category_id'] = $group->category_id;
    $cat_obj = new Category();
    $cat_obj->set_category_id($group->category_id);
    $cat_obj->load();
    $cat_name = stripslashes($cat_obj->name);
    $cat_description = stripslashes($cat_obj->description);
    $group_details['category_name'] = $cat_name;
    $group_details['category_description'] = $cat_description;
    $group_details['members'] = Group::get_member_count($gid);
    $group_details['access_type'] = $access_type;
    $group_details['is_admin'] = $is_admin;
    //////////////////get details of group EOF
    if (is_array($members)) {
        $count = count($members);
        foreach ($members as $member) {
            $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id);
            $user = new User();
            $user->load((int) $member['user_id']);
            $login_name = $user->login_name;
            $user_picture = $user->picture;
            $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
        }
        $final_array = array('users_data' => $users_data, 'total_users' => $count);
    }
    $users = $final_array;
    if (isset($_SESSION['user']['id']) && Group::member_exists((int) $group->collection_id, (int) $_SESSION['user']['id'])) {
        $is_member = TRUE;
    }
    $group_details['is_member'] = $is_member;
    //..get details of group ends
}
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:31,代码来源:cnshowcontent.php

示例12: load_recent_media_image

 public static function load_recent_media_image($user_id = 0, $my_user_id = 0)
 {
     Logger::log("Enter: Image::load_recent_media_image | Arg: \$user_id = {$user_id}");
     Logger::log("Calling: Content::load | Param: \$my_user_id = {$my_user_id}");
     $i = 0;
     if ($user_id == 0) {
         $sql = "SELECT * FROM {contents} AS C, {images} as I,{recent_media_track} as R WHERE C.content_id = I.content_id AND I.content_id=R.cid  AND R.type = ? AND I.image_perm = ? AND C.is_active = ? ORDER by C.created DESC ";
         $data = array(IMAGE, ANYONE, 1);
     } else {
         $sql = "SELECT * FROM {contents} AS C, {images} as I , {recent_media_track} as R WHERE C.content_id = I.content_id AND I.content_id=R.cid  AND R.type = ? AND C.author_id = ? AND C.is_active = ? ORDER by C.created DESC ";
         $data = array(IMAGE, $user_id, 1);
     }
     $res = Dal::query($sql, $data);
     if ($res->numRows() > 0) {
         while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
             $image_data[$i]['content_id'] = $row->content_id;
             $image_data[$i]['image_file'] = $row->image_file;
             $image_data[$i]['caption'] = $row->title;
             $image_data[$i]['title'] = $row->title;
             $image_data[$i]['body'] = $row->body;
             $image_data[$i]['created'] = $row->created;
             $image_data[$i]['collection_id'] = $row->collection_id;
             $image_data[$i]['perm'] = $row->image_perm;
             $image_data[$i]['author_id'] = $row->author_id;
             $i++;
         }
     }
     $user_image_data = array();
     if (!empty($image_data) && $my_user_id != 0) {
         // getting degree 1 friendlist
         $relations = Relation::get_relations($my_user_id);
         if ($user_id == $my_user_id) {
             $user_image_data = $image_data;
         } elseif (in_array($my_user_id, $relations)) {
             foreach ($image_data as $user_data) {
                 if ($user_data['perm'] == WITH_IN_DEGREE_1 || $user_data['perm'] == ANYONE) {
                     $user_image_data[] = $user_data;
                 }
             }
         } elseif ($my_user_id == 0) {
             foreach ($image_data as $user_data) {
                 if ($user_data['perm'] == WITH_IN_DEGREE_1 || $user_data['perm'] == ANYONE) {
                     $user_image_data[] = $user_data;
                 }
             }
         } else {
             foreach ($image_data as $user_data) {
                 if ($user_data['perm'] == ANYONE) {
                     $user_image_data[] = $user_data;
                 }
             }
         }
     } else {
         if ($user_id == $my_user_id && $my_user_id != 0) {
             $user_image_data = $image_data;
         } else {
             if ($my_user_id == 0 && !empty($image_data)) {
                 foreach ($image_data as $user_data) {
                     if ($user_data['perm'] == ANYONE) {
                         $user_image_data[] = $user_data;
                     }
                 }
             }
         }
     }
     Logger::log("Exit: Image::load_recent_media_image");
     return $user_image_data;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:68,代码来源:Image.php

示例13: array

$sorting_options[] = array('caption' => __('Last Login'), 'value' => 'last_login');
$sorting_options[] = array('caption' => __('Latest Registered'), 'value' => 'latest_registered');
if (CURRENT_NETWORK_URL_PREFIX != 'www' && CURRENT_NETWORK_URL_PREFIX != '') {
    $network = new Network();
    $where = "address = '" . CURRENT_NETWORK_URL_PREFIX . "'";
    $netinfo = $network->get(NULL, $where);
    $params = array('page' => 1, 'show' => 5);
    if ($sort_by == 'last_login') {
        $a = array('sort_by' => 'U.last_login');
        $params = array_merge($params, $a);
    }
    $users = Network::get_network_members($netinfo[0]->network_id, $params);
} else {
    if ($sort_by == 'last_login') {
        $users = User::allUsers(10, 'last_login', 5);
    } else {
        if ($sort_by == 'latest_registered') {
            $users = User::allUsers(10, 'latest', 5);
        }
    }
    for ($i = 0; $i < count($users['users_data']); $i++) {
        $count_relations = Relation::get_relations($users['users_data'][$i]['user_id']);
        $users['users_data'][$i]['no_of_relations'] = count($count_relations);
    }
}
$obj = new MembersFacewallModule();
$obj->mode = $obj->sort_by = SORT_BY;
$obj->links = $users;
$obj->sorting_options = $sorting_options;
$obj->selected_option = $selected_option;
echo $obj->render();
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:ajax_sortby.php

示例14: generate_inner_html

 /** !!
  * This generates the page specific html to be passed on to the render function.
  * It uses the standard templates to achieve this. It also determines the
  * type of activity that each data is, depending on what type of page
  * it is and the type of activity being reported.
  *
  * @return string $inner_html  The aforementioned page specific html
  */
 function generate_inner_html()
 {
     $params = array('limit' => $this->limit);
     $conditions = array();
     switch ($this->page_type) {
         case 'group':
             $params['activity_type'] = array('group_joined', 'group_image_upload', 'group_video_upload', 'group_audio_upload', 'group_post_a_blog', 'group_settings_updated');
             $conditions['object'] = $this->subject;
             $this->selected = 1;
             break;
         case 'user_public':
             $conditions['subject'] = $this->subject;
             $this->selected = 3;
             break;
         case 'user_private':
         case 'user_friends':
             $params['relation_ids'] = Relation::get_relations(PA::$login_uid, APPROVED, PA::$network_info->network_id);
             if (count($params['relation_ids']) == 0) {
                 $this->do_skip = TRUE;
                 return '<div style="margin:8px">No Feeds</div>';
             }
             $this->selected = 2;
             break;
     }
     $conditions['status'] = 'new';
     $tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl';
     $inner_html_gen = new Template($tmp_file);
     $list = Activities::get_activities($params, $conditions);
     if (empty($list)) {
         $this->do_skip = TRUE;
         return '<div style="margin:8px">No Feeds</div>';
     }
     $inner_html_gen->set('list', $list);
     $inner_html_gen->set('options', $this->sel_options);
     $inner_html_gen->set('selected_option', $this->selected);
     $inner_html_gen->set('ajax_url', $this->ajax_url);
     $inner_html_gen->set('block_name', $this->html_block_id);
     $inner_html_gen->set('request_method', $this->request_method);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:49,代码来源:ActivitiesModule.php

示例15: get_users

 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);
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:49,代码来源:FacewallWidgetModule.php


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