<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
session_start();
require(root."/_common.php");
require(root."/_lib/db.php");
require(root."/_lib/main.php");
require(root."/mobileDetect/Mobile_Detect.php");
require(root."/_lib/bootstraps.php");
$page_id = "promo";
$page_title = "Promo";
$url = trim(cekpost(cleanQuery($_REQUEST["url"]), ""));
require(root."/_tpl/html_begin.php");
require(root."/_tpl/tag_head.php");
require(root."/_tpl/ie_style_exception.php");
/*
 * begin
 * additional style
 * */
cout('<style type="text/css">');
cout('');
cout('</style>');
/*
 * end
 * additional style
 * 
 * v
 * v
 * closing tag head
 * 
 * */
require(root."/_tpl/body_open.php");


cout('<div class="container-fluid main-body">');
	cout('<div class="decor-1"></div>');
	
	cout('<div class="container-fluid">');
		cout('<div class="container for-footer">');
			cout('<div class="decor decor-1"></div>');
			cout('<div class="decor decor-2"></div>');
			cout('<div class="decor decor-3"></div>');
			cout('<div class="special-box">');
				cout('<div class="decor decor-1"></div>');
				cout('<div class="decor decor-2"></div>');
				cout('<div class="content">');
					cout('<div class="decor decor-1"></div>');
					cout('<div class="decor decor-2"></div>');
					cout('<div class="title">');
						cout('<div class="page-title">Promo</div>');
						cout('<div class="decor decor-1"></div>');
					cout('</div>');
					cout('<div class="real-content">');
						$rs=array();$q="SELECT * FROM s_promo WHERE isactive=1 ORDER BY tanggal";
						#$rs = callRS($q);
						callRS($rs, $q);
						for ($i=0;$i<count($rs);$i++) {
							$rsf=array(); $qf="SELECT * FROM u_files WHERE kdpromo='".$rs[$i]["kd"]."'";
							#$rsf = callRS($qf);
							callRS($rsf, $qf);
							
							$rsf=array(); $qf="SELECT * FROM u_files WHERE kdpromo='".$rs[$i]["kd"]."'";
							#$rsf = callRS($qf);
							callRS($rsf, $qf);
							
							$path = str_replace("../../", "/", $rsf[0]["full_path"]);
							$resized = str_replace(".".$rsf[0]["ext"]."", "_800.".$rsf[0]["ext"]."", $path);
							$resized = $resized."?".time();
							/*
							$path = str_replace("../../", "/", $rsf[0]["full_path"]);
							$resized = str_replace(".".$rsf[0]["ext"]."", "_500.".$rsf[0]["ext"]."", $path);
							$resized = $resized."?".time();
							*/
							$isrc = $resized;
							$ititle = $rsf[0]["image_title"];
							$ialt = $rsf[0]["image_alt"];
							
							$isi = str_replace("\n", "<br/>", $rs[$i]["isi"]);
							$isi = str_replace("<br/><li>", "<li>", $isi);
							$isi = str_replace("<br/></ol>", "</ol>", $isi);
							$isi = str_replace("<br/></ul>", "</ul>", $isi);
							cout('<div class="row for-footer">');
								cout('<div class="special-box">');
									cout('<div class="row">');
										cout('<div class="col-md-10 col-md-offset-1 promo-judul">');
											cout('<div class="panel panel-danger text-center greet" style="margin:10px 0;">');
												cout('<div class="panel-heading">'.$rs[$i]["judul"].'</div>');
											cout('</div><!-- /.panel -->');
										cout('</div>');
										cout('<div class="col-md-4">');
											if (count($rsf)!=0) {
												cout('<div style="margin:5px;"><img src="'.$isrc.'" alt="" class="img-responsive center-block" /></div>');
											}
										cout('</div><!--/.col-md-4-->');
										cout('<div class="col-md-8">');
											cout($isi);
										cout('</div><!--/.col-md-8-->');
									cout('</div><!--/.row-->');
								cout('</div><!--/.special-box-->');
							cout('</div><!--/.row for-footer-->');
						}
						
					cout('</div><!--/.real-content-->');
				cout('</div><!--/.content-->');
			cout('</div><!--/.special-box-->');
			
		cout('</div><!--/.container for-footer-->');
	cout('</div><!--/.container-fluid-->');
	
require(root."/_tpl/body_close.php");
?>