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 |
$sth->execute(); |
31 |
$row=$sth->fetchrow_hash(); |
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 |
|
71 |
echo '<br><small>Prika¾i status zahtjeva za: |
72 |
',checkbox("shell",$shell),' shell |
73 |
',checkbox("podesavanje",$podesavanje),' pode¹avanje |
74 |
',checkbox("umrezavanje",$umrezavanje),' umre¾avanje |
75 |
</small> |
76 |
</form> |
77 |
'; |
78 |
|
79 |
$on_page=50; |
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 |
if (isset($sql_upit)) { |
95 |
switch($sql_upit) { |
96 |
case "samo_moji": |
97 |
if (isset($kontakt_osoba_id)) { |
98 |
$sql_where.=" and kontakt_osobe.id=$kontakt_osoba_id"; |
99 |
} |
100 |
break; |
101 |
case "order_ime": |
102 |
$sql_order="order by ime"; |
103 |
break; |
104 |
case "order_prezime": |
105 |
$sql_order="order by prezime"; |
106 |
break; |
107 |
case "novi_na_vrh": |
108 |
$sql_order="order by id desc"; |
109 |
break; |
110 |
case "umrezavanje": |
111 |
$sql_where.=" and umrezavanje is true"; |
112 |
break; |
113 |
} |
114 |
} |
115 |
|
116 |
if (isset($shell)) { |
117 |
$sql_polja.=",shell"; |
118 |
} |
119 |
if (isset($podesavanje)) { |
120 |
$sql_polja.=",podesavanje"; |
121 |
} |
122 |
if (isset($umrezavanje)) { |
123 |
$sql_polja.=",umrezavanje"; |
124 |
} |
125 |
|
126 |
if (isset($imepr) && $imepr != "") { |
127 |
$sql_where.=" and ( upper(toczs(osobe.ime)) like upper(toczs('$imepr')) or upper(toczs(osobe.prezime)) like upper(toczs('$imepr')) )"; |
128 |
} |
129 |
|
130 |
$sql="select $sql_polja from $sql_tablice where $sql_where $sql_order limit $on_page,$from"; |
131 |
|
132 |
# echo "<pre>$sql</pre>"; |
133 |
# echo "<pre>$sql_where</pre>"; |
134 |
$sth = $dbh->prepare("$sql"); |
135 |
$sth->execute(); |
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 |
<td><small>",$sth->rows(),"</small></td> |
145 |
</tr> |
146 |
"; |
147 |
|
148 |
include("inc/print_bool2.inc"); |
149 |
|
150 |
$k=0; |
151 |
while ($row=$sth->fetchrow_hash()) { |
152 |
if ($k % 2 != 0) { |
153 |
print "<tr>"; |
154 |
} else { |
155 |
print '<tr bgcolor="#f0f0f0">'; |
156 |
} |
157 |
$k++; |
158 |
print "<td>"; |
159 |
if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) { |
160 |
print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>"; |
161 |
} else { |
162 |
print "$row[id]"; |
163 |
} |
164 |
print "</td><td>$row[ime] $row[prezime]</td> |
165 |
<td>$row[orgjed]</td><td>"; |
166 |
|
167 |
$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"); |
168 |
$sth->execute(); |
169 |
while ($row1=$sth1->fetchrow_hash()) { |
170 |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
171 |
} |
172 |
print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>"; |
173 |
|
174 |
|
175 |
if (isset($shell)) { |
176 |
print "<br>shell: ".print_bool($row[shell]); |
177 |
} |
178 |
if (isset($podesavanje)) { |
179 |
print "<br>pode¹avanje: ".print_bool($row[podesavanje]); |
180 |
} |
181 |
if (isset($umrezavanje)) { |
182 |
print "<br>umre¾avanje: ".print_bool($row[umrezavanje]); |
183 |
} |
184 |
print "</small>"; |
185 |
print "</td><td> |
186 |
<a href=\"obavijest.php?id=$row[id]\"> |
187 |
<img src=pix/text.gif border=0 |
188 |
alt=\"Prika¾i sve podatke o ovom zahtjevu\"></a> |
189 |
"; |
190 |
print "</td></tr>"; |
191 |
} |
192 |
|
193 |
|
194 |
echo "</table>"; |
195 |
|
196 |
echo "<p><small>Druge stranice: <tt>"; |
197 |
|
198 |
if ($from >= $on_page) { |
199 |
echo "<a href=$PHP_SELF?from=".($from-$on_page)."&sql_upit=$sql_upit>-</a> "; |
200 |
} else { |
201 |
echo " "; |
202 |
} |
203 |
|
204 |
if ($sth->rows() >= $on_page) { |
205 |
echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a> "; |
206 |
} else { |
207 |
echo " "; |
208 |
} |
209 |
|
210 |
echo '</tt></small> |
211 |
|
212 |
<p>Povratak na <a href="index.php">poèetnu stranicu</a>... |
213 |
|
214 |
'; |
215 |
|
216 |
include("inc/footer.inc"); |
217 |
?> |