/[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.4 - (show annotations)
Fri Apr 14 08:23:26 2000 UTC (24 years ago) by dpavlin
Branch: MAIN
Changes since 1.3: +1 -1 lines
fix

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

  ViewVC Help
Powered by ViewVC 1.1.26