<?
$dom = new DOMDocument;
$dom->load(ROOT . 'crmdata/database/notebooks/notebook-' . $LoginCheck . '.xml');
$xpath = new DOMXPath($dom);
$notes = $xpath->query('/notes/note[@id="'.$_GET['view'].'"]');
foreach ($notes as $note) {
	$NoteId 		= $note->getAttribute('id');
	$NoteName		= $note->getElementsByTagName("notename")->item(0)->nodeValue;
	$NoteDescr		= $note->getElementsByTagName("notedescr")->item(0)->nodeValue;
	$NoteDate		= $note->getElementsByTagName("notedate")->item(0)->nodeValue;
}
?>
<div class="col-lg-12 col-md-12 col-sm-12">
	<h1><?php echo $NoteName; ?></h1>
	<div class="row">
		<div class="col-lg-3">
			<div class="row">
				<div class="col-lg-12 col-md-12 col-sm-12 col-xs-4">
					<div class="big-photo empty" style="background:#555a68;"><i class="fa fa-fw fa-file-text-o" aria-hidden="true"></i></div>
				</div>
				<div class="col-lg-12 col-md-12 col-sm-12 col-xs-8">
					<div class="btn-group btn-group-justified" style="width:100%;margin:0px 0px 10px 0px;">
						<?php if (isset($TaskUser) AND $TaskUser == $LoginCheck or isset($GroupCheck) AND $GroupCheck == 'admin' or isset($GroupCheck) AND $GroupCheck == 'manager') { ?>
						<a href="/<?php echo $folder; ?>/notes/?edit=<?php echo $NoteId; ?>" class="btn btn-default">Изменить</a>
						<?php } ?>
						<a href="javascript: ;" id="print" class="btn btn-default">На печать</a>
					</div>
				</div>
			</div>
		</div>
		<div class="col-lg-9">
		
			<ul class="nav nav-tabs" id="admin-tabs">
				<li class="active"><a data-toggle="tab" href="#info">Описание</a></li>
				<li><a data-toggle="tab" href="#files">Файлы (<?php echo count_dir_files($_GET['view']); ?>)</a></li>
			</ul>
			
			<div class="tab-content" id="to_print">
				<div id="info" class="tab-pane fade in active">
					<table class="hide table view_table_mobile">
						<tbody>
							<tr class="hide">
								<td>Название заметки:</td>
								<td><?php echo $NoteName; ?></td>
							</tr>
							<tr class="hide">
								<td width="35%" style="border:none;"><i class="fa fa-fw fa-calendar-plus-o" aria-hidden="true"></i> Дата добавления заметки:</td>
								<td style="border:none;"><?php echo $NoteDate;?></td>
							</tr>
						</tbody>
					</table>
					<form method="POST" name="form_user" id="formedit" enctype="multipart/form-data">
						<div class="row" style="margin-top:0px;">
							<div class="form-group col-lg-12 editor-form">
								<textarea class="form-control " name="inputComment" id="inputComment" rows="10" cols="80" placeholder="Текст заметки"><?php if(isset($NoteDescr)){echo $NoteDescr;} ?></textarea>
							</div>
						</div>
						<button type="submit" name="SaveDescription" class="btn btn-md btn-info" style="color:#fff;"><i class="fa fa-fw fa-save" aria-hidden="true"></i> Сохранить описание</button>
					</form>
				</div>
				<div id="files" class="tab-pane fade">
					<?php if(isset($_GET['view'])) { require_once(ROOT . 'functions/func-upload-file.php'); } ?>
				</div>
			</div>
		</div>
	</div>
</div>