<?
include($_SERVER["DOCUMENT_ROOT"]."/php/cookie.php");
include($_SERVER["DOCUMENT_ROOT"]."/php/default.php");
connect();
?>
<?
if (!isset($page_id)){$page_id=37;}
//get_meta($page_id);
?>
<? $page_name="feedback";?>
	<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
	<html><head>
	<title><? if ($meta_title<>"") {?><?=$meta_title?><? } else {?>Стеллажи<? } ?></title>
	<META NAME="description" CONTENT="<? if ($meta_descr<>"") {?><?=$meta_descr?><? } else {?>Стеллажи<? } ?>">
	<META NAME="keywords" CONTENT="<? if ($meta_key<>"") {?><?=$meta_key?><? } else {?>Стеллажи<? } ?>">
	<? include($_SERVER["DOCUMENT_ROOT"]."/php/top_head.php"); ?>
	<script type="text/javascript" src="/feedback/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="/feedback/js/uploader.js"></script>
</head>
<? include($_SERVER["DOCUMENT_ROOT"]."/top.php"); ?>
<div class="sidebar <?=$colClass?>-3">
	<? include($_SERVER["DOCUMENT_ROOT"]."/inc.right.php"); ?>
</div>
<div class="inner-content <?=$colClass?>-9">
	<?
	// COLUM CENTR START ++++++++++++++
	//
	?>
	<? //page_out($page_id);?>
	<?
	include($_SERVER['DOCUMENT_ROOT']. '/feedback/Img.php');
	//
	// COLUM CENTR END  -----------------------
	$res = mysql_query("SELECT * FROM `feedback` WHERE `id`='".(int)$_GET['id']."'");
	$row = mysql_fetch_assoc($res);
	?>
	<h2>Редактировать отзыв</h2>
	<form id="f_form2">
		<div class="form-group">
			<label>Ваше имя*</label>
			<input type="text" class="form-control" name="name" value="<?=$row['name']?>">
		</div>

		<div class="form-group">
			<label>Email</label>
			<input type="text" class="form-control" name="email" value="<?=$row['email']?>">
		</div>

		<div class="form-group">
			<label>Комментарий*</label>
			<textarea class="form-control" name="text"><?=$row['text']?></textarea>
		</div>

		<div class="well">
			<div id="f_images2">
				<?php
				$res2 = mysql_query("SELECT * FROM `feedback_images` WHERE `feedback_id`='".$row['id']."' ");
				$i = 0;
				while($row2 = mysql_fetch_assoc($res2)){
					if(!file_exists($_SERVER['DOCUMENT_ROOT']. '/feedback/images/'.$row2['name'])) continue;
					$img = Img::get('/feedback/images/'.$row2['name'], array('crop'=>true));
					?>
					<div class="f-preview" data-id="<?=$i?>">
						<a href="/feedback/images/<?=$row2['name']?>" rel="prettyPhoto[gal<?=$row['id']?>]"><img src="<?=$img?>"></a>
						<div><button data-id="<?=$i?>" data-bid="<?=$row2['id']?>" class="btn btn-danger btn-xs f-image-remove" type="button"><b>X</b></button></div>

					</div>
					<? ++$i; } ?>

			</div>
			<div class="clearfix"></div>
		<span class="btn btn-success fileinput-btn" ><i class="fa fa-plus"> Добавить фото</i>
		<input type="file" multiple name="img"></span>
		</div>

		<div class="alert alert-danger f-error" id="f_name_error2" style="display: none;">Укажите ваше имя</div>
		<div class="alert alert-danger f-error" id="f_text_error2" style="display: none;">введите текст комментария</div>

		<button type="submit" class="btn btn-default" id="f_submit_btn2"><i class="fa fa-check"></i> Отправить</button>
		<p class="help-block">*Обязательное поле</p>
		<input type="hidden" name="id" value="<?=$row['id']?>">
		<input type="hidden" name="url" value="edit_save">
	</form>

	<?
	if($admin == 'admin') include $_SERVER['DOCUMENT_ROOT'].'/feedback/feedback_admin.js.php';
	//
	// COLUM RIGHT END ------------------------
	?>
</div>
<?include ($DOCUMENT_ROOT."/bottom.php");?>