";
$set_clogo = 0; // switch for displaying company logo on tours page
// if company logo exists then get it for viewing on page
if ($clogo)
{
//get the realtors correct company logo
list($listings_id, $listings_email)=sql_fetch_row(sql_query("SELECT id, email FROM vpt_listings WHERE ID=".$tid));
if ($listings_email)
{
if (strpos($listings_email, ";") !== false)
{
$sql2 == null;
$res_email = explode(";", $listings_email);
foreach ($res_email as $ekey => $eval)
{
if ($ekey > 0)
{
$sql2 .= " or ";
}
$res_addy = strtolower(trim($eval));
$sql2 .= " u_email='" . $res_addy . "'";
}
} // end: if
else
{
$sql2 = " u_email='" . $listings_email . "'";
}
} // end: if
// list($users_id, $clogo)= sql_fetch_row(sql_query("SELECT id, c_logo FROM vpt_users WHERE u_email='" . $listings_email . "'"));
$sql = "SELECT id,
c_logo
FROM vpt_users
WHERE " . $sql2;
list($users_id, $clogo)= sql_fetch_row(sql_query($sql));
if ($clogo)
{
$set_clogo = 1; // switch for displaying company logo on tours page
}
} // end: if
if ($xuID != '' && $xuID != '0')
{
$agentinfo.="
";
/**
* START Agent Image Hack
* When a user is first created the old method of the image name was simply the username (firstLast) as is.
* No stripping of spaces was being done so the images had spaces in the names. The addagent page and the tours page
* used different methods for the images.
*
* This attempts to catch the existing (currently only 2) types of images (with/without spaces) to display
* the agents image.
**/
// new method is to strip out spaces in the users name
$realtor_name = preg_replace('/ +/', '', trim($firstname));
// create the image path
$filename = $_SERVER['DOCUMENT_ROOT'] . "/images/realtors/" . $realtor_name . ".jpg";
/**
* If the image exists (stripped spaces) we skip this 'if' statement because the realtor_name has already been set above.
* If the image does not exist we use the old method which simply combines the first 2 array elements.
**/
if (file_exists($filename) == false)
{
// method to get realtor image
$realtor_name = explode(" ", strtolower(trim($firstname)));
$realtor_name = $realtor_name[0] . $realtor_name[1];
}
// END Agent Image Hack
$agentinfo_img.="
";
$agentinfo.="
".$firstname." ".$lastname."
";
$agentinfo.="
";
/**
* gets realtor company logo.
* This is now separated from $agentinfo so it can be placed on the page anywhere
**/
if ($clogo)
{
$sql = "SELECT name, image FROM vpt_realestatecompanies WHERE id=".$clogo;
list($cname, $clogos)=sql_fetch_row(sql_query($sql));
}
if ($phone)
{
$agentinfo.="ph: ".$phone."
";
}
if ($fax)
{
$agentinfo.="fax: ".$fax."
";
}
if ($quote)
{
$agentinfo.="qoute: ".$quote."
";
}
if ($website)
{
$agentinfo.="
Visit Website
";
}
if ($email)
{
$agentinfo.="
Email Me";
} // end: if
} // end: if ($xuID != '' && $xuID != '0')
$agentinfo.="
";
//////////////////////////////////
//fetch tour listings and set tourhtml code
if ($id)
{
$sql = "SELECT ext FROM vpt_tours WHERE id=".$id;
list($ext)=sql_fetch_row(sql_query($sql));
$t=$media_t[$ext];
}
if ($t)
{
$mediasql=join(" OR ", $media_types[$t]);
$sql="SELECT id, room, ext FROM vpt_tours WHERE tid=".$tid." AND (".$mediasql.") ORDER BY rid";
$res=sql_query($sql);
}
$count=0;
$first=0;
$listing_to_show=array();
while ($r=sql_fetch_row($res))
{
$listing_to_show[] = $r;
list($xid, $room, $ext) = $r;
if (!$first && !$id)
{
$id=$xid;
$first=1;
}
$css="";
if ($xid==$id)
{
$xext=$ext;
$css="background-color: #000000";
}
$listing.="