/[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.7 - (show annotations)
Fri Jun 2 06:14:56 2000 UTC (23 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.6: +4 -2 lines
administratori imaju prava editirati sve zahtjeve

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

  ViewVC Help
Powered by ViewVC 1.1.26