foreach ($locations as $location) {
            if (!is_numeric($location)) {
                array_push($locArray, $location);
            } else {
                break;
            }
        }
        $locString = implode($locArray);
        unset($contentsArray[$index]['location']);
        $contentsArray[$index]['location'] = $locString;
    }
    return $contentsArray;
}
// This function formats the area by exploding on spaces for each area and then resetting the value of each area only to the first value in the areas array.
function formatArea($contentsArray)
{
    foreach ($contentsArray as $index => $value) {
        $areas = explode(' ', $contentsArray[$index]['area']);
        unset($contentsArray[$index]['area']);
        $contentsArray[$index]['area'] = $areas[0];
    }
    return $contentsArray;
}
// Each function is called and saved as $contentsArray to cut down on variables.
// Each time the updated version of the array is saved over the previous array of the same name.
$contentsArray = readTheFile('public/data/parks.csv');
$contentsArray = cutOne($contentsArray);
$contentsArray = reorderArray($contentsArray);
$contentsArray = formatLocation($contentsArray);
$contentsArray = formatArea($contentsArray);
// print_r($contentsArray);
예제 #2
0
function drawPropertyDetail()
{
    global $detailHeaderText;
    global $detailImage1;
    global $detailReference;
    global $detailPrice;
    global $detailPrice2;
    global $detailLocation;
    global $detailType;
    global $detailROLType;
    global $detailROLSubType;
    global $detailBeds;
    global $detailBaths;
    global $detailPlot;
    global $detailArea;
    global $detailTerrace;
    global $detailEnergy;
    global $detailDescription;
    global $photoArray;
    global $featuresArray;
    global $builds;
    global $dimension;
    global $agencyRef;
    global $currencyIcon;
    global $dir;
    global $languageArr;
    global $showMap;
    global $bookingPage;
    global $showBookingCalendar;
    global $datePickerLanguages;
    global $language;
    $currencyIcon = array('EUR' => '€', 'GBP' => '£', 'USD' => '$');
    $bookingDataJSon = '';
    $bookingLink = '';
    $showPlot = false;
    $showGarden = false;
    $searchLink = $dir;
    if ($searchLink == '') {
        $searchLink = '/';
    }
    if (($detailROLType == 'Plot' || $detailROLType == 'Commercial') && $detailPlot != '' && $detailPlot != '0') {
        $showPlot = true;
    } else {
        if ($detailROLType == 'House' && $detailROLSubType != 'Terraced Townhouse' && $detailPlot != '' && $detailPlot != '0') {
            $showPlot = true;
        }
    }
    if (!$showPlot) {
        if ($detailROLType == 'Apartment' && $detailROLSubType == 'Ground Floor' && $detailPlot != '' && $detailPlot != '0') {
            $showGarden = true;
        } else {
            if ($detailROLType == 'House' && $detailROLSubType == 'Terraced Townhouse' && $detailPlot != '' && $detailPlot != '0') {
                $showGarden = true;
            }
        }
    }
    if (isset($_SESSION["SearchType"]) && in_array($_SESSION["SearchType"], array('RentalLT', 'RentalST')) && $showBookingCalendar) {
        $rag = createRangeDate();
        $bookingData = rentalBooking(array('start' => $rag[0][0], 'end' => $rag[sizeof($rag) - 1][1]));
        $bookingDataJSon = json_encode($bookingData);
        $bookingLink = createUrl($dir . '/', array($bookingPage), '', '') . "?P_RefId=" . getPropertyRef();
    }
    $price = '';
    switch ($_SESSION["SearchType"]) {
        case "RentalST":
            if ($detailPrice != '') {
                $price .= formatPrice($detailPrice, isset($_SESSION["currency"]) ? $currencyIcon[$_SESSION["currency"]] : '€');
            }
            if ($detailPrice2 != '' && $detailPrice2 != $detailPrice) {
                if ($price != '') {
                    $price .= ' - ';
                }
                $price .= formatPrice($detailPrice2, isset($_SESSION["currency"]) ? $currencyIcon[$_SESSION["currency"]] : '€');
            }
            if ($price != '') {
                $price .= ' /' . $languageArr['detail_Headings']['week'];
            }
            break;
        case "RentalLT":
            if ($detailPrice != '') {
                $price .= formatPrice($detailPrice, isset($_SESSION["currency"]) ? $currencyIcon[$_SESSION["currency"]] : '€');
                $price .= ' /' . $languageArr['detail_Headings']['month'];
            }
            break;
        default:
            if ($detailPrice != '') {
                $price .= formatPrice($detailPrice, isset($_SESSION["currency"]) ? $currencyIcon[$_SESSION["currency"]] : '€');
            }
    }
    $propertyDetail = TemplateHelper::render('templates/propertyDetail.html', array('Property.Price' => $price, 'Property.LocationRef' => ' - ' . $detailReference, 'Property.NewSearchUrl' => $searchLink, 'Property.NewSearchText' => $languageArr['results_Headings']['new_Search'], 'Property.LastResult.Link' => $_SERVER['HTTP_REFERER'], 'Property.LastResult.Text' => $languageArr['detail_Headings']['last_Result'], 'Property.HeaderText' => $detailHeaderText, 'Property.PhotoText' => $languageArr['detail_Headings']['photos'], 'Property.Map.Title' => $languageArr['detail_Headings']['map'], 'Property.DetailImages' => $detailImage1, 'Property.PhotoList' => $photoArray, 'Property.DetailLocation' => $detailLocation, 'Property.StartRentalDate' => isset($_SESSION["startRentalDate"]) ? $_SESSION["startRentalDate"] : '', 'Property.EndRentalDate' => isset($_SESSION["endRentalDate"]) ? $_SESSION["endRentalDate"] : '', 'Property.LanguageCode' => $datePickerLanguages[$language], 'Property.Booking.Data' => $bookingDataJSon, 'Property.Booking.Url' => $bookingLink, 'Property.Booking.TextHover' => $languageArr['detail_Headings']['not_Available'], 'Property.Booking.LinkText' => $languageArr['detail_Headings']['calendar'], 'Property.Description' => preg_replace("/\r\n|\r|\n/", '<br />', $detailDescription), 'Property.DetailText' => $languageArr['detail_Headings']['property_Details'], 'Property.DetailBed' => $languageArr['field_Headings']['bedrooms']['header'] . ": " . $detailBeds, 'Property.DetailBath' => $languageArr['field_Headings']['bathrooms']['header'] . ": " . $detailBaths, 'Property.DetailPlot' => $languageArr['field_Headings']['plot_Size'] . ": " . formatArea($detailPlot, "m&sup2;"), 'Property.DetailBuild' => $languageArr['field_Headings']['built_Size'] . ": " . formatArea($builds, "m&sup2;"), 'Property.DetailTerrace' => $languageArr['field_Headings']['terrace_Size'] . ": " . formatArea($detailTerrace, "m&sup2;"), 'Property.DetailGarden' => $languageArr['field_Headings']['garden'] . ": " . formatArea($detailPlot, "m&sup2;"), 'Property.DetailEnergy' => $languageArr['field_Headings']['energyRating']['header'] . ": " . $detailEnergy, 'Property.Features' => $featuresArray), array('showLastResultLink' => !isFeatureSearch(), 'showMap' => $showMap, 'showBookingCalendar' => isset($_SESSION["SearchType"]) && in_array($_SESSION["SearchType"], array('RentalLT', 'RentalST')) && $showBookingCalendar, 'showPlot' => $showPlot, 'showBuild' => $builds != '', 'showTerrace' => $detailTerrace != '' && $detailTerrace != '0', 'showGarden' => $showGarden, 'showEnergy' => $detailEnergy != ''));
    return $propertyDetail;
}