1 |
<? |
<? |
2 |
|
|
3 |
include("inc/head.inc"); |
include("inc/head.inc"); |
4 |
|
include("inc/prava.inc"); |
5 |
|
include("inc/checkbox.inc"); |
6 |
|
|
7 |
if (! isset($from)) { |
if (! isset($from)) { |
8 |
$from=0; |
$from=0; |
9 |
|
$podesavanje="on"; $umrezavanje="on"; |
10 |
} |
} |
11 |
|
|
12 |
if (! isset($kontakt_osoba_id)) { |
if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) { |
13 |
echo '<form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma"> |
echo '<form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma"> |
14 |
Odaberite Vaše ime i prezime: |
Odaberite Vaše ime i prezime: |
15 |
<select name="kontakt_osoba_id">'; |
<select name="kontakt_osoba_id">'; |
26 |
<input type=submit value="Posebno označi moje zahtjeve"> |
<input type=submit value="Posebno označi moje zahtjeve"> |
27 |
</form>'; |
</form>'; |
28 |
} else { |
} else { |
29 |
$result = pg_Exec ($conn, "select ime,prezime,passwd from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
$result = pg_Exec ($conn, "select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
30 |
$row=pg_fetch_array($result,0); |
$row=pg_fetch_array($result,0); |
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>"; |
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) { |
function option($value,$text,$current) { |
40 |
echo ">$text</option>"; |
echo ">$text</option>"; |
41 |
} |
} |
42 |
|
|
|
function checkbox($name,$current) { |
|
|
echo "<input type=\"checkbox\" name=\"$name\""; |
|
|
if (isset($current)) { |
|
|
echo " checked"; |
|
|
} |
|
|
echo ">"; |
|
|
} |
|
43 |
|
|
44 |
if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; } |
if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; } |
45 |
|
|
46 |
echo ' <form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma2"> |
echo ' <form method="post" action="'.$PHP_SELF.'?'.$QUERY_STRING.'" name="forma2"> |
47 |
<input type=submit value="Prikaži"> |
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 |
slogove |
51 |
<select name="sql_upit"> |
<select name="sql_upit"> |
52 |
'; |
'; |
56 |
option("novi_na_vrh","noviji na početak popisa",$sql_upit); |
option("novi_na_vrh","noviji na početak popisa",$sql_upit); |
57 |
option("order_ime","sortirano po imenu",$sql_upit); |
option("order_ime","sortirano po imenu",$sql_upit); |
58 |
option("order_prezime","sortirano po prezimenu",$sql_upit); |
option("order_prezime","sortirano po prezimenu",$sql_upit); |
59 |
|
option("umrezavanje","potrebno umrežavanje",$sql_upit); |
60 |
|
|
61 |
echo ' </select> |
echo ' </select> |
62 |
<small><i>za opcije označenje zvjezdicom (*) prvo morate |
<small><i>za opcije označenje zvjezdicom (*) prvo morate |
91 |
"; |
"; |
92 |
$sql_order="order by id"; |
$sql_order="order by id"; |
93 |
|
|
|
|
|
94 |
if (isset($sql_upit)) { |
if (isset($sql_upit)) { |
95 |
switch($sql_upit) { |
switch($sql_upit) { |
96 |
case "samo_moji": |
case "samo_moji": |
107 |
case "novi_na_vrh": |
case "novi_na_vrh": |
108 |
$sql_order="order by id desc"; |
$sql_order="order by id desc"; |
109 |
break; |
break; |
110 |
|
case "umrezavanje": |
111 |
|
$sql_where.=" and umrezavanje is true"; |
112 |
|
break; |
113 |
} |
} |
114 |
} |
} |
115 |
|
|
123 |
$sql_polja.=",umrezavanje"; |
$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"; |
$sql="select $sql_polja from $sql_tablice where $sql_where $sql_order limit $on_page,$from"; |
131 |
|
|
132 |
# echo "<pre>$sql</pre>"; |
# echo "<pre>$sql</pre>"; |
133 |
|
# echo "<pre>$sql_where</pre>"; |
134 |
$result = pg_Exec ($conn, "$sql"); |
$result = pg_Exec ($conn, "$sql"); |
135 |
|
|
136 |
echo "<table border=1> |
echo "<table border=1> |
140 |
<th>organizacijska jedinica</th> |
<th>organizacijska jedinica</th> |
141 |
<th>status zahtjeva</th> |
<th>status zahtjeva</th> |
142 |
<th>kontakt osoba</th> |
<th>kontakt osoba</th> |
143 |
|
<td><small>",pg_numrows($result),"</small></td> |
144 |
</tr> |
</tr> |
145 |
"; |
"; |
146 |
|
|
147 |
function print_bool($val) { |
include("inc/print_bool2.inc"); |
148 |
if ($val == 't') { |
|
|
print "da"; |
|
|
} elseif ($val == 'f') { |
|
|
print "ne"; |
|
|
} else { |
|
|
print "nepoznato"; |
|
|
} |
|
|
} |
|
149 |
|
|
150 |
for ($k = 0; $k < pg_numrows($result); $k++) { |
for ($k = 0; $k < pg_numrows($result); $k++) { |
151 |
$row=pg_fetch_array($result,$k); |
$row=pg_fetch_array($result,$k); |
155 |
print '<tr bgcolor="#f0f0f0">'; |
print '<tr bgcolor="#f0f0f0">'; |
156 |
} |
} |
157 |
print "<td>"; |
print "<td>"; |
158 |
if ($row[kontakt_osoba_id]==$kontakt_osoba_id) { |
if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) { |
159 |
print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>"; |
print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>"; |
160 |
} else { |
} else { |
161 |
print "$row[id]"; |
print "$row[id]"; |
163 |
print "</td><td>$row[ime] $row[prezime]</td> |
print "</td><td>$row[ime] $row[prezime]</td> |
164 |
<td>$row[orgjed]</td><td>"; |
<td>$row[orgjed]</td><td>"; |
165 |
|
|
166 |
$result1 = pg_Exec ($conn, "select datum,opis from status,status_tip where status.status_tip_id=status_tip.id and osoba_id=$row[id]"); |
$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"); |
167 |
for ($l = 0; $l < pg_numrows($result1); $l++) { |
for ($l = 0; $l < pg_numrows($result1); $l++) { |
168 |
$row1=pg_fetch_array($result1,$l); |
$row1=pg_fetch_array($result1,$l); |
169 |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
172 |
|
|
173 |
|
|
174 |
if (isset($shell)) { |
if (isset($shell)) { |
175 |
print "<br>shell: "; |
print "<br>shell: ".print_bool($row[shell]); |
|
print_bool($row[shell]); |
|
176 |
} |
} |
177 |
if (isset($podesavanje)) { |
if (isset($podesavanje)) { |
178 |
print "<br>podešavanje: "; |
print "<br>podešavanje: ".print_bool($row[podesavanje]); |
|
print_bool($row[podesavanje]); |
|
179 |
} |
} |
180 |
if (isset($umrezavanje)) { |
if (isset($umrezavanje)) { |
181 |
print "<br>umrežavanje: "; |
print "<br>umrežavanje: ".print_bool($row[umrezavanje]); |
|
print_bool($row[umrezavanje]); |
|
182 |
} |
} |
183 |
print "</small></td></tr>"; |
print "</small>"; |
184 |
|
print "</td><td> |
185 |
|
<a href=\"obavijest.php?id=$row[id]\"> |
186 |
|
<img src=pix/text.gif border=0 |
187 |
|
alt=\"Prikaži sve podatke o ovom zahtjevu\"></a> |
188 |
|
"; |
189 |
|
print "</td></tr>"; |
190 |
} |
} |
191 |
|
|
192 |
|
|