?>
// options for ssl in php 5.6.5
$opts = array(
'ssl' => array(
'ciphers' => 'RC4-SHA',
'verify_peer' => false,
'verify_peer_name' => false
)
);
// SOAP 1.2 client
$soap_params = array(
'encoding' => 'UTF-8',
'verifypeer' => false,
'verifyhost' => false,
'soap_version' => SOAP_1_2,
'trace' => 1,
'exceptions' => 1,
'connection_timeout' => 180,
'stream_context' => stream_context_create($opts)
);
$client = new SoapClient("http://api.digibusiness.it/navis2ws/navis2ws.asmx?WSDL", $soap_params);
$engineInfo = array(
"groupID" => $config->GroupGuid,
"engineID" => $params[0],
"visibilityLevel" => $config->VisibilityLevel,
"culture" => $config->CultureWS
);
$soap_result = $client->GetEngineInfo($engineInfo);
$engineInfo = ($soap_result->GetEngineInfoResult->any);
$engineInfo = new SimpleXMLElement($engineInfo);
global $mainTbl;
global $boatFamiliesTbl;
global $enginesTbl;
global $generatorsTbl;
global $imagesTbl;
global $videosTbl;
global $accessoriesTbl;
global $levelsTbl;
global $componentsTbl;
global $subElementsTbl;
global $attachmentsTbl;
global $imagesTblCount;
global $videosTblCount;
$mainTbl = $engineInfo->EngineInfo->GeneralData; //Dati generici
$boatFamiliesTbl = $engineInfo->EngineInfo->BoatFamilies; //Tipologia
$enginesTbl = $engineInfo->EngineInfo->Engines; //Generatori
$generatorsTbl = $engineInfo->EngineInfo->Generators; //Motori
$imagesTbl = $engineInfo->EngineInfo->Images; //Immagini
$videosTbl = $engineInfo->EngineInfo->Videos; //Video
$accessoriesTbl = $engineInfo->EngineInfo->Accessories; //Accessori
$levelsTbl = $engineInfo->EngineInfo->Levels; //Livelli
$componentsTbl = $engineInfo->EngineInfo->Components; //Componenti
$subElementsTbl = $engineInfo->EngineInfo->SubElements; //Subelements
$attachmentsTbl = $engineInfo->EngineInfo->Attachments; //Attachments
$imagesTblCount = count($imagesTbl); //Count delle immagini
$videosTblCount = count($videosTbl); //Count dei video
$engineInfoPrintType1 = $config->EngineInfoSalePrintType1;
$engineInfoPrintText1 = $config->EngineInfoSalePrintText1;
$boatInfoPrintMultiLang1 = $config->BoatInfoSalePrintMultiLang1;
$engineInfoPrintType2 = $config->EngineInfoSalePrintType2;
$engineInfoPrintText2 = $config->EngineInfoSalePrintText2;
$boatInfoPrintMultiLang2 = $config->BoatInfoSalePrintMultiLang2;
//Titolo della pagina
$builder_model = getBoatDescription(getMainField("Builder"), getMainField("Model"));
$builder = trim(getMainField("Builder"));
$model = trim(getMainField("Model"));
$year = getMainField("YearBuilt");
if (strpos($model, $builder) === 0) {
$model = trim(substr($model, strlen($builder)));
}
$builder_model_year = $builder_model;
if (!isParamEmpty($year)) {
$builder_model_year .= " (" . $year . ")";
}
//Print link
$printUrl1 =
"http://app2.digibusiness.it/naviswebprint/print.aspx?" .
"group_id=" . ($config->BoatInfoPrintUseBoatIDGroup ? $mainTbl->IDGroup : $config->GroupID) . "&" .
"boat_code=" . $mainTbl->Code . "&" .
"print_type=" . $engineInfoPrintType1 . "&" .
"num_header=" . $config->EngineInfoPrintHeader . "&" .
"id_sede=" . $config->EngineInfoPrintSede . "&" .
"culture=";
$printUrl2 =
"http://app2.digibusiness.it/naviswebprint/print.aspx?" .
"group_id=" . ($config->BoatInfoPrintUseBoatIDGroup ? $mainTbl->IDGroup : $config->GroupID) . "&" .
"boat_code=" . $mainTbl->Code . "&" .
"print_type=" . $engineInfoPrintType2 . "&" .
"num_header=" . $config->EngineInfoPrintHeader . "&" .
"id_sede=" . $config->EngineInfoPrintSede . "&" .
"culture=";
//Componenti
global $componentsTblCategs;
global $componentsTblTypesCount;
global $componentsTblTypesNames;
//$componentsTblCategs[0..3] -> elenco di tutti i componenti presenti nella categoria
$componentsTblCategs = array(
array(), //ComponentsCategs[0] -> elemento che non può avere posti letto
array(), //ComponentsCategs[1] -> elemento che può avere posti letto
array(), //ComponentsCategs[2] -> vela
array(), //ComponentsCategs[3] -> albero
);
$componentsTblTypesCount = array(); //$componentsTblTypesCount[id_component] -> conteggio componenti
$componentsTblTypesNames = array(); //$componentsTblTypesNames[id_component] -> nome componente
foreach($componentsTbl as $component) {
//id del tipo di componente
$el_type = (int)$component->ElementType;
$el_categ = (int)$component->Category;
//Salvo il conteggio dei componenti
$value = array_key_exists($el_type, $componentsTblTypesCount) ? (int)$componentsTblTypesCount[$el_type] : 0;
$value += 1;
$componentsTblTypesCount[$el_type] = $value;
//suddivido per categorie
if (!in_array($el_type, $componentsTblCategs[$el_categ])) {
array_push($componentsTblCategs[$el_categ], $el_type);
}
//Salvo il nome
if (!array_key_exists($el_type, $componentsTblTypesNames)) {
$componentsTblTypesNames[$el_type] = $component->Text;
}
}
sort($componentsTblCategs[0]);
sort($componentsTblCategs[1]);
sort($componentsTblCategs[2]);
sort($componentsTblCategs[3]);
$componentsCabins = array_merge($componentsTblCategs[1], $componentsTblCategs[0]);
$componentsSails = array_merge($componentsTblCategs[3], $componentsTblCategs[2]);
//Livelli
$levelsTblGuids = array();
//salvo una lista di id dei livelli
foreach ($levelsTbl as $level) {
array_push($levelsTblGuids, (string)$level->ID);
}
// Array titoli sezione ACCESSORI
$accessoriesTblTitles = array (
1 => __("Eletronic tools for navigation", "navis-wp", "navis-wp"),
2 => __("Staging and technical", "navis-wp"),
3 => __("Domestic facilities onboard", "navis-wp"),
4 => __("Security equipment", "navis-wp"),
5 => __("Entertainment", "navis-wp"),
6 => __("Sails accessories", "navis-wp"),
7 => __("Fishing accessories", "navis-wp"),
8 => __("Kitchen and appliances", "navis-wp"),
9 => __("Upholstery", "navis-wp"),
);
/////////////////////////////////
// GET ENGINES FAMILIES
$path = ini_get("soap.wsdl_cache_dir")."/GetEnginesFamilies.itIT.cache.xml";
$cache_time = 24 * 60 * 60; //1 giorno di cache
global $enginesTblFamilies;
if (file_exists($path) && ((time() - filemtime($path)) < $cache_time)) {
//prendo il file dalla cache
$enginesTblFamilies = simplexml_load_file($path);
}
else {
//chiamo il webservice e salvo il file
$enginesTblFamilies = $client->GetEnginesFamiliesString(array("culture" => $config->CultureWS));
$enginesTblFamilies = new SimpleXMLElement($enginesTblFamilies->GetEnginesFamiliesStringResult);
$enginesTblFamilies->asXML($path);
}
// FINE GET ENGINES FAMILIES
/// differenza field tra charter e usato
//MODIFICA SHARING
if (get("sharing") == "1") {
$PriceFormatted= "RequestedAssignmentPriceFormatted";
$PriceVAT="";
}
else {
if ($mainTbl->Sale == "true") {
// usato
$PriceFormatted="SellPriceFormatted";
$PriceVAT="SellPriceVAT";
$ReducedPrice="OldSellPriceFormatted";
$SellPriceReduced="SellPriceReduced";
}
else {
// charter
$PriceFormatted="CharterPriceFormatted";
$PriceVAT="CharterPriceVAT";
}
}
// FUNZIONI //
function generateTableRow($field, $label, $unit = "", $content_bold = false, $td_style = "") {
return (generateTableRowFromValue(getMainField($field), $field, $label, $unit, $content_bold, $td_style));
}
function generateTableRowFromValue($value, $field, $label, $unit = "", $content_bold = false, $td_style = "") {
if (!isParamEmpty($value)) {
if ($unit != "") {
$value = normalizeNum($value) . " " . $unit;
}
return (
"
" . $label . "
|
" . $value . "
|
"
);
}
return ("");
}
function generateBlock($field, $label, $unit = "", $content_bold = false, $td_style = "") {
return (generateBlockFromValue(getMainField($field), $field, $label, $unit, $content_bold, $td_style));
}
function generateBlockFromValue($value, $field, $label, $unit = "", $content_bold = false, $td_style = "") {
if (!isParamEmpty($value)) {
if ($unit != "") {
$value = normalizeNum($value) . " " . $unit;
}
return (
"
" . $label ."
". $value . "
"
);
}
return ("");
}
function generateBlockHabitability($field, $label, $unit = "", $content_bold = false, $td_style = "") {
return (generateBlockHabitabilityFromValue(getMainField($field), $field, $label, $unit, $content_bold, $td_style));
}
function generateBlockHabitabilityFromValue($value, $field, $label, $unit = "", $content_bold = false, $td_style = "") {
if (!isParamEmpty($value)) {
if ($unit != "") {
$value = normalizeNum($value) . " " . $unit;
}
return (
"
" . $label ."
". $value . "
"
);
}
return ("");
}
function generateMaterialDiv($level, $component) {
//
ElementType . ".gif\" alt=\"\" width=\"64\" /> |
$content = (!isParamEmpty($component->Text) ? $component->Text : $level->Text) . "
";
if (!isParamEmpty($component->Material)) {
$content .= $component->Material;
if (!isParamEmpty($component->Colour)) {
$content .= " (" . $component->Colour . ")";
}
}
else if (!isParamEmpty($component->Colour)) {
$content .= $component->Colour;
}
return (
//"
//
//
// " . $content . " |
//
//
//
"
"
" . $content . "
"
);
}
function generateComponentsTable($types_array) {
global $componentsTblTypesCount;
global $componentsTblTypesNames;
$types_array_count = count($types_array);
if ($types_array_count == 0) return ("");
$table = "
";
for ($i = 0; $i < $types_array_count; $i++) {
// |
$table .=
"
" . $componentsTblTypesCount[$types_array[$i]] . " x " . $componentsTblTypesNames[$types_array[$i]] . "
|
| ";
if (($i % 2 == 1) && (($i + 1) < $types_array_count)) {
$table .= "
"; //Chiudo la riga e ne apro un'altra, se l'elemento successivo non sfora il totale
}
}
$table .= "
";
return ($table);
}
function getEngineFamilyFromId($id) {
global $enginesTblFamilies;
$elements = $enginesTblFamilies->children();
foreach ($elements as $item) {
if ($item->ID == $id) {
return ($item->Text);
}
}
return ("ND");
}
function getAccessories($id_type) {
global $accessoriesTbl;
$accs = "";
foreach ($accessoriesTbl as $acc) {
if ($acc->Type == $id_type) {
if ($accs !== "") {
$accs .= ", ";
}
if ($acc->Qty > 1) {
$accs .= $acc->Qty . " x ";
}
$accs .= $acc->Text;
if (!isParamEmpty($acc->Comment)) {
$accs .= " (" . $acc->Comment . ")";
}
}
}
if (!isParamEmpty($accs)) {
$accs .= ".";
}
return ($accs);
}
function getAccessoriesUL($id_type, $class = "") {
global $accessoriesTbl;
$accs = "";
foreach ($accessoriesTbl as $acc) {
if ($acc->Type == $id_type) {
$accs .= "
";
if ($acc->Qty > 1) {
$accs .= $acc->Qty . " x ";
}
$accs .= $acc->Text;
if (!isParamEmpty($acc->Comment)) {
$accs .= " (" . $acc->Comment . ")";
}
$accs .= "";
}
}
if (!isParamEmpty($accs)) {
$accs = "
";
}
return ($accs);
}
function getMainField($field) {
global $mainTbl;
return (htmlEncode($mainTbl->$field));
}
function getMainNumField($field) {
$value = getMainField($field);
if (!isParamEmpty($value)) {
$value = normalizeNum($value);
return ($value);
}
return ($value);
}
?>
if ($config->BoatInfoRequestInfoJS) {
$emailBoxTopTextTitle = __("Request info", "navis-wp");
$emailBoxTopTextBoat = """ . $builder_model_year . "" (Codice: " . getMainField("Code") . ")";
$emailBoxSubject = $emailBoxTopTextTitle . " " . $emailBoxTopTextBoat;
$emailBoxBoatId = getMainField("BoatID");
include dirname(__DIR__) . "/pack/email_box.php";
}
$html = "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
if ($videosTblCount > 0) {
$html .= "
\r\n";
}
else if ($imagesTblCount > 0) {
$html .= "
";
}
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
" . $builder_model_year . "";
$html .= "
(" . __("Code", "navis-wp") . " " . getMainField("Code") . ")
";
$html .= "
";
$html .= "
";
if (getMainField("Sold") == "true") {
$html .= "
" . __("Sold", "navis-wp") . "
";
}
else if (getMainField("PendingSale") == "true") {
$html .= "
" . __("Pending sale", "navis-wp") . "
";
}
else {
$html .= "
";
if (getMainField("ReservedPrice") == "true") {
$html .= __("Reserved price", "navis-wp");
} else {
$html .= getMainField($PriceFormatted);
}
$html .= "
";
if (($config->BoatInfoShowReducedPrice) && (getMainField("SellPriceReduced") == "true")) {
$html .= "
" . getMainField("OldSellPriceFormatted") . "
";
}
}
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
if ($imagesTblCount > 1) {
//CAROUSEL
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
}
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "" . __("Technical details", "navis-wp") ."";
$html .= "
";
$html .= generateBlock("Location", __("Visible", "navis-wp"));
$html .= generateBlock("SellPriceAvailability", __("Availability", "navis-wp"));
$html .= generateBlock("VAT", __("SellPriceVAT", "navis-wp"));
$html .= generateBlock("Revision", __("Revision", "navis-wp"));
$html .= generateBlock("HP", __("Power (Hp)", "navis-wp"));
$html .= generateBlock("HPFiscal", __("Taxable horsepower", "navis-wp"));
$html .= generateBlock("Length", __("Length", "navis-wp"), "mm");
$html .= generateBlock("Width", __("Width", "navis-wp"), "mm");
$html .= generateBlock("Height", __("Height", "navis-wp"), "mm");
$html .= generateBlock("Weight", __("Weight", "navis-wp"));
$html .= generateBlock("Rpm", __("Rpm max", "navis-wp"));
$html .= generateBlock("Cylinders", __("Cylinders", "navis-wp"));
$html .= generateBlock("Propeller", __("Propeller Diameter", "navis-wp"), "in");
$html .= "
";
$html .= "
";
if (!isParamEmpty(getMainField("Notes"))) {
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "" . __("Notes", "navis-wp") . "";
$html .= "
";
$html .= "
";
$html .= "" . convertEndLineToBr(getMainField("Notes")) . "";
$html .= "
";
$html .= "
";
$html .= "
";
}
//BOTTONI STAMPE
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= "
";
?>