/[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.16 - (show annotations)
Fri Jan 25 14:47:46 2002 UTC (21 years ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.15: +14 -9 lines
sap organizacijske jedinice

1 <?
2
3 include("inc/head.inc");
4 include("inc/prava.inc");
5 include("inc/checkbox.inc");
6 include("inc/sap_org_jed.inc");
7
8 if (! isset($from)) {
9 $from=0;
10 $podesavanje="on"; $umrezavanje="on";
11 }
12
13 if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) {
14 echo '<form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma">
15 Odaberite Va¹e ime i prezime:
16 <select name="kontakt_osoba_id">';
17
18 $result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe
19 where aktivna=true order by ime");
20 for ($k = 0; $k < pg_numrows($result); $k++) {
21 $row=pg_fetch_array($result,$k);
22 echo "<option value=\"$row[id]\"";
23 if ($row[id]==$kontakt_osoba_id) { echo " selected"; }
24 echo ">$row[ime] $row[prezime]</option>\n";
25 }
26 echo '</select>
27 <input type=submit value="Posebno oznaèi moje zahtjeve">
28 </form>';
29 } else {
30 $result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
31 $row=pg_fetch_array($result,0);
32 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>";
33 $prava=$row[prava];
34 }
35
36 function option($value,$text,$current) {
37 echo "<option value=\"$value\"";
38 if (isset($current) && $current==$value || !isset($current) & $default) {
39 echo " selected";
40 }
41 echo ">$text</option>";
42 }
43
44
45 if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; }
46
47 echo ' <form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma2">
48 Upi¹ite ime ili prezime po kojem ¾elite pretra¾ivati:
49 <input type=text name=imepr size=40 value="'.$imepr.'">
50 <br><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 option("umrezavanje","potrebno umre¾avanje",$sql_upit);
61
62 echo ' </select>
63 <small><i>za opcije oznaèenje zvjezdicom (*) prvo morate
64 odabrati Va¹e ime i prezime!</i></small>
65 <input type=hidden name=from value=0>';
66
67 if (isset($kontakt_osoba_id)) {
68 echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>';
69 }
70 echo '<br><small>Prika¾i status zahtjeva za:
71 ',checkbox("shell",$shell),' shell
72 ',checkbox("podesavanje",$podesavanje),' pode¹avanje
73 ',checkbox("umrezavanje",$umrezavanje),' umre¾avanje
74 </small>
75 </form>
76 ';
77
78 $on_page=50;
79
80 $sql_polja="osobe.id as id,osobe.ime as ime,
81 osobe.prezime as prezime,
82 kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
83 e_mail,kontakt_osoba_id,sifra
84 ";
85 $sql_tablice="osobe,kontakt_osobe";
86 $sql_where="
87 kontakt_osoba_id=kontakt_osobe.id
88 and osobe.aktivna=true
89 ";
90 $sql_order="order by id";
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 case "umrezavanje":
109 $sql_where.=" and umrezavanje is true";
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 if (isset($imepr) && $imepr != "") {
125 $sql_where.=
126 "and (upper(toczs(osobe.prezime)) like upper(toczs('$imepr'))
127 or upper(toczs(osobe.ime)) like upper(toczs('$imepr')))";
128 }
129
130 $sql="select $sql_polja
131 from $sql_tablice
132 where $sql_where
133 $sql_order
134 limit $on_page,$from";
135
136 # echo "<pre>$sql</pre>";
137 # echo "<pre>$sql_where</pre>";
138 $result = pg_Exec ($conn, "$sql");
139
140 echo "<table border=1>
141 <tr>
142 <th>br</th>
143 <th>ime i prezime</th>
144 <th>organizacijska jedinica</th>
145 <th>status zahtjeva</th>
146 <th>kontakt osoba</th>
147 <td><small>",pg_numrows($result),"</small></td>
148 </tr>
149 ";
150
151 include("inc/print_bool2.inc");
152
153
154 for ($k = 0; $k < pg_numrows($result); $k++) {
155 $row=pg_fetch_array($result,$k);
156 if ($k % 2 != 0) {
157 print "<tr>";
158 } else {
159 print '<tr bgcolor="#f0f0f0">';
160 }
161 print "<td>";
162 if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) {
163 print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>";
164 } else {
165 print "$row[id]";
166 }
167 print "</td><td>$row[ime] $row[prezime]</td>
168 <td><small>".sap_org_jed($row[sifra])."</small></td><td>";
169
170 $result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id] order by datum");
171 for ($l = 0; $l < pg_numrows($result1); $l++) {
172 $row1=pg_fetch_array($result1,$l);
173 print "<small>$row1[datum]</small> $row1[opis]<br>";
174 }
175 print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";
176
177
178 if (isset($shell)) {
179 print "<br>shell: ".print_bool($row[shell]);
180 }
181 if (isset($podesavanje)) {
182 print "<br>pode¹avanje: ".print_bool($row[podesavanje]);
183 }
184 if (isset($umrezavanje)) {
185 print "<br>umre¾avanje: ".print_bool($row[umrezavanje]);
186 }
187 print "</small>";
188 print "</td><td>
189 <a href=\"obavijest.php?id=$row[id]\">
190 <img src=pix/text.gif border=0
191 alt=\"Prika¾i sve podatke o ovom zahtjevu\"></a>
192 ";
193 print "</td></tr>";
194 }
195
196
197 echo "</table>";
198
199 echo "<p><small>Druge stranice: <tt>";
200
201 if ($from >= $on_page) {
202 echo "<a href=$PHP_SELF?from=".($from-$on_page)."&sql_upit=$sql_upit>-</a>&nbsp;";
203 } else {
204 echo "&nbsp;&nbsp;";
205 }
206
207 if (pg_numrows($result) >= $on_page) {
208 echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a>&nbsp;";
209 } else {
210 echo "&nbsp;&nbsp;";
211 }
212
213 echo '</tt></small>
214
215 <p>Povratak na <a href="index.php">poèetnu stranicu</a>...
216
217 ';
218
219 include("inc/footer.inc");
220 ?>

  ViewVC Help
Powered by ViewVC 1.1.26