/[informatika.old]/html/lista.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /html/lista.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Fri Jun 2 06:05:08 2000 UTC (23 years, 10 months ago) by dpavlin
Branch: MAIN
Changes since 1.5: +11 -16 lines
dodavanje statusa preko web-a, povezivanje izvje¹taja i lista

1 <?
2
3 include("inc/head.inc");
4
5 if (! isset($from)) {
6 $from=0;
7 }
8
9 if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) {
10 echo '<form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma">
11 Odaberite Va¹e ime i prezime:
12 <select name="kontakt_osoba_id">';
13
14 $result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe
15 where aktivna=true order by ime");
16 for ($k = 0; $k < pg_numrows($result); $k++) {
17 $row=pg_fetch_array($result,$k);
18 echo "<option value=\"$row[id]\"";
19 if ($row[id]==$kontakt_osoba_id) { echo " selected"; }
20 echo ">$row[ime] $row[prezime]</option>\n";
21 }
22 echo '</select>
23 <input type=submit value="Posebno oznaèi moje zahtjeve">
24 </form>';
25 } else {
26 $result = pg_Exec ($conn, "select ime,prezime,passwd from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
27 $row=pg_fetch_array($result,0);
28 print "<small>Trenutno ste prijavljeni kao $row[ime] $row[prezime], ako je to krivo odaberite <a href=\"$PHP_SELF?what=relogin\">ovaj link</a>.</small>";
29 }
30
31 function option($value,$text,$current) {
32 echo "<option value=\"$value\"";
33 if (isset($current) && $current==$value || !isset($current) & $default) {
34 echo " selected";
35 }
36 echo ">$text</option>";
37 }
38
39 function checkbox($name,$current) {
40 echo "<input type=\"checkbox\" name=\"$name\"";
41 if (isset($current)) {
42 echo " checked";
43 }
44 echo ">";
45 }
46
47 if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; }
48
49 echo ' <form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma2">
50 Upi¹ite ime ili prezime po kojem ¾elite pretra¾ivati:
51 <input type=text name=imepr size=40 value="'.$imepr.'">
52 <br><input type=submit value="Prika¾i">
53 slogove
54 <select name="sql_upit">
55 ';
56
57 option("","bez specijalnog odabira",$sql_upit);
58 option("samo_moji","samo za moje upite *",$sql_upit);
59 option("novi_na_vrh","noviji na poèetak popisa",$sql_upit);
60 option("order_ime","sortirano po imenu",$sql_upit);
61 option("order_prezime","sortirano po prezimenu",$sql_upit);
62
63 echo ' </select>
64 <small><i>za opcije oznaèenje zvjezdicom (*) prvo morate
65 odabrati Va¹e ime i prezime!</i></small>
66 <input type=hidden name=from value=0>';
67
68 if (isset($kontakt_osoba_id)) {
69 echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>';
70 }
71 echo '<br><small>Prika¾i status zahtjeva za:
72 ',checkbox("shell",$shell),' shell
73 ',checkbox("podesavanje",$podesavanje),' pode¹avanje
74 ',checkbox("umrezavanje",$umrezavanje),' umre¾avanje
75 </small>
76 </form>
77 ';
78
79 $on_page=50;
80
81 $conn = pg_connect("dbname=informatika user=dpavlin");
82
83 $sql_polja="osobe.id as id,osobe.ime as ime,
84 osobe.prezime as prezime,
85 org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,
86 kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
87 e_mail,kontakt_osoba_id
88 ";
89 $sql_tablice="osobe,org_jed,kontakt_osobe";
90 $sql_where="org_jed.id=org_jed_id
91 and org_pod_jed.pod_id=org_pod_jed_id
92 and kontakt_osoba_id=kontakt_osobe.id
93 ";
94 $sql_order="order by id";
95
96 if (isset($sql_upit)) {
97 switch($sql_upit) {
98 case "samo_moji":
99 if (isset($kontakt_osoba_id)) {
100 $sql_where.=" and kontakt_osobe.id=$kontakt_osoba_id";
101 }
102 break;
103 case "order_ime":
104 $sql_order="order by ime";
105 break;
106 case "order_prezime":
107 $sql_order="order by prezime";
108 break;
109 case "novi_na_vrh":
110 $sql_order="order by id desc";
111 break;
112 }
113 }
114
115 if (isset($shell)) {
116 $sql_polja.=",shell";
117 }
118 if (isset($podesavanje)) {
119 $sql_polja.=",podesavanje";
120 }
121 if (isset($umrezavanje)) {
122 $sql_polja.=",umrezavanje";
123 }
124
125 if (isset($imepr) && $imepr != "") {
126 $sql_where.=" and ( upper(toczs(osobe.ime)) like upper(toczs('$imepr')) or upper(toczs(osobe.prezime)) like upper(toczs('$imepr')) )";
127 }
128
129 $sql="select $sql_polja from $sql_tablice where $sql_where $sql_order limit $on_page,$from";
130
131 # echo "<pre>$sql</pre>";
132 # echo "<pre>$sql_where</pre>";
133 $result = pg_Exec ($conn, "$sql");
134
135 echo "<table border=1>
136 <tr>
137 <th>br</th>
138 <th>ime i prezime</th>
139 <th>organizacijska jedinica</th>
140 <th>status zahtjeva</th>
141 <th>kontakt osoba</th>
142 </tr>
143 ";
144
145 include("inc/print_bool.inc");
146
147 for ($k = 0; $k < pg_numrows($result); $k++) {
148 $row=pg_fetch_array($result,$k);
149 if ($k % 2 != 0) {
150 print "<tr>";
151 } else {
152 print '<tr bgcolor="#f0f0f0">';
153 }
154 print "<td>";
155 if ($row[kontakt_osoba_id]==$kontakt_osoba_id) {
156 print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>";
157 } else {
158 print "$row[id]";
159 }
160 print "</td><td>$row[ime] $row[prezime]</td>
161 <td>$row[orgjed]</td><td>";
162
163 $result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id]");
164 for ($l = 0; $l < pg_numrows($result1); $l++) {
165 $row1=pg_fetch_array($result1,$l);
166 print "<small>$row1[datum]</small> $row1[opis]<br>";
167 }
168 print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";
169
170
171 if (isset($shell)) {
172 print "<br>shell: ".print_bool($row[shell]);
173 }
174 if (isset($podesavanje)) {
175 print "<br>pode¹avanje: ".print_bool($row[podesavanje]);
176 }
177 if (isset($umrezavanje)) {
178 print "<br>umre¾avanje: ".print_bool($row[umrezavanje]);
179 }
180 print "</small>";
181 print "</td><td>
182 <a href=\"obavijest.php?id=$row[id]\">
183 <img src=pix/text.gif border=0
184 alt=\"Prika¾i sve podatke o ovom zahtjevu\"></a>
185 ";
186 print "</td></tr>";
187 }
188
189
190 echo "</table>";
191
192 echo "<p><small>Druge stranice: <tt>";
193
194 if ($from >= $on_page) {
195 echo "<a href=$PHP_SELF?from=".($from-$on_page)."&sql_upit=$sql_upit>-</a>&nbsp;";
196 } else {
197 echo "&nbsp;&nbsp;";
198 }
199
200 if (pg_numrows($result) >= $on_page) {
201 echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a>&nbsp;";
202 } else {
203 echo "&nbsp;&nbsp;";
204 }
205
206 echo '</tt></small>
207
208 <p>Povratak na <a href="index.php">poèetnu stranicu</a>...
209
210 ';
211
212 include("inc/footer.inc");
213 ?>

  ViewVC Help
Powered by ViewVC 1.1.26