jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [edit_ukon.php] - Rev 2

Compare with Previous - Blame - Download


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" media="screen"> @import "style.css"; </style>
<title>Editace úkonu</title>
</head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin=0 leftmargin=10>
<?
include("header.htm");
require('grab_globals.lib.php');
include ("fce.php");
$spojeni = MySQL_Connect($db_host, $db_user, $db_pass);
MySQL_Select_DB($db_name);

if(!@$action)
{
$dbukon=MySQL_Query("SELECT * FROM ukony WHERE id='$id' ");
$dbukon=MySQL_Fetch_Array($dbukon);
echo '

<b>Editace úkonu pro uživatele '.id_to_name($dbukon["clen"]).':</b><br>
<form action="edit_ukon.php?action=zapis" method=POST>
<table>
  <tr>
    <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.sql2datum($dbukon["datum"]).'" size=25></td>
    <td class=text><a href=del_ukon.php?id='.$id.'>Smazat tento úkon!</a></td>
  </tr>
        <tr>
           <td class=text>Typ udalosti:</td>
           <td>
                <select class=field name="udalost">';
                $dotaz=MySQL_Query("SELECT * from udalosti ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbukon["udalost"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Předmětné IP:</td>
           <td>
                <select class=field name="predmet">';
                $dotaz=MySQL_Query("SELECT * FROM ipecka WHERE clen=".$dbukon["clen"]." ORDER BY ip");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                $ipecko=id_to_ipecko($dbukon["predmet"]);
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($ipecko==$radek["ip"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["ip"].'</option>';
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Adresa:</td>
           <td>
                <select class=field name="adresa">';
                $dotaz=MySQL_Query("SELECT * from adresy ORDER BY ulice,cp,byt");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbukon["adresa"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["ulice"]." ".$radek["cp"]." byt ".$radek["byt"].'</option>';
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Finance:</td>
           <td>
                <select class=field name="finance">';
                $dotaz=MySQL_Query("SELECT * from finance ORDER BY datum");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbukon["finance"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["datum"]." ".$radek["hodnota"]."K. ".$radek["pokladna"].'</option>';
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Majetek:</td>
           <td>
                <select class=field name="majetek">';
                $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbukon["majetek"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.id_to_zarizeni($radek["zarizeni"])." ".$radek["komentar"]." ".$radek["scislo"]." ".$radek["mac"]." ".id_to_adresa($radek["adresa"]).'</option>';
                }
                echo '</select>
           </td>
        </tr>

        <tr>
           <td class=text valign=top>Komentář:</td><td><textarea class=fieldthin name="komentar" rows=8 cols=25>'.$dbukon["komentar"].'</textarea></td>
        </tr>
</table>

<input class=field type="submit" name="OK" value="&nbsp;ulož změny&nbsp;">
<input name="id" type="hidden" value="'.$id.'">
<input name="clen" type="hidden" value="'.$dbukon["clen"].'">
</form>

';
}
else
{
$datum=datum2sql($datum);
$result = MySQL_Query("UPDATE ukony SET clen='$clen',udalost='$udalost',predmet='$predmet',datum='$datum',komentar='$komentar',adresa='$adresa',finance='$finance',majetek='$majetek' WHERE id='$id'");

if (!$result) {
echo "<br><b>Výsledek : ".mysql_error()."</b>";
} else {
echo "<br><b>Úkon uživatele ".id_to_name($clen)." byl úspěšně změněn!</b>";
}

}

MySQL_Close($spojeni);
?>
<br>
<br>
<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>

</body>
</html>

Powered by WebSVN 2.2.1