<?php
///////////////////////////////////////////////////
//2010 (C)
//Карпухин Павел
///////////////////////////////////////////////////
require_once "../utils/chlang.php";

$title = $TEXT['film-title'];
$button = $TEXT['btn_add'];
$action = "add.php";
$visible = "checked";

require_once "../config_a.php";
require_once "../utils/functions.php";
require_once "../utils/top_adm_film.php";

if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm_film.php"; exit();}
if(empty($_GET['film_name']) && !empty($_POST['film_name']))
 {
 if(strlen($_POST['film_name'])>255) {puterror($result2['skin'],$TEXT['error-film2']); require_once "../utils/bottom_adm_film.php"; exit();}
 $film_name = rep($_POST['film_name']);
 }
  elseif(empty($_POST['film_name']) && !empty($_GET['film_name']))
  {
   if(strlen($_GET['film_name'])>255) {puterror($result2['skin'],$TEXT['error-film2']); require_once "../utils/bottom_adm_film.php"; exit();}
   $film_name = rep($_GET['film_name']);
  }
  else {$film_name = "";}
?>
<script type="text/javascript" language="JavaScript" src="../lang/<?php echo $lang; ?>/calendar.js"></script>
<form name='film' enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table align="center" width="98%" border="0">
<tr>
<td width="42%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['film-info']; ?>"><?php echo $TEXT['film-info']; ?></legend>
<table align="left" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['film-name']; ?>:</td><td><input size=40 maxlength=127 type=text name=film_name value="<?php echo $film_name; ?>"/></td></tr>
<tr><td class="inform"><?php echo $TEXT['film-rezhiser']; ?>:</td><td><input size=40 maxlength=127 type=text name=autors /></td></tr>
<tr><td class="inform">&#8470; <?php echo $TEXT['global-now-film2']; ?>:</td><td><input size=3 maxlength=3 type=text name=film_num /></td></tr>
<tr><td class="inform"><?php echo $TEXT['film-prod']; ?>:</td><td><input size=3 maxlength=3 type=text name=prod_min /></td></tr>
<tr><td class="inform"><?php echo $TEXT['film-subtit']; ?>:</td><td>
 <select name=subtitle>
  <option value='1' selected ><?php echo $TEXT['book-zad-yes']; ?>
  <option value='2' ><?php echo $TEXT['book-zad-no']; ?>
 </select>
</td></tr>
<tr><td class="inform"><?php echo $TEXT['book-opis']; ?>:</td><td><textarea class="input" cols="38" rows="5" name=opisanie ></textarea></td></tr>
<tr><td class="inform"><?php echo $TEXT['film-soderzh']; ?>:</td><td><textarea class="input" cols="38" rows="5" name=oglavlenie ></textarea></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-show5']; ?>:</td><td><input type=checkbox name=zakupka /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-show']; ?>:</td><td><input type=checkbox name=visible <?php echo $visible; ?> /></td></tr>
</table>
</fieldset>
</td>
<td width="42%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset2-tit']; ?>"><?php echo $TEXT['book-fldset2']; ?></legend>
<table align="right" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-data']; ?>:</td><td><input size=4 maxlength=4 type=text name=data_izdaniya /></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-data2']; ?>:</td><td><input size=10 maxlength=10 type=text name=data_postupleniya />
<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'film',
		// input name
		'controlname': 'data_postupleniya'
	});
	</script></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-zhanr/addform.php' target="_blank"><?php echo $TEXT['book-zhanr']." ".$TEXT['global-now-film2']; ?>:</a></td><td>
    <select name="zhanr_id">
    <?php
        $query10 = "SELECT * FROM `tbl_zhanr` WHERE use_prog='2' ORDER BY `zhanr`";
          $result10 = mysqli_query($dbcnx,$query10);
            if(!$result10) {puterror($result2['skin'],$TEXT['error-tbl14']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_zhanr = mysqli_fetch_array($result10))
                {
                 $chk_zhanr = "<option value=".$result_zhanr['zhanr_id'].">".$result_zhanr['zhanr']."";
                 echo $chk_zhanr;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-seriya/addform.php' target="_blank"><?php echo $TEXT['menu-btn29-title-film']; ?>:</a></td><td>
    <select name="ser_id">
    <?php
        $queryser = "SELECT * FROM `tbl_seriya` WHERE use_prog='2' ORDER BY `seriya` ";
          $resultser = mysqli_query($dbcnx,$queryser);
            if(!$resultser) {puterror($result2['skin'],$TEXT['error-tbl21']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_seriya = mysqli_fetch_array($resultser))
                {
                 $chk_seriya = "<option value=".$result_seriya['ser_id'].">".$result_seriya['seriya']."";
                 echo $chk_seriya;
                }
    ?>
    </select></td></tr>

<tr><td  class="inform"><a class="inform" href='../film-cicl/addform.php' target="_blank"><?php echo $TEXT['menu-btn17']." ".$TEXT['global-now-film']; ?>:</a></td><td>
    <select name="cicle_id">
    <?php
        $query11 = "SELECT * FROM `tbl_cicle` WHERE use_prog='2' ORDER BY `cicle` ";
          $result11 = mysqli_query($dbcnx,$query11);
            if(!$result11) {puterror($result2['skin'],$TEXT['error-tbl5']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_cicle = mysqli_fetch_array($result11))
                {
                 $chk_cicle = "<option value=".$result_cicle['cicle_id'].">".$result_cicle['cicle']."";
                 echo $chk_cicle;
                }
    ?>
    </select></td></tr>
<tr><td class="inform"><a class="inform" href='../film-vozrast/addform.php' target="_blank"><?php echo $TEXT['menu-btn38-title']; ?>:</a></td><td>
    <select name="vozr_id">
    <?php
        $query17 = "SELECT * FROM `tbl_vozrast` ORDER BY `vozrast`";
          $result17 = mysqli_query($dbcnx,$query17);
            if(!$result17) {puterror($result2['skin'],$TEXT['error-tbl24']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_bl = mysqli_fetch_array($result17))
                {
                 $chk_bl = "<option value=".$result_bl['vozr_id'].">".$result_bl['vozrast']."";
                 echo $chk_bl;
                }
    ?>
    </select></td></tr>
<tr><td class="inform"><a class="inform" href='../film-sound/addform.php' target="_blank" title="<?php echo $TEXT['menu-btn37-title']; ?>"><?php echo $TEXT['menu-btn37']; ?>:</a></td><td>
    <select name="bl_id">
    <?php
        $query18 = "SELECT `bl_id`,`booklang` FROM `tbl_booklang` WHERE use_prog='2' ORDER BY `position`, `booklang` ";
          $result18 = mysqli_query($dbcnx,$query18);
            if(!$result18) {puterror($result2['skin'],$TEXT['error-tbl23']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_bl = mysqli_fetch_array($result18))
                {
                 $chk_snd = "<option value=".$result_bl['bl_id'].">".$result_bl['booklang']."";
                 echo $chk_snd;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-nositel/addform.php' target="_blank"><?php echo $TEXT['nositel-title']; ?>:</a></td><td>
    <select name="tip_izd_id">
    <?php
        $query12 = "SELECT * FROM `tbl_tip_izd` WHERE use_prog='2' ORDER BY `position`, `tip_izd` ";
          $result12 = mysqli_query($dbcnx,$query12);
            if(!$result12) {puterror($result2['skin'],$TEXT['error-tbl15']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_izd = mysqli_fetch_array($result12))
                {
                 $chk_izd = "<option value=".$result_izd['tip_izd_id'].">".$result_izd['tip_izd']."";
                 echo $chk_izd;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><?php echo $TEXT['user-photo']; ?>:</td><td><input size=20 type=file name=photo  /></td></tr>
<tr><td  class="inform"><?php echo $TEXT['photo_obr']; ?>:</td><td>
 <select name=photo_obr>
  <option value='1' selected><?php echo $TEXT['photo_no']; ?>
  <option value='2' ><?php echo $TEXT['photo_rec_l']; ?>
  <option value='4' ><?php echo $TEXT['photo_rec_l_t']; ?>
  <option value='6' ><?php echo $TEXT['photo_rec_l_r']; ?>
 </select>
</td></tr>
<tr><td  class="inform"><?php echo $TEXT['book-ebook']; ?>:</td><td><input size=20 type=file name=efilm  /></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-libr/addform.php' target="_blank"><?php echo $TEXT['global-film']; ?>:</a></td><td>
    <select name="bibl_id">
    <?php
        $query13 = "SELECT name, bibl_id FROM `tbl_biblioteka` ORDER BY `name` ";
          $result13 = mysqli_query($dbcnx,$query13);
            if(!$result13) {puterror($result2['skin'],$TEXT['error-tbl2']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_libr = mysqli_fetch_array($result13))
                {
                 $chk_libr = "<option value=".$result_libr['bibl_id'].">".$result_libr['name']."";
                 echo $chk_libr;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-zal/addform.php' target="_blank"><?php echo $TEXT['book-zal']; ?>:</a></td><td>
    <select name="zal_id">
    <?php
        $query14 = "SELECT * FROM `tbl_zal` ORDER BY `zal` ";
          $result14 = mysqli_query($dbcnx,$query14);
            if(!$result14) {puterror($result2['skin'],$TEXT['error-tbl11']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_zal = mysqli_fetch_array($result14))
                {
                 $chk_zal = "<option value=".$result_zal['zal_id'].">".$result_zal['zal']."";
                 echo $chk_zal;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-shkaf/addform.php' target="_blank"><?php echo $TEXT['book-shkaf']; ?>:</a></td><td>
    <select name="shkaf_id">
    <?php
        $query15 = "SELECT * FROM `tbl_shkaf` ORDER BY `shkaf` ";
          $result15 = mysqli_query($dbcnx,$query15);
            if(!$result15) {puterror($result2['skin'],$TEXT['error-tbl9']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_shkaf = mysqli_fetch_array($result15))
                {
                 $chk_shkaf = "<option value=".$result_shkaf['shkaf_id'].">".$result_shkaf['shkaf']."";
                 echo $chk_shkaf;
                }
    ?>
    </select></td></tr>
<tr><td  class="inform"><a class="inform" href='../film-polki/addform.php' target="_blank"><?php echo $TEXT['book-polka']; ?>:</a></td><td>
    <select name="polka_id">
    <?php
        $query16 = "SELECT * FROM `tbl_polka` ORDER BY `polka` ";
          $result16 = mysqli_query($dbcnx,$query16);
            if(!$result16) {puterror($result2['skin'],$TEXT['error-tbl8']); require_once "../utils/bottom_adm_film.php"; exit();}
              while($result_polka = mysqli_fetch_array($result16))
                {
                 $chk_polka = "<option value=".$result_polka['polka_id'].">".$result_polka['polka']."";
                 echo $chk_polka;
                }
    ?>
    </select></td></tr>
</table>
</fieldset>
</td></tr>
<tr><td><input class="button2" type=submit value='<?php echo $button; ?>' /></td><td></td></tr>
</table>
</form>
<?php
  require_once "../utils/bottom_adm_film.php";
?>