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

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');
require_once('../includes/date.inc.php');

$id = (isset($_GET['id']))      ?       $_GET['id']       :       0;
$page = isset($_GET['page'])        ?       $_GET['page']       :       0;

$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 $htmlTabs;

//group control: check if the user user has access to the group notebook.
include_once('../../../../notebook/groupsecurity.inc.php');
if ($userIsMemberOfGroup == 0) {
    echo generate_warning('alert',lg("NotCorrectGroup"),'','');
    echo "</div>";
    echo "</div>";
	echo generate_footer("group");
	exit();
}

$DB->getResults($notebook_getGroupbookProperties,$DB->escape($_SESSION['user_id']),$DB->escape($id));
$nbRes = $DB->nbResults();
if ($nbRes == 0) {
	echo generate_warning('info',''.lg("NotCorrectGroup").'','','');
    echo "</div>";
    echo "</div>";
	echo generate_footer("group");
	exit();
}
$row = $DB->fetch(0);
$description = $row['description'];
if (strlen($description)>75) {
    $description = formatString($description,75).'...';
}
echo '
      <div class="users">
        <div class="title">
            <img src="../../../'.displayPicture($row['picture']).'" class="avatar" width="50" height="50" style="float: left;margin-right: 5px;">
            <span>'.$row['name'].'</span>
        </div>';
            if ($description != '') echo '<div class="subtitle">'.$description.'</div>';  
echo '	<div class="links">
                <a href="group_members.php?id='.$id.'" class="greylink">'.lg("network").'</a> |';
    echo '      <a href="groupbook.php?id='.$id.'" class="greylink">'.lg("publications").'</a>';
echo '
        </div>
      </div>';
$DB->freeResults();

echo '<form method="post" action="scr_addgroupnotebook.php">
        <br /><span><b>'.lg("title").'</b></span><br />
        <input type="text" name="title" style="width: 90%"><br /><br />
        <span><b>'.lg("tags").' ('.lg("comaSeparated").')</b></span><br />
        <input type="text" name="tags" style="width: 90%"><br /><br />
        <span><b>'.lg("defineArticleAccess").'</b></span><br />
        <select name="access">
			<option value="3">'.lg("groupRestrictedArticle").'</option>';
        if (__NETWORK_TYPE == 'R')
echo '      <option value="2">'.lg("memberRestrictedArticle").'</option>';
echo '  	<option value="1">'.lg("noteprivateArticle").'</option>
        </select><br /><br />
        <span><b>Description</b></span><br />
        <textarea name="'.lg("description").'" rows="10" style="width: 90%"></textarea><br /><br />
        <input type="hidden" name="group_id" value="'.$id.'">
        <center><input type="submit" class="minibtn" value="'.lg("add").'">&nbsp;&nbsp;
                <a href="groupbook.php?id='.$id.'"><input type="button" value="'.lg('cancel').'" name="cancel"/></a>
        </center>
	 </form>';
  
echo '</div>';
echo '</div>';
  
echo generate_footer("group");

?>