<?php 
# ************** LICENCE ****************
/*
	Copyright (c) PORTANEO.
*/
# ***************************************
# Display portal
#
# !! be careful, this file must be saved under uft8 format, and display an e accentuated here : é
# ***************************************
$not_access=1;
$granted="I";

$page = (isset($_GET['page']))      ?       $_GET['page']       :       0;
$filter = (isset($_GET['filter']))      ?       $_GET['filter']     :       'all';
require_once('includes_mobile.php');
require_once('../../../../db_layer/'.__DBTYPE.'/portal.php');
require_once('../includes/template.inc.php');
require_once('../../../../db_layer/'.__DBTYPE.'/enterprise.php');

$selectedTab = '';
$tabs = array();
$htmlTabs = '';
$previousStr = '';
$nextStr = '';
$message = (isset($_GET['message']))        ?       $_GET['message']        :   '';

if (isset($_GET['tab']) && !empty($_GET['tab'])) {
	$selectedTab = $_GET['tab'];
}

$options = defineHeader();
     
echo page_begining();

echo '<div id="header">';
    echo generate_header($options,$message);
echo '</div>';

echo '<div id="wrapper">';
echo '<div id="page">';		

echo generate_statusform("network.php");

echo '<div class="page_title"><span>'.lg('myNetwork').'</span></div>';

$DB->getResults($mobNetwork_getFriends,$DB->escape($_SESSION['user_id']),$DB->escape($page));      
$nbRes = $DB->nbResults();
if ($nbRes == 0) {
	echo generate_warning('info',''.lg("nobody_network").'','','');
    echo "</div>";
    echo "</div>";
	echo generate_footer("network");
	exit();
}

$inc=0;
while(($row = $DB->fetch(0)) && $inc<5) {
	$idfriend = $row['friend_id'];
    
	echo '
		  <div class="users">
			<div class="title">
                <a href="notebook_articles.php?id='.$idfriend.'&page=0"><img src="../../../'.displayPicture($row['picture']).'" class="avatar" width="50" height="50" style="float: left;margin-right: 5px;"></a>
                <a href="notebook_articles.php?id='.$idfriend.'&page=0">'.$row['long_name'].' '.$row['firstname'].'</a>
			</div>';
                if ($row['stat']!='') echo '<div class="subtitle">'.$row['stat'].'</div>';  
	echo '	<div class="links"><a href="network_delete_confirm.php?id='.$idfriend.'&add=0">'.lg("remove").'</a> | 
                               <a href="notebook_articles.php?id='.$idfriend.'&page=0">'.lg("hisnotebook").'</a>
            </div>
		  </div>';
          
	$inc++;
}
$DB->freeResults();

if ($page!=0) {
	$previousStr = '<a href="network.php?page='.($page-5).'&filter='.$filter.'">'.lg("page_back").'</a>';
}
if ($nbRes == 6) {
	$nextStr = '<a href="network.php?page='.($page+5).'&filter='.$filter.'">'.lg("page_next").'</a>';
}
		
echo '<center><div>'.$previousStr.' &nbsp;&nbsp; '.$nextStr.'</div></center>'; 

echo "</div>";
echo "</div>";

echo generate_footer("network");
?>