<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['res-title'];
  $helppage = $TEXT['res-help'];
  require_once "../config.php";
  require_once "../util/top.php";

  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);

  if(!isset($title)) $title = $TEXT['res-title'];
  if(!isset($button)) $button = $TEXT['btn_add'];
  if(!isset($action)) $action = "add.php";
  if(!isset($showhide)) $visible = "checked";
?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table>
<tr><td class="useraddedit"><?php echo $TEXT['res-field5']; ?></td><td class="useraddedit"><input size=30 maxlength=255 class="inputmandatory" type=text name=ukk ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tip-res']; ?></td>
    <td class="useraddedit"><select name="tip_id">
    <?php
        $query_tip = "SELECT `tip_id`, `tip_name` FROM `tbl_tip_resurs` ORDER BY `position`";
         $tip_tmp = mysql_query($query_tip);
          if(!$tip_tmp) puterror2($TEXT['error-tbl38']);
           while($tip = mysql_fetch_array($tip_tmp,MYSQL_ASSOC))
            {
             $chk2 = "<option value=".$tip['tip_id'].">".$tip['tip_name']."";
             echo $chk2;
            }
    ?>
    </select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-nazv']; ?></td><td class="useraddedit"><input size=30 maxlength=255 type=text name=res_name ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field1']; ?></td><td class="useraddedit"><input size=30 maxlength=500 class="inputmandatory" type=text name=resource ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field2']; ?></td>
    <td class="useraddedit"><select name="user_id">
    <?php
        $query = "SELECT * FROM `tbl_users` WHERE `visible` != 'hide' ORDER BY familiya ";
        $user_tmp = mysql_query($query);
          if(!$user_tmp) puterror2($TEXT['error-tbl2']);
           while($user = mysql_fetch_array($user_tmp,MYSQL_ASSOC))
            {
             $chk = "<option value=".$user['user_id'].">".$user['familiya']." ".$user['name']." ".$user['otchestvo'];
             echo $chk;
            }
    ?>
    </select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['org-field1']; ?></td>
    <td class="useraddedit"><select name="org_id">
    <?php
        $query2 = "SELECT * FROM `tbl_organizaciya` ORDER BY organizaciya ";
        $org_tmp = mysql_query($query2);
          if(!$org_tmp) puterror2($TEXT['error-tbl7']);
              while($org = mysql_fetch_array($org_tmp))
                {
                 $chk = "<option value=".$org['org_id'].">".$org['organizaciya'];
                 echo $chk;
                }
    ?>
    </select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-descr']; ?></td><td class="useraddedit"><textarea class=input name="description" cols="50" rows="5" ></textarea></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-position']; ?></td><td class="useraddedit"><input size=5 maxlength=5 class="inputmandatory" type=text name=position ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field6']; ?></td><td class="useraddedit"><input size=30 maxlength=100 type=text name=srvname ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field7']; ?></td><td class="useraddedit"><input size=30 maxlength=255 type=text name=srvput ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field8']; ?></td><td class="useraddedit"><input size=30 maxlength=1000 type=text name=gread ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field9']; ?></td><td class="useraddedit"><input size=30 maxlength=1000 type=text name=gwrite ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field10']; ?></td><td class="useraddedit"><input size=30 maxlength=100 type=text name=sppubl ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field11']; ?></td><td class="useraddedit"><input size=10 maxlength=10 type=text name=srvkvota >
    <select name="size_id">
    <?php
        $query3 = "SELECT * FROM `tbl_sizes` ORDER BY size_id ";
        $size_tmp = mysql_query($query3);
          if(!$size_tmp) puterror2($TEXT['error-tbl35']);
              while($size = mysql_fetch_array($size_tmp))
                {
                 $chk2 = "<option value=".$size['size_id'].">".$size['size_name'];
                 echo $chk2;
                }
    ?>
    </select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field12']; ?></td><td>
<select name=bakup>
  <option value='yes' selected><?php echo $TEXT['res-field16']; ?>
  <option value='no' ><?php echo $TEXT['res-field17']; ?>
</select>
</td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field13']; ?></td><td class="useraddedit"><input size=30 maxlength=255 type=text name=rezim ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field14']; ?></td><td class="useraddedit"><input size=30 maxlength=255 type=text name=bakrazm ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field15']; ?></td><td class="useraddedit"><input size=30 maxlength=255 type=text name=bakprog ></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-doc']; ?></td><td class="useraddedit"><input type=file name=photo></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-show']; ?></td><td><input type=checkbox name=visible <?php echo $visible; ?>></td></tr>
<tr><td></td><td><input class=button type=submit value='<?php echo $button; ?>' /></td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>