/[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.1 - (show annotations)
Wed Apr 12 06:41:50 2000 UTC (23 years, 11 months ago) by dpavlin
Branch: MAIN
Branch point for: PLIVA
Initial revision

1 <?
2
3 include("inc/head.inc");
4
5 if (! isset($from)) {
6 $from=0;
7 }
8
9 if (! isset($kontakt_osoba_id)) {
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 <input type=submit value="Prika¾i">
51 slogove
52 <select name="sql_upit">
53 ';
54
55 option("","bez specijalnog odabira",$sql_upit);
56 option("samo_moji","samo za moje upite *",$sql_upit);
57 option("novi_na_vrh","noviji na poèetak popisa",$sql_upit);
58 option("order_ime","sortirano po imenu",$sql_upit);
59 option("order_prezime","sortirano po prezimenu",$sql_upit);
60
61 echo ' </select>
62 <small><i>za opcije oznaèenje zvjezdicom (*) prvo morate
63 odabrati Va¹e ime i prezime!</i></small>
64 <input type=hidden name=from value=0>
65 <input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>
66 <br><small>Prika¾i status zahtjeva za:
67 ',checkbox("shell",$shell),' shell
68 ',checkbox("podesavanje",$podesavanje),' pode¹avanje
69 ',checkbox("umrezavanje",$umrezavanje),' umre¾avanje
70 </small>
71 </form>
72 ';
73
74 $on_page=50;
75
76 $conn = pg_connect("dbname=informatika user=dpavlin");
77
78 $sql_polja="osobe.id as id,osobe.ime as ime,
79 osobe.prezime as prezime,
80 org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,
81 kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
82 e_mail,kontakt_osoba_id
83 ";
84 $sql_tablice="osobe,org_jed,kontakt_osobe";
85 $sql_where="org_jed.id=org_jed_id
86 and org_pod_jed.pod_id=org_pod_jed_id
87 and kontakt_osoba_id=kontakt_osobe.id
88 ";
89 $sql_order="order by id";
90
91
92 if (isset($sql_upit)) {
93 switch($sql_upit) {
94 case "samo_moji":
95 if (isset($kontakt_osoba_id)) {
96 $sql_where.=" and kontakt_osobe.id=$kontakt_osoba_id";
97 }
98 break;
99 case "order_ime":
100 $sql_order="order by ime";
101 break;
102 case "order_prezime":
103 $sql_order="order by prezime";
104 break;
105 case "novi_na_vrh":
106 $sql_order="order by id desc";
107 break;
108 }
109 }
110
111 if (isset($shell)) {
112 $sql_polja.=",shell";
113 }
114 if (isset($podesavanje)) {
115 $sql_polja.=",podesavanje";
116 }
117 if (isset($umrezavanje)) {
118 $sql_polja.=",umrezavanje";
119 }
120
121 $sql="select $sql_polja from $sql_tablice where $sql_where $sql_order limit $on_page,$from";
122
123 # echo "<pre>$sql</pre>";
124 $result = pg_Exec ($conn, "$sql");
125
126 echo "<table border=1>
127 <tr>
128 <th>br</th>
129 <th>ime i prezime</th>
130 <th>organizacijska jedinica</th>
131 <th>status zahtjeva</th>
132 <th>kontakt osoba</th>
133 </tr>
134 ";
135
136 function print_bool($val) {
137 if ($val == 't') {
138 print "da";
139 } elseif ($val == 'f') {
140 print "ne";
141 } else {
142 print "nepoznato";
143 }
144 }
145
146 for ($k = 0; $k < pg_numrows($result); $k++) {
147 $row=pg_fetch_array($result,$k);
148 if ($k % 2 != 0) {
149 print "<tr>";
150 } else {
151 print '<tr bgcolor="#f0f0f0">';
152 }
153 print "<td>";
154 if ($row[kontakt_osoba_id]==$kontakt_osoba_id) {
155 print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>";
156 } else {
157 print "$row[id]";
158 }
159 print "</td><td>$row[ime] $row[prezime]</td>
160 <td>$row[orgjed]</td><td>";
161
162 $result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id]");
163 for ($l = 0; $l < pg_numrows($result1); $l++) {
164 $row1=pg_fetch_array($result1,$l);
165 print "<small>$row1[datum]</small> $row1[opis]<br>";
166 }
167 print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";
168
169
170 if (isset($shell)) {
171 print "<br>shell: ";
172 print_bool($row[shell]);
173 }
174 if (isset($podesavanje)) {
175 print "<br>pode¹avanje: ";
176 print_bool($row[podesavanje]);
177 }
178 if (isset($umrezavanje)) {
179 print "<br>umre¾avanje: ";
180 print_bool($row[umrezavanje]);
181 }
182 print "</small></td></tr>";
183 }
184
185
186 echo "</table>";
187
188 echo "<p><small>Druge stranice: <tt>";
189
190 if ($from >= $on_page) {
191 echo "<a href=$PHP_SELF?from=".($from-$on_page)."&sql_upit=$sql_upit>-</a>&nbsp;";
192 } else {
193 echo "&nbsp;&nbsp;";
194 }
195
196 if (pg_numrows($result) >= $on_page) {
197 echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a>&nbsp;";
198 } else {
199 echo "&nbsp;&nbsp;";
200 }
201
202 echo '</tt></small>
203
204 <p>Povratak na <a href="index.php">poèetnu stranicu</a>...
205
206 ';
207
208 include("inc/footer.inc");
209 ?>

  ViewVC Help
Powered by ViewVC 1.1.26