root/trunk/inc/friends/list.inc.php

Revision 22, 3.1 KB (checked in by alexx, 7 years ago)

fix [21] (bad spelled variable + bad colspan in template)

Line 
1<?php
2/****************************************************** Open .node ***
3 * Description:   
4 * Status:        Stable.
5 * Author:        Alexandre Dath <alexandre@dotnode.com>
6 * $Id$
7 *
8 * Copyright (C) 2005 Alexandre Dath <alexandre@dotnode.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 ******************** http://opensource.ikse.net/projects/dotnode ***/
24
25include_once(INCLUDESPATH.'/pager.inc.php');
26
27$_SMARTY['Title'] =  'Friends';
28
29$user['info'] = get_cache_user_info($url_id);
30$user['photo'] = build_image_url($url_id);
31
32$pager =& Pager_dotnode::factory(null, array('totalItems' => $user['info']['nb_friends'], 'perPage' => 15));
33
34list($first_item, $last_item) = $pager->getOffsetByPageId();
35$limit_offset = $first_item-1;
36$limit_length = $last_item-$limit_offset;
37
38$friends_range = array_slice($user['info']['friends_id'], $limit_offset, $limit_length);
39foreach($friends_range as $dummy=>$friend_id)
40        $friends[$friend_id] = get_cache_user_info($friend_id);
41
42/********** determination du chemin *****************/
43$user['path'] = array();
44
45if($url_id == $_SESSION['my_id'])
46{
47        $user['relation_type'] = 'myself';
48}
49elseif(in_array($url_id, $_SESSION['my_friends_id']) )
50{
51        $user['relation_type'] = 'friends';
52        $user['path'][$_SESSION['my_id']] = $_SESSION['my_fname'];
53        $user['path'][$url_id] = $user['info']['fname'];
54}
55elseif($intermediaire = array_intersect($_SESSION['my_friends_id'], $user['info']['friends_id']))
56{
57    sort($intermediaire);
58        $user['relation_type'] = 'friends_of_friends';
59        $user['path'][$_SESSION['my_id']] = $_SESSION['my_fname'];
60        $user['path'][$intermediaire[0]] = $friends[$intermediaire[0]]['fname'];
61        $user['path'][$url_id] = $user['info']['fname'];
62}
63else
64        $user['relation_type'] = 'members';
65
66/************** menu ***************************/
67$leftmenu["/profile/$url_id"] = 'Profile';
68
69if($user['info']['nb_photos'] > 0)
70        $leftmenu["/album/$url_id"] = 'Album';
71
72if($user['info']['nb_blogs'] > 0)
73        $leftmenu["/blog/$url_id"] = 'Blog';
74
75if($user['info']['nb_bookmarks'] > 0)
76        $leftmenu["/bookmarks/$url_id"] = 'Bookmarks';
77
78$_SMARTY['leftmenu'] = $leftmenu;
79/************************************************/
80
81$_SMARTY['tr_attr'] = array("class='odd' style='vertical-align:top'", "class='even' style='vertical-align:top'");
82$_SMARTY['user'] =  $user;
83$_SMARTY['pager'] = $pager->getLinks();
84$_SMARTY['friends'] =  $friends;
85?>
Note: See TracBrowser for help on using the browser.