<?php
if(count(get_included_files())==1) exit("Direct access not permitted.");
$mod = basename(__FILE__, '.php');
$page->tbCss($mod);
$page->tbJs($mod);

$query="select t1.`id`,
			t1.`nama`,
			t1.`deskripsi`,
			t1.`keterangan`,
			t1.`idgambar`,
			t1.`idicon`,
			t1.`urutan`,
			t1.`status`,
			t2.nama_baru as namagambar,
			t2.folder as foldergambar,
			t3.nama_baru as namaicon,
			t3.folder as foldericon
		from tb_layanan as t1
		inner join tb_dokumen as t2 on t1.idgambar=t2.id
		inner join tb_dokumen as t3 on t1.idicon=t3.id
		where t1.id>0 order by t1.urutan asc";
$rslayanan=$db->loadAll($query);
$pos=0;
foreach ($rslayanan as $obj) {
	$deskripsi=$obj['deskripsi'];
	
	if(strlen($deskripsi)>170) {
		$strdeskripsi=mb_strimwidth($deskripsi, 0, 170, '');
		$deskripsi = substr($strdeskripsi,0,strrpos($strdeskripsi," "))." ...";
	}
	
	$rslayanan[$pos]['sortdeskripsi']=$deskripsi;
	$pos++;
}
$page->addLoad("utamalayanan.init(".json_encode($rslayanan,true).")");
?>
<div class="layanan_main_judul">LAYANAN</div>
<div id="box_layanan_main" class="box_layanan_main"></div>
<div style="clear: both;"></div>
<div class="layanan_main_back" onclick="utamalayanan.next()"></div>
<div class="layanan_main_next" onclick="utamalayanan.back()"></div>