<?php
  ///////////////////////////////////////////////////
  //Выдать книгу
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

 require_once "../utils/chlang.php";

  $title = $TEXT['book-nal-tit'];
  $button = $TEXT['btn-vip'];
  $action = "nal_off.php";
?>
<script type="text/javascript" language="JavaScript" src="../lang/<?php echo $lang; ?>/calendar.js"></script>
<?php
  require_once "../config_a.php";
  require_once "../utils/functions.php";
  require_once "../utils/top_adm.php";

  if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm.php"; exit();}

  if(empty($_GET['book_id'])) {puterror($result2['skin'],$TEXT['error-book5']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_GET['book_id'])>20) {puterror($result2['skin'],$TEXT['error-book6']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_GET['user_id'])>15) {puterror2($result2['skin'],$TEXT['error-login14']); require_once "utils/bottom.php"; exit();}
  $_GET['book_id'] = rep($_GET['book_id']);
  $_GET['user_id'] = rep($_GET['user_id']);

  $date_day = date("d");
  $date_month = date("m");
  $date_year = date("Y");
  $chislo = (date("$date_year\-$date_month\-$date_day"));

?>
<table align="center" width="98%" border="0">
<form name='book' enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<tr>
<td width="42%" align="left">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-nal-tit']; ?>"><?php echo $TEXT['book-nal-tit']; ?></legend>
<table align="left" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-data3']; ?>:&nbsp;</td><td><input size=10 maxlength=10 type=text name=data_vidachi value='<?php echo $chislo; ?>' />
<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'book',
		// input name
		'controlname': 'data_vidachi'
	});
	</script></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-data4']; ?>:&nbsp;</td><td><input size=10 maxlength=10 type=text name=data_sdachi value='<?php echo $chislo; ?>' />
<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'book',
		// input name
		'controlname': 'data_sdachi'
	});
	</script></td></tr>
<tr><td class="inform"><?php echo $TEXT['user-tit']; ?>:&nbsp;</td><td>
    <select name="user_id">
    <?php
        $query10 = "SELECT login_id,  name, familiya, otchestvo FROM `tbl_logins` ORDER BY familiya ";
          $result10 = mysqli_query($dbcnx,$query10);
            if (!$result10) {puterror($result2['skin'],$TEXT['error-tbl7']); require_once "../utils/bottom_adm.php"; exit();}
              while($result_login = mysqli_fetch_array($result10))
                {
                    if($result_login['login_id'] == $_GET['user_id']) {$chk_login = "<option selected value=".$result_login['login_id'].">".$result_login['familiya']."&nbsp;".$result_login['name']."&nbsp;".$result_login['otchestvo']."";}
                    else {$chk_login = "<option value=".$result_login['login_id'].">".$result_login['familiya']."&nbsp;".$result_login['name']."&nbsp;".$result_login['otchestvo']."";}
                 echo $chk_login;
                }
    ?>
    </select></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-napom']; ?>:&nbsp;</td><td><input type=checkbox name=napominalka /></td></tr>
</table>
</fieldset>
</td>
<td width="42%" align="right">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-nal-off2-tit']; ?>"><?php echo $TEXT['book-nal-off2-tit']; ?></legend>
<table align="right" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-prichina']; ?>:&nbsp;</td><td><input size=20 maxlength=255 type=text name=prichina  /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-nal-off2']; ?>:&nbsp;</td><td><input type=checkbox name=naloff /></td></tr>
</table>
</fieldset>
<tr><td><input type=submit value='<?php echo $button; ?>'>
<input type=hidden name=book_id value='<?php echo $_GET['book_id']; ?>'>
</td></tr>
</form>
</table>
<?php
  require_once "../utils/bottom_adm.php";
?>