3 |
include("inc/head.inc"); |
include("inc/head.inc"); |
4 |
include("inc/prava.inc"); |
include("inc/prava.inc"); |
5 |
include("inc/checkbox.inc"); |
include("inc/checkbox.inc"); |
6 |
|
include("inc/sap_org_jed.inc"); |
7 |
|
|
8 |
if (! isset($from)) { |
if (! isset($from)) { |
9 |
$from=0; |
$from=0; |
15 |
Odaberite Vaše ime i prezime: |
Odaberite Vaše ime i prezime: |
16 |
<select name="kontakt_osoba_id">'; |
<select name="kontakt_osoba_id">'; |
17 |
|
|
18 |
$sth = $dbh->prepare("select id,ime,prezime from kontakt_osobe |
$result = pg_Exec ($conn, "select id,ime,prezime from kontakt_osobe |
19 |
where aktivna=true order by ime"); |
where aktivna=true order by ime"); |
20 |
$sth->execute(); |
for ($k = 0; $k < pg_numrows($result); $k++) { |
21 |
while ($row=$sth->fetchrow_hash()) { |
$row=pg_fetch_array($result,$k); |
22 |
echo "<option value=\"$row[id]\""; |
echo "<option value=\"$row[id]\""; |
23 |
if ($row[id]==$kontakt_osoba_id) { echo " selected"; } |
if ($row[id]==$kontakt_osoba_id) { echo " selected"; } |
24 |
echo ">$row[ime] $row[prezime]</option>\n"; |
echo ">$row[ime] $row[prezime]</option>\n"; |
27 |
<input type=submit value="Posebno označi moje zahtjeve"> |
<input type=submit value="Posebno označi moje zahtjeve"> |
28 |
</form>'; |
</form>'; |
29 |
} else { |
} else { |
30 |
$sth = $dbh->prepare("select ime,prezime,passwd,prava 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"); |
31 |
$row=$sth->fetchrow_hash(); |
$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>"; |
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 |
} |
} |
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 |
echo '<br><small>Prikaži status zahtjeva za: |
echo '<br><small>Prikaži status zahtjeva za: |
71 |
',checkbox("shell",$shell),' shell |
',checkbox("shell",$shell),' shell |
72 |
',checkbox("podesavanje",$podesavanje),' podešavanje |
',checkbox("podesavanje",$podesavanje),' podešavanje |
77 |
|
|
78 |
$on_page=50; |
$on_page=50; |
79 |
|
|
80 |
$sql_polja="osobe.id as id,osobe.ime as ime, |
$sql_polja="osobe.id as id,osobe.ime as ime, |
81 |
osobe.prezime as prezime, |
osobe.prezime as prezime, |
82 |
org_jed.naziv||'<br><small>'||org_pod_jed.pod_naziv||'<small>' as orgjed, |
kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba, |
83 |
kontakt_osobe.ime||' '||kontakt_osobe.prezime as kontakt_osoba, |
e_mail,kontakt_osoba_id,sifra |
84 |
e_mail,kontakt_osoba_id |
"; |
85 |
"; |
$sql_tablice="osobe,kontakt_osobe"; |
86 |
$sql_tablice="osobe,org_jed,kontakt_osobe"; |
$sql_where=" |
87 |
$sql_where="org_jed.id=org_jed_id |
kontakt_osoba_id=kontakt_osobe.id |
88 |
and org_pod_jed.pod_id=org_pod_jed_id |
and osobe.aktivna=true |
89 |
and kontakt_osoba_id=kontakt_osobe.id |
"; |
90 |
"; |
$sql_order="order by id"; |
|
$sql_order="order by id"; |
|
91 |
|
|
92 |
if (isset($sql_upit)) { |
if (isset($sql_upit)) { |
93 |
switch($sql_upit) { |
switch($sql_upit) { |
122 |
} |
} |
123 |
|
|
124 |
if (isset($imepr) && $imepr != "") { |
if (isset($imepr) && $imepr != "") { |
125 |
$sql_where.=" and ( upper(toczs(osobe.ime)) like upper(toczs('$imepr')) or upper(toczs(osobe.prezime)) like upper(toczs('$imepr')) )"; |
$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 from $sql_tablice where $sql_where $sql_order limit $on_page,$from"; |
$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>"; |
# echo "<pre>$sql</pre>"; |
137 |
# echo "<pre>$sql_where</pre>"; |
# echo "<pre>$sql_where</pre>"; |
138 |
$sth = $dbh->prepare("$sql"); |
$result = pg_Exec ($conn, "$sql"); |
139 |
|
|
140 |
echo "<table border=1> |
echo "<table border=1> |
141 |
<tr> |
<tr> |
144 |
<th>organizacijska jedinica</th> |
<th>organizacijska jedinica</th> |
145 |
<th>status zahtjeva</th> |
<th>status zahtjeva</th> |
146 |
<th>kontakt osoba</th> |
<th>kontakt osoba</th> |
147 |
<td><small>",$sth->rows(),"</small></td> |
<td><small>",pg_numrows($result),"</small></td> |
148 |
</tr> |
</tr> |
149 |
"; |
"; |
150 |
|
|
151 |
include("inc/print_bool2.inc"); |
include("inc/print_bool2.inc"); |
152 |
|
|
153 |
$k=0; |
|
154 |
while ($row=$sth->fetchrow_hash()) { |
for ($k = 0; $k < pg_numrows($result); $k++) { |
155 |
|
$row=pg_fetch_array($result,$k); |
156 |
if ($k % 2 != 0) { |
if ($k % 2 != 0) { |
157 |
print "<tr>"; |
print "<tr>"; |
158 |
} else { |
} else { |
159 |
print '<tr bgcolor="#f0f0f0">'; |
print '<tr bgcolor="#f0f0f0">'; |
160 |
} |
} |
|
$k++; |
|
161 |
print "<td>"; |
print "<td>"; |
162 |
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) { |
163 |
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>"; |
165 |
print "$row[id]"; |
print "$row[id]"; |
166 |
} |
} |
167 |
print "</td><td>$row[ime] $row[prezime]</td> |
print "</td><td>$row[ime] $row[prezime]</td> |
168 |
<td>$row[orgjed]</td><td>"; |
<td><small>".sap_org_jed($row[sifra])."</small></td><td>"; |
169 |
|
|
170 |
$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"); |
$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 |
while ($row1=$sth1->fetchrow_hash()) { |
for ($l = 0; $l < pg_numrows($result1); $l++) { |
172 |
|
$row1=pg_fetch_array($result1,$l); |
173 |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
print "<small>$row1[datum]</small> $row1[opis]<br>"; |
174 |
} |
} |
175 |
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>"; |
204 |
echo " "; |
echo " "; |
205 |
} |
} |
206 |
|
|
207 |
if ($sth->rows() >= $on_page) { |
if (pg_numrows($result) >= $on_page) { |
208 |
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> "; |
209 |
} else { |
} else { |
210 |
echo " "; |
echo " "; |