currentLanguage = "EN"; $page->currentLanguageL = "en"; if (isset($_REQUEST["lang"])) { switch(strtolower($_REQUEST["lang"])) { case "fr": $page->currentLanguage = "FR"; $page->currentLanguageL = "fr"; $page->languageID = 2; break; } } $currentLanguage = $page->currentLanguage; require "lang/".$page->currentLanguageL.".php"; $page->initTemplate(ID_PAGE_HOME); $propertyID = (int)$_REQUEST["id"]; $sql = "SELECT * FROM tbl_yacht AS P WHERE P.ID = $propertyID "; $result = mysql_query($sql); $oProduct = mysql_fetch_object($result); $tCell = array(); $priceText = $oProduct->PriceText; if (empty($priceText)) { $priceText = TEXT_PRICE_ON_REQUEST; } $tCell[TEXT_PRICE] = $priceText; $tCell[TEXT_REF] = yacht::printRef($oProduct->Code); $tCell[TEXT_BUILDER] = $page->aBuilder[$oProduct->BuilderID]; $tCell[TEXT_TYPE] = $page->aYachtType[$oProduct->TypeID]; if ((string)$oProduct->Year != "") { $tCell[TEXT_YEAR] = $oProduct->Year; } $tCell[TEXT_LENGTH] = number_format($oProduct->LOA)."m"; $tCell[TEXT_BEAM] = number_format($oProduct->Beam)."m"; $tCell[TEXT_CREW] = $oProduct->Crew; $tCell[TEXT_GUESTS] = $oProduct->Sleeps; $tCell[TEXT_CABINS] = $oProduct->Cabins; if ((string)$oProduct->CabinConfiguration != "") { $tCell[TEXT_CABIN_CONFIGURATION] = $oProduct->CabinConfiguration; } if ((float)$oProduct->SpeedMax != 0) { $tCell[TEXT_MAX_SPEED] = number_format($oProduct->SpeedMax)." kts"; } $tCell[TEXT_CRUISE_SPEED] = number_format($oProduct->SpeedCruise)." kts"; if ((float)$oProduct->FuelConsumption != 0) { $tCell[TEXT_FUEL_CONSUMPTION] = number_format($oProduct->FuelConsumption,2)." litres/hr"; } if ((string)$oProduct->HullConstruction != "") { $tCell[TEXT_HULL_CONSTRUCTION] = $oProduct->HullConstruction; } if ((string)$oProduct->HullConfiguration != "") { $tCell[TEXT_HULL_CONFIGURATION] = $oProduct->HullConfiguration; } $fHTML = ""; $columns = 4; $counter = 0; for($i=0;$i"; $counter++; if ($counter % $columns == 0) $fHTML .= ""; } if ($counter % $columns != 0) $fHTML .= ""; } if ($fHTML) { $fHTML = "

Property Features

".$fHTML."
"; } $tableHTML = ""; $columns = 2; $column = 1; foreach ($tCell as $th => $td) { if ($column == 1) $tableHTML .= ""; $tableHTML .= "$th$td"; $column++; if ($column > $columns) { $tableHTML .= "".PHP_EOL; $column = 1; } } if ($column != 1) { $tableHTML .= " "; } if (!empty($productRow['View'.$currentLanguage])) { $tableHTML .= "".$aText['View']."".htmlentities($productRow['View'.$currentLanguage],ENT_COMPAT,"UTF-8").""; } $sql = "SELECT * FROM tbl_yacht_image WHERE ParentID = $propertyID ORDER BY ParentImageOrder"; $result = mysql_query($sql); $row = mysql_fetch_array($result); // $imageURL = $row["TargetURL"]; $rows = array(); $iColumn = 0; $iRow = 0; $numColumns = 2; $mainImageURL = false; $deleteImages = array(); while ($row = mysql_fetch_array($result)) { $url = $row["TargetURL"]; $filename = "../upload/yacht-charter-images/".$row['ImageURL']; $tempFilename = "temp/".uniqid().".jpg"; if (!copy($filename,$tempFilename)) { echo "copy failed $filename - $tempFilename"; } else { $deleteImages[] = $tempFilename; if (!$mainImageURL) $mainImageURL = $tempFilename; } $itemHTML = "
"; if (!isset($rows[$iRow])) $rows[$iRow] = array(); $rows[$iRow][$iColumn] = $itemHTML; $iColumn++; if ($iColumn == $numColumns) { $iRow++; $iColumn = 0; } } // code crashes if table on 2 pages so one table per row $imageHTML = ""; $iRow = 0; foreach ($rows as $row) { if ($iRow % 4 == 0) { if ($imageHTML) $imageHTML .= ""; // $imageHTML .= "
"; } $imageHTML .= ""; foreach ($row as $cell) { $imageHTML .= ""; } $imageHTML .= "
".$cell."
"; $iRow++; } // $imageHTML .= "
"; $html = ' '; $html .= ""; // $html .= "

".$aText['Ref'].": ".property::$ref."

"; $html .= "

".$oProduct->Title."

"; // $mainImageURL = "img/yacht-charter-main/".$row["ImageID"]."'/".$imageURL; // if (!file_exists($mainImageURL)) { // $mainImageURL = "images/yachts/main/".$imageURL; // } $html .= "
"; // $html .= "
"; // $html .= "

".htmlentities($aText['Property Details'],ENT_COMPAT,"UTF-8")."

"; $html .= "".$tableHTML."
"; if (empty($oProduct->DescriptionPDF)) { $html .= "
".$oProduct->Description."
"; } else { $html .= "
".$oProduct->DescriptionPDF."
"; } $html .= $fHTML; // $html .= "
"; $html .= ""; if ($imageHTML != "") { // $html .= "
"; $html .= "

".TEXT_EXTRA_PHOTOS."

"; // die($imageHTML); $html .= $imageHTML; } $html .= ""; // $oPdf = new mPDF('c','A4',12,'Helvetica',15,15,40,15,9,9,'P'); $oPdf = new mPDF([ 'mode' => 'utf-8', 'orientation' => 'P', 'margin_top' => 40, 'default_font' => 'Helvetica' ]); $html = str_replace("€","€",$html); $oPdf->SetHTMLHeader("
"); $footerHTML = "
Email:".$settings->contactEmail."Tel:".$settings->contactTelephone."
"; // $footerHTML .= $aText["Fax"].":".$siteSettings["contactFax"]; // $oPdf->SetHTMLFooter($footerHTML); /* $oPdf->load_html($html); $oPdf->render(); $dompdf->set_paper('a4', 'portrait'); // letter, landscape $dompdf->stream("sample_".time().".pdf"); */ $oPdf->WriteHTML($html); $oPdf->Output(); foreach ($deleteImages as $tempFilename) { unlink($tempFilename); } die(); ?>