2 |
|
|
3 |
include("inc/head.inc"); |
include("inc/head.inc"); |
4 |
include("inc/prava.inc"); |
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) || ! intval($kontakt_osoba_id)!=0) { |
if (! isset($kontakt_osoba_id) || ! intval($kontakt_osoba_id)!=0) { |
14 |
Odaberite Vaše ime i prezime: |
Odaberite Vaše ime i prezime: |
15 |
<select name="kontakt_osoba_id">'; |
<select name="kontakt_osoba_id">'; |
16 |
|
|
17 |
$result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe |
$sth = $dbh->prepare("select id,ime,prezime from kontakt_osobe |
18 |
where aktivna=true order by ime"); |
where aktivna=true order by ime"); |
19 |
for ($k = 0; $k < pg_numrows($result); $k++) { |
$sth->execute(); |
20 |
$row=pg_fetch_array($result,$k); |
while ($row=$sth->fetchrow_hash()) { |
21 |
echo "<option value=\"$row[id]\""; |
echo "<option value=\"$row[id]\""; |
22 |
if ($row[id]==$kontakt_osoba_id) { echo " selected"; } |
if ($row[id]==$kontakt_osoba_id) { echo " selected"; } |
23 |
echo ">$row[ime] $row[prezime]</option>\n"; |
echo ">$row[ime] $row[prezime]</option>\n"; |
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,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
$sth = $dbh->prepare("select ime,prezime,passwd,prava from kontakt_osobe where aktivna=true and id=$kontakt_osoba_id"); |
30 |
$row=pg_fetch_array($result,0); |
$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>"; |
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]; |
$prava=$row[prava]; |
34 |
} |
} |
41 |
echo ">$text</option>"; |
echo ">$text</option>"; |
42 |
} |
} |
43 |
|
|
|
function checkbox($name,$current) { |
|
|
echo "<input type=\"checkbox\" name=\"$name\""; |
|
|
if (isset($current)) { |
|
|
echo " checked"; |
|
|
} |
|
|
echo ">"; |
|
|
} |
|
44 |
|
|
45 |
if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; } |
if (! isset($sql_upit)) { $sql_upit="novi_na_vrh"; } |
46 |
|
|
67 |
if (isset($kontakt_osoba_id)) { |
if (isset($kontakt_osoba_id)) { |
68 |
echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>'; |
echo '<input type=hidden name=kontakt_osoba_id value='.$kontakt_osoba_id.'>'; |
69 |
} |
} |
70 |
|
|
71 |
echo '<br><small>Prikaži status zahtjeva za: |
echo '<br><small>Prikaži status zahtjeva za: |
72 |
',checkbox("shell",$shell),' shell |
',checkbox("shell",$shell),' shell |
73 |
',checkbox("podesavanje",$podesavanje),' podešavanje |
',checkbox("podesavanje",$podesavanje),' podešavanje |
78 |
|
|
79 |
$on_page=50; |
$on_page=50; |
80 |
|
|
81 |
$conn = pg_connect("dbname=informatika user=dpavlin"); |
$sql_polja="osobe.id as id,osobe.ime as ime, |
82 |
|
osobe.prezime as prezime, |
83 |
$sql_polja="osobe.id as id,osobe.ime as ime, |
org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed, |
84 |
osobe.prezime as prezime, |
kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba, |
85 |
org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed, |
e_mail,kontakt_osoba_id |
86 |
kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba, |
"; |
87 |
e_mail,kontakt_osoba_id |
$sql_tablice="osobe,org_jed,kontakt_osobe,org_pod_jed"; |
88 |
"; |
$sql_where="org_jed.id=org_jed_id |
89 |
$sql_tablice="osobe,org_jed,kontakt_osobe"; |
and org_pod_jed.pod_id=org_pod_jed_id |
90 |
$sql_where="org_jed.id=org_jed_id |
and kontakt_osoba_id=kontakt_osobe.id |
91 |
and org_pod_jed.pod_id=org_pod_jed_id |
"; |
92 |
and kontakt_osoba_id=kontakt_osobe.id |
$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) { |
131 |
|
|
132 |
# echo "<pre>$sql</pre>"; |
# echo "<pre>$sql</pre>"; |
133 |
# echo "<pre>$sql_where</pre>"; |
# echo "<pre>$sql_where</pre>"; |
134 |
$result = pg_Exec ($conn, "$sql"); |
$sth = $dbh->prepare("$sql"); |
135 |
|
$sth->execute(); |
136 |
|
|
137 |
echo "<table border=1> |
echo "<table border=1> |
138 |
<tr> |
<tr> |
141 |
<th>organizacijska jedinica</th> |
<th>organizacijska jedinica</th> |
142 |
<th>status zahtjeva</th> |
<th>status zahtjeva</th> |
143 |
<th>kontakt osoba</th> |
<th>kontakt osoba</th> |
144 |
<td><small>",pg_numrows($result),"</small></td> |
<td><small>",$sth->rows(),"</small></td> |
145 |
</tr> |
</tr> |
146 |
"; |
"; |
147 |
|
|
148 |
include("inc/print_bool2.inc"); |
include("inc/print_bool2.inc"); |
149 |
|
|
150 |
|
$k=0; |
151 |
for ($k = 0; $k < pg_numrows($result); $k++) { |
while ($row=$sth->fetchrow_hash()) { |
|
$row=pg_fetch_array($result,$k); |
|
152 |
if ($k % 2 != 0) { |
if ($k % 2 != 0) { |
153 |
print "<tr>"; |
print "<tr>"; |
154 |
} else { |
} else { |
155 |
print '<tr bgcolor="#f0f0f0">'; |
print '<tr bgcolor="#f0f0f0">'; |
156 |
} |
} |
157 |
|
$k++; |
158 |
print "<td>"; |
print "<td>"; |
159 |
if ($row[kontakt_osoba_id]==$kontakt_osoba_id || isset($prava) && $prava==$pr_admin) { |
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>"; |
print "<a href=\"osoba.php?what=select-osoba&id=$row[id]\">$row[id]</a>"; |
164 |
print "</td><td>$row[ime] $row[prezime]</td> |
print "</td><td>$row[ime] $row[prezime]</td> |
165 |
<td>$row[orgjed]</td><td>"; |
<td>$row[orgjed]</td><td>"; |
166 |
|
|
167 |
$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"); |
$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 |
for ($l = 0; $l < pg_numrows($result1); $l++) { |
$sth1->execute(); |
169 |
$row1=pg_fetch_array($result1,$l); |
while ($row1=$sth1->fetchrow_hash()) { |
170 |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
171 |
} |
} |
172 |
print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>"; |
print "</td><td><a href=\"mailto:$row[e_mail]\">$row[kontakt_osoba]</a><small>"; |
201 |
echo " "; |
echo " "; |
202 |
} |
} |
203 |
|
|
204 |
if (pg_numrows($result) >= $on_page) { |
if ($sth->rows() >= $on_page) { |
205 |
echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a> "; |
echo "<a href=$PHP_SELF?from=".($from+$on_page)."&sql_upit=$sql_upit>+</a> "; |
206 |
} else { |
} else { |
207 |
echo " "; |
echo " "; |