jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [edit_ukon.php] - Blame information for rev 3

 

Line No. Rev Author Line
12simandl<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
5<style type="text/css" media="screen"> @import "style.css"; </style>
6<title>Editace úkonu</title>
7</head>
8<link rel="stylesheet" type="text/css" href="style.css">
9</head>
10<body topmargin=0 leftmargin=10>
11<?
12include("header.htm");
13require('grab_globals.lib.php');
14include ("fce.php");
15$spojeni = MySQL_Connect($db_host, $db_user, $db_pass);
16MySQL_Select_DB($db_name);
17 
18if(!@$action)
19{
20$dbukon=MySQL_Query("SELECT * FROM ukony WHERE id='$id' ");
21$dbukon=MySQL_Fetch_Array($dbukon);
22echo '
23 
24<b>Editace úkonu pro uživatele '.id_to_name($dbukon["clen"]).':</b><br>
25<form action="edit_ukon.php?action=zapis" method=POST>
26<table>
27 <tr>
28 <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.sql2datum($dbukon["datum"]).'" size=25></td>
29 <td class=text><a href=del_ukon.php?id='.$id.'>Smazat tento úkon!</a></td>
30 </tr>
31 <tr>
32 <td class=text>Typ udalosti:</td>
33 <td>
34 <select class=field name="udalost">';
35 $dotaz=MySQL_Query("SELECT * from udalosti ORDER BY id");
36 $count=MySQL_Num_Rows($dotaz);
37 $count++;
38 for ($i=1;$i<$count;$i++)
39 {
40 $radek=MySQL_Fetch_Array($dotaz);
41 echo '<option '; if($dbukon["udalost"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
42 }
43 echo '</select>
44 </td>
45 </tr>
46 <tr>
47 <td class=text>Předmětné IP:</td>
48 <td>
49 <select class=field name="predmet">';
50 $dotaz=MySQL_Query("SELECT * FROM ipecka WHERE clen=".$dbukon["clen"]." ORDER BY ip");
51 $count=MySQL_Num_Rows($dotaz);
52 $count++;
53 echo '<option value=0>není</option>';
54 $ipecko=id_to_ipecko($dbukon["predmet"]);
55 for ($i=1;$i<$count;$i++)
56 {
57 $radek=MySQL_Fetch_Array($dotaz);
58 echo '<option '; if($ipecko==$radek["ip"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["ip"].'</option>';
59 }
60 echo '</select>
61 </td>
62 </tr>
63 <tr>
64 <td class=text>Adresa:</td>
65 <td>
66 <select class=field name="adresa">';
67 $dotaz=MySQL_Query("SELECT * from adresy ORDER BY ulice,cp,byt");
68 $count=MySQL_Num_Rows($dotaz);
69 $count++;
70 echo '<option value=0>není</option>';
71 for ($i=1;$i<$count;$i++)
72 {
73 $radek=MySQL_Fetch_Array($dotaz);
74 echo '<option '; if($dbukon["adresa"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["ulice"]." ".$radek["cp"]." byt ".$radek["byt"].'</option>';
75 }
76 echo '</select>
77 </td>
78 </tr>
79 <tr>
80 <td class=text>Finance:</td>
81 <td>
82 <select class=field name="finance">';
83 $dotaz=MySQL_Query("SELECT * from finance ORDER BY datum");
84 $count=MySQL_Num_Rows($dotaz);
85 $count++;
86 echo '<option value=0>není</option>';
87 for ($i=1;$i<$count;$i++)
88 {
89 $radek=MySQL_Fetch_Array($dotaz);
90 echo '<option '; if($dbukon["finance"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["datum"]." ".$radek["hodnota"]."K. ".$radek["pokladna"].'</option>';
91 }
92 echo '</select>
93 </td>
94 </tr>
95 <tr>
96 <td class=text>Majetek:</td>
97 <td>
98 <select class=field name="majetek">';
99 $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id");
100 $count=MySQL_Num_Rows($dotaz);
101 $count++;
102 echo '<option value=0>není</option>';
103 for ($i=1;$i<$count;$i++)
104 {
105 $radek=MySQL_Fetch_Array($dotaz);
106 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>';
107 }
108 echo '</select>
109 </td>
110 </tr>
111 
112 <tr>
113 <td class=text valign=top>Komentář:</td><td><textarea class=fieldthin name="komentar" rows=8 cols=25>'.$dbukon["komentar"].'</textarea></td>
114 </tr>
115</table>
116 
117<input class=field type="submit" name="OK" value="&nbsp;ulož změny&nbsp;">
118<input name="id" type="hidden" value="'.$id.'">
119<input name="clen" type="hidden" value="'.$dbukon["clen"].'">
120</form>
121 
122';
123}
124else
125{
126$datum=datum2sql($datum);
127$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'");
128 
129if (!$result) {
130echo "<br><b>Výsledek : ".mysql_error()."</b>";
131} else {
132echo "<br><b>Úkon uživatele ".id_to_name($clen)." byl úspěšně změněn!</b>";
133}
134 
135}
136 
137MySQL_Close($spojeni);
138?>
139<br>
140<br>
141<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>
142 
143</body>
144</html>

Powered by WebSVN 2.2.1