"; print_r($ra); die("--"); } if (COUNT($ra) > 0){ $pdf = new Fpdi("P", "mm", "A4"); $pdf-> AddFont('noto'); $pdf-> AddFont('noto', 'B'); $pdf->SetTopMargin(20); $pdf->SetAutoPageBreak(1, 20); $pageCount = $pdf->setSourceFile('gfx/voorblad.pdf'); $pageId = $pdf->importPage(1, PdfReader\PageBoundaries::MEDIA_BOX); $pdf-> addPage(); $pdf-> useImportedPage($pageId, 0, 0, 210); $x = 10; $y = 25; foreach($ra as $rw){ $itm = $rw["itmz"][0]; array_shift($rw["itmz"]); $iw = 190; $ih = $iw * $itm["r"]; $tit = $rw["tit"]; $loc = $rw["loc"]; $sub = $rw["sub"]; $txt = $rw["shr"]; if (isset($itm["fnm"])) { $pdf-> addPage(); $y = 25; $pdf-> Image($itm["fnm"], $x, $y, $iw, $ih); } $pdf->setY($y+$ih); $pdf->setX(40); $pdf->SetFont('noto','B', 20); $pdf->MultiCell(130, 20, $tit, '', 'L'); $pdf->setX(40); $pdf->SetFont('noto','B', 14); $pdf->MultiCell(130, 2, $loc, '', 'L'); $pdf->setX(40); $pdf->SetFont('noto','', 10); $pdf->MultiCell(130, 14, $sub, '', 'L'); $pdf->setX(40); $pdf->SetFont('noto','', 9); $pdf->MultiCell(130, 6, $txt, '', 'L'); $pdf->Ln(); foreach($rw["itmz"] as $itm){ switch ($itm["mdm"]){ case "img": $y = $pdf -> GetY(); $iw = 130; $ih = $iw * $itm["r"]; if (($y+$ih) > 260){ $pdf->addPage();} $y = $pdf -> GetY(); $pdf-> Image($itm["fnm"], 40, $y, $iw, $ih); $y += ($ih); $pdf->setY($y); $pdf->setX(40); $pdf->SetFont('noto','', 7); $pdf->MultiCell(130, 6, ctt($itm["tit"]), '', 'L'); $pdf->Ln(); break; case "txt": $tit = ctt($itm["tit"]); $txt = ctt($itm["txt"]); $pdf->setX(40); $pdf->SetFont('noto','B', 10); $pdf->MultiCell(130, 5, $tit, '', 'L'); $pdf->setX(40); $pdf->SetFont('noto','', 9); $pdf->MultiCell(130, 5, $txt, '', 'L'); $pdf->Ln(); break; case "qot": $tit = ctt($itm["tit"]); $txt = ctt(preg_replace("/\r|\n/", "", $itm["txt"])); $pdf->setX(40); $pdf->SetFont('noto','B', 14); $pdf->MultiCell(130, 7, $txt, '', 'L'); $pdf->setX(40); $pdf->SetFont('noto','', 8); $pdf->MultiCell(130, 5, $tit, '', 'L'); $pdf->Ln(); break; } } foreach($rw["specs"] as $var => $val){ $y = $pdf -> GetY(); $pdf->setX(40); $pdf->SetFont('noto','', 7); $pdf->MultiCell(30, 6, $var, '', 'L'); $pdf->setXY(70, $y); $pdf->SetFont('noto','', 9); $pdf->MultiCell(100, 6, $val, '', 'L'); } } } $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $tit = ctt(msg(2)); $txt = ctt(xpr(3)); $sub = ctt(xpr(19)); $y = $pdf -> GetY(); $pdf->setX(40); $pdf->SetFont('noto','', 7); $pdf->MultiCell(30, 6, "contact", '', 'L'); $pdf->setXY(70, $y); $pdf->SetFont('noto','B', 9); $pdf->MultiCell(100, 6, "$tit", '', 'L'); $pdf->setX(70); $pdf->SetFont('noto','', 9); $pdf->MultiCell(100, 6, "$sub", '', 'L'); /* I: send the file inline to the browser. The PDF viewer is used if available. D: send to the browser and force a file download with the name given by name. F: save to a local file with the name given by name (may include a path). S: return the document as a string. */ $pdf->Output("i", "studiomarcovermeulen.pdf"); function pro($id){ global $q, $gp, $gl, $gt; $ra = array(); $rw = gr("pro", $id); $ra["id"] = $rw["id"]; $ra["tit"] = ctt($rw["tit$gl"]); $ra["sub"] = ctt($rw["sub$gl"]); $ra["loc"] = ctt($rw["loc$gl"]); $ra["shr"] = ctt($rw["shr$gl"]); $ra["txt"] = $shr ?: ctt($rw["txt$gl"]); $ra["specs"] = specs($rw); $ra["itmz"] = itmz("pro", $id); return $ra; } function specs($rw){ global $q, $gp, $gl, $gt; $ra = array(); $specs = array( "loc" => lan("locatie", "location"), "yyr" => lan("jaar", "year"), "team" => "team", "par$gl" => lan("in samenwerking met", "in cooperation with"), "prg$gl" => lan("programma", "programme"), "sts$gl" => "status", "cli" => lan("opdrachtgever", "client"), "url" => "website" ); $rs .= "
"; foreach($specs as $spec => $d){ $v = $rw["$spec"]; if ($spec == "cli") $v = clients($rw["id"]); if ($spec == "team") $v = team($rw["id"]); if ($v && $v!="0000") $ra["$d"] = ctt($v); } return $ra; } function clients($pro){ global $q, $gp, $gl, $gt; $ra = array(); $res = pdo("SELECT c.* FROM cli c, rel r WHERE r.l='$pro' AND c.id=r.r AND r.t = 'p_cl' AND c.pub_nl=1 ORDER BY c.seq"); while($rw = $res->fetch(PDO::FETCH_ASSOC)) { $id = $rw["id"]; $tit = $rw["tit_nl"]; $ra[] = $tit; } return join(", ", $ra); } function team($pro){ global $q, $gp, $gl, $gt; $ra = array(); $res = pdo("SELECT t.* FROM team t, rel r WHERE r.l='$pro' AND t.id=r.r AND r.t = 'p_tm' AND t.pub_nl=1 ORDER BY t.seq"); while($rw = $res->fetch(PDO::FETCH_ASSOC)) { $tit = $rw["tit_nl"]; $ra[] = $tit; } return join(", ", $ra); } function itmz($tb, $pid){ global $q, $g, $gp, $gl, $gt; $ra = array(); $res = pdo("SELECT * FROM itmz WHERE typ='$tb' AND pid='$pid' AND pub_nl='1' ORDER BY seq ASC"); while($rw = $res->fetch(PDO::FETCH_ASSOC)) { $id = $rw["id"]; $tit = $rw["tit$gl"]; $txt = $rw["txt$gl"]; $mdm = $rw["mdm"]; $fnm = $rw["fnm"]; $siz = $rw["siz"]; $r = $rw["r"] ?: 1; $pth = "../files/$tb/".sprintf("%04s", $pid); switch($mdm){ case "img": $mnm = "$pth/".tnm($fnm, "_mm"); $ra[] = array( "mdm" => "$mdm", "fnm" => "$mnm", "tit" => "$tit", "siz" => "$siz", "r" => "$r", ); break; case "txt": case "qot": $ra[] = array( "mdm" => "$mdm", "tit" => "$tit", "txt" => "$txt", ); break; } } return $ra; } function tnm($fnm, $xt='_th'){ $pp = pathinfo($fnm); $fe = $pp['extension']; $rs = (($fe == "svg")? $fnm: $pp['filename']."$xt.jpg"); return $rs; } function ctt($str){ //$rs = iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $str)."---"; $rs = preg_replace("/\[.*?\](.*?)\[\/.*?\]/is", "$1", $str); $rs = stripslashes(strip_tags(iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $rs))); return $rs; } ?>