/[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.12.2.1 - (show annotations)
Sun Jul 30 18:13:53 2000 UTC (23 years, 9 months ago) by dpavlin
Branch: dbi
Changes since 1.12: +26 -28 lines
dbi podr¹ka

1 <?
2
3 include("inc/head.inc");
4 include("inc/prava.inc");
5 include("inc/checkbox.inc");
6
7 if (! isset($from)) {
8 $from=0;
9 $podesavanje="on"; $umrezavanje="on";
10 }
11
12 if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) {
13 echo '<form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma">
14 Odaberite Va¹e ime i prezime:
15 <select name="kontakt_osoba_id">';
16
17 $sth = $dbh->prepare("select id,ime,prezime from kontakt_osobe
18 where aktivna=true order by ime");
19 $sth->execute();
20 while ($row=$sth->fetchrow_hash()) {
21 echo "<option value=\"$row[id]\"";
22 if ($row[id]==$kontakt_osoba_id) { echo " selected"; }
23 echo ">$row[ime] $row[prezime]</option>\n";
24 }
25 echo '</select>
26 <input type=submit value="Posebno oznaèi moje zahtjeve">
27 </form>';
28 } else {
29 $sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id");
30 $row=$sth->fetchrow_hash();
31 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>";
32 $prava=$row[prava];
33 }
34
35 function option($value,$text,$current) {
36 echo "<option value=\"$value\"";
37 if (isset($current) && $current==$value || !isset($current) & $default) {
38 echo " selected";
39 }
40 echo ">$text</option>";
41 }
42
43
44 if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; }
45
46 echo ' <form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma2">
47 Upi¹ite ime ili prezime po kojem ¾elite pretra¾ivati:
48 <input type=text name=imepr size=40 value="'.$imepr.'">
49 <br><input type=submit value="Prika¾i">
50 slogove
51 <select name="sql_upit">
52 ';
53
54 option("","bez specijalnog odabira",$sql_upit);
55 option("samo_moji","samo za moje upite *",$sql_upit);
56 option("novi_na_vrh","noviji na poèetak popisa",$sql_upit);
57 option("order_ime","sortirano po imenu",$sql_upit);
58 option("order_prezime","sortirano po prezimenu",$sql_upit);
59 option("umrezavanje","potrebno umre¾avanje",$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
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 org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed,
83 kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba,
84 e_mail,kontakt_osoba_id
85 ";
86 $sql_tablice="osobe,org_jed,kontakt_osobe";
87 $sql_where="org_jed.id=org_jed_id
88 and org_pod_jed.pod_id=org_pod_jed_id
89 and kontakt_osoba_id=kontakt_osobe.id
90 ";
91 $sql_order="order by id";
92
93 if (isset($sql_upit)) {
94 switch($sql_upit) {
95 case "samo_moji":
96 if (isset($kontakt_osoba_id)) {
97 $sql_where.=" and kontakt_osobe.id=$kontakt_osoba_id";
98 }
99 break;
100 case "order_ime":
101 $sql_order="order by ime";
102 break;
103 case "order_prezime":
104 $sql_order="order by prezime";
105 break;
106 case "novi_na_vrh":
107 $sql_order="order by id desc";
108 break;
109 case "umrezavanje":
110 $sql_where.=" and umrezavanje is true";
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 $sth = $dbh->prepare("$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 <td><small>",$sth->rows(),"</small></td>
143 </tr>
144 ";
145
146 include("inc/print_bool2.inc");
147
148 $k=0;
149 while ($row=$sth->fetchrow_hash()) {
150 if ($k % 2 != 0) {
151 print "<tr>";
152 } else {
153 print '<tr bgcolor="#f0f0f0">';
154 }
155 $k++;
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 $sth1 = $dbh->prepare("select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id] order by datum");
166 while ($row1=$sth1->fetchrow_hash()) {
167 print "<small>$row1[datum]</small> $row1[opis]<br>";
168 }
169 print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>";
170
171
172 if (isset($shell)) {
173 print "<br>shell: ".print_bool($row[shell]);
174 }
175 if (isset($podesavanje)) {
176 print "<br>pode¹avanje: ".print_bool($row[podesavanje]);
177 }
178 if (isset($umrezavanje)) {
179 print "<br>umre¾avanje: ".print_bool($row[umrezavanje]);
180 }
181 print "</small>";
182 print "</td><td>
183 <a href=\"obavijest.php?id=$row[id]\">
184 <img src=pix/text.gif border=0
185 alt=\"Prika¾i sve podatke o ovom zahtjevu\"></a>
186 ";
187 print "</td></tr>";
188 }
189
190
191 echo "</table>";
192
193 echo "<p><small>Druge stranice: <tt>";
194
195 if ($from >= $on_page) {
196 echo "<a href=$PHP_SELF?from=".($from-$on_page)."&sql_upit=$sql_upit>-</a>&nbsp;";
197 } else {
198 echo "&nbsp;&nbsp;";
199 }
200
201 if ($sth->rows() >= $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 echo '</tt></small>
208
209 <p>Povratak na <a href="index.php">poèetnu stranicu</a>...
210
211 ';
212
213 include("inc/footer.inc");
214 ?>

  ViewVC Help
Powered by ViewVC 1.1.26