<%@language=perlscript%> <% use strict; use vars qw($Request $Response $Session $Server); use lib ($Server->MapPath('/') . '/../../modules/'); use Alchemy::DB; use Alchemy::Win32::ASP; use FamilyHomes::Configuration; use FamilyHomes::Presentation; use NZSki::PropertyListing::Extract; my $db = Alchemy::DB::dbOpenDatabase(FamilyHomes::Configuration::GetOpenDatabaseArgs()); my $error = undef; # Determines how many listings to display on the page my $NumberListings = 10; # Processing my $raListings = []; if ($db) { my $where = "tblProperty.CompanyKey = ".FamilyHomes::Configuration::GetCompanyCode(); my $order = "tblProperty.PK DESC"; if (NZSki::PropertyListing::Extract::getListings('db'=>$db, 'listings'=>$raListings, 'whereClause'=>$where, 'orderClause'=>$order)) { # Processing successful } else { $error = NZSki::PropertyListing::Extract::getListingError(); } Alchemy::DB::dbCloseDatabase($db); } else { $error = "The database could not be contacted at this time"; } # Output the page %>

HOMES FOR SALE

<% if ($error) { FamilyHomes::Presentation::OutputError($error); } else { outputBody(); outputProperties($raListings, $NumberListings, AspGetParam($Request, 'start')); } %>

<% sub outputBody { %>

To Search for a family home that meets your requirements:

  1. If you know the ID#, enter it here and click , or
  2. Search through the thumbnail photos below to select properties of interest, then click on the in the left hand column for full details on the property.
<% } sub outputProperties { my ($raListings, $NumberListings, $startingIndex) = @_; my $pageNumber = 1; if ($startingIndex) { $pageNumber = int($startingIndex/$NumberListings) + 1; } my $pageTotal = int(scalar(@$raListings)/$NumberListings) + 1; %> <% if ($startingIndex - $NumberListings >= 0) { %> <% } if (scalar(@$raListings) > $startingIndex + $NumberListings) { %> <% } %>
Page <%=$pageNumber%> of <%=$pageTotal%>
<% $startingIndex = 0 if (! $startingIndex); for (my $i = $startingIndex; $i < $startingIndex + $NumberListings; $i++) { my $rhListing = $$raListings[$i]; if (defined($rhListing)) { %> <% } } %>
ID# Photo Comments Beds Bath- rooms Approx Land Area Price

<%=$rhListing->{'PK'}%>

<% #if ($rhListing->{'Image1Path'} && # -e $Server->MapPath("/")."\\propertylistings\\images\\".$rhListing->{'Image1Path'}) #{ # my $imagePath = FamilyHomes::Configuration::GetPropertyImagePath().$rhListing->{'Image'.$i.'Path'}; # FIX - temporary while backend is still done via www.snow.co.nz, as images are put into familyhomes client directory #if ($rhListing->{'Image1Path'} && # -e $Server->MapPath("/")."\\..\\..\\snow\\test\\wwwroot\\clients\\familyhomes\\".FamilyHomes::Configuration::GetPropertyImagePath().$rhListing->{'Image1Path'}) #{ if ($rhListing->{'Image1Path'}) { my $imagePath = "http://www.snow.co.nz/clients/familyhomes/".FamilyHomes::Configuration::GetPropertyImagePath().$rhListing->{'Image1Path'}; %> <% if ($rhListing->{'Image1Caption'}) { %>
<%=$rhListing->{'Image1Caption'}%> <% } } else { %>   <% } %>
<%=$rhListing->{'Heading'}%>
<%=$rhListing->{'ShortListingLeader'}%>
<%=($rhListing->{'NumBedrooms'} ? $rhListing->{'NumBedrooms'} : " ")%> <%=($rhListing->{'NumToilets'} ? $rhListing->{'NumToilets'} : " ")%> <%=($rhListing->{'SectionSize'} ? $rhListing->{'SectionSize'} : " ")%> <%=($rhListing->{'ListPrice'} ? sprintf("\$%.0f", $rhListing->{'ListPrice'}) : " ")%>
Previous Page Next Page
<% } %>