2 |
|
|
3 |
$sql="select titula,ime,note,tel,email,pozicija |
$sql="select titula,ime,note,tel,email,pozicija |
4 |
from zaposleni where $visible_is_true |
from zaposleni where $visible_is_true |
5 |
order by grupa,id |
order by grupa,num,id |
6 |
"; |
"; |
7 |
# print "$sql"; |
# print "$sql"; |
8 |
$sth = $dbh->prepare("$sql"); |
$sth = $dbh->prepare("$sql"); |
9 |
$sth->execute(); |
$sth->execute(); |
10 |
|
|
11 |
|
$pos=1; |
12 |
|
|
13 |
while ($row=$sth->fetchrow_hash()) { |
while ($row=$sth->fetchrow_hash()) { |
14 |
$data[]=$row; |
if ($row[pozicija]=="c") { |
15 |
|
$data[]=$row; // duplicate if center |
16 |
|
$pos=1; |
17 |
|
} else { |
18 |
|
if ($pos % 2 == 1) $row[pozicija]="l"; |
19 |
|
else $row[pozicija]="r"; |
20 |
|
$data[]=$row; |
21 |
|
$pos++; |
22 |
|
} |
23 |
} |
} |
24 |
|
|
25 |
$smarty->assign( "data", $data ); |
$smarty->assign( "data", $data ); |