set_include_path("lib");
require_once("config.php");
require_once("BaseVO.php");
require_once("BaseDAO.php");
require_once("AdvertisersVO.php");
require_once("AdvertisersDAO.php");
require_once("PropertyMultiplexor.php");
require_once("PropertiesVO.php");
require_once("PropertiesDAO.php");
require_once("PhotosVO.php");
require_once("PhotosDAO.php");
session_start();
//var_dump($_SESSION);
// check to see if the advertiser is already logged in
if(strval($_SESSION['advertiser_logged_in']) != "Y") {
header("Location: /alogin");
exit;
}
// DEVELOPMENT CODE (CAN PROB BE REMOVED FOR LIVE INSTALL
// check to see if the advertiser record has been removed (whilst purging development database)
$advertisersDAO = new AdvertisersDAO();
$advertisersVO = $advertisersDAO->findByPK($_SESSION['advertiser_idAdvertisers']);
if(!$advertisersVO) {
header("Location: /alogout");
exit;
}
// create a new Photos Data Access Object instance
$photosDAO = new PhotosDAO();
// get a list of the properties that this person controls
$propertiesDAO = new PropertiesDAO();
$propertiesList = $propertiesDAO->findWhere("idAdvertisers = '" . $_SESSION['advertiser_idAdvertisers'] . "'", "idProperties DESC");
$CSS_PAGES = " \n";
$CSS_PAGES .= " ";
include_once "header_open.php";
?>
Advertiser Account Management
=$_SESSION['advertiser_firstname']?>, welcome to the account management control panel. Within the control panel you can add, edit property details including uploading photographs
If this is your first visit, we suggest you begin by clicking "Add a new property" from the form below.
Ref
Property name
Location
Renewal date
Display Status
Advert Status
Details
Photos
Avail
Rates
// for each of the account holders properties
for($i=0; $i < sizeof($propertiesList); $i++) {
$record = $propertiesList[$i];
$line_style['ref'] = "tbd" . strval($i % 2);
$line_style['property_name'] = $line_style['ref'];
$line_style['location'] = $line_style['ref'];
$line_style['renewal_date'] = $line_style['ref'];
$line_style['advert_status'] = $line_style['ref'];
$line_style['details'] = $line_style['ref'];
$line_style['photos'] = $line_style['ref'];
$line_style['avail'] = $line_style['ref'];
$line_style['rates'] = $line_style['ref'];
$line_style['immediate_attention'] = "tbd_attention";
$change_property_url = "/advertiser_changepropertyname.php";
$change_property_url .= "?idProperties=" . $record->getPK();
$change_property_url .= "&mac=" . md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
$short_name = htmlentities(utf8_decode($record->getShortName()));
$location_url = showLocationUrl($record->getLocationUrl());
// LOCATION
if(strval($record->getLocationUrl()) == 'default/default/default') {
// if its awaiting approval, then its with the moderator
$line_style['location'] = "tbd_moderator";
} else {
// use the default
$line_style['location'] = $line_style['ref'];
}
// RENEWAL DATE
if((strval($record->getExpiry()) == '') || (strval($record->getExpiry()) == '0000-00-00') || (strval($record->getExpiry()) == 'NULL')){
// if its awaiting to be set, then its with the moderator
$line_style['renewal_date'] = "tbd_moderator";
} else {
// use the default
$line_style['renewal_date'] = $line_style['ref'];
}
// DISPLAY STATUS
if($record->getVisible() == 0) {
// if this property is invisible grey it out
$line_style['ref'] = "tbd_unavailable";
$line_style['property_name'] = "tbd_unavailable";
$line_style['display_status'] = "tbd_unavailable";
$line_style['details'] = "tbd_unavailable";
$line_style['photos'] = "tbd_unavailable";
$line_style['avail'] = "tbd_unavailable";
$line_style['rates'] = "tbd_unavailable";
} else {
// use the default
$line_style['display_status'] = $line_style['ref'];
}
// ADVERT STATUS
if($record->getAwaitingApproval()) {
if($record->getApproved()) {
// awaiting update
$line_style['advert_status'] = "tbd_moderator";
} else {
// awaiting intial approval
$line_style['advert_status'] = "tbd_moderator";
}
} else {
if($record->getApproved()) {
if($record->getChangesMade()) {
$line_style['advert_status'] = "tbd_attention";
$advert_status_url = "/advertiser_sendforapproval.php?idProperties=" . $record->getPK() . "&mac=";
$advert_status_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
$details_url = "/advertiser_property.php?idProperties=" . $record->getPK() . "&mac=";
$details_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
} else {
$line_style['advert_status'] = "tbd_okay";
$details_url = "/advertiser_property.php?idProperties=" . $record->getPK() . "&mac=";
$details_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
}
} else {
// if it has no bedrooms, then they haven't yet completed the initial details form
if(intval($record->getNumBeds()) == 0) {
$line_style['advert_status'] = "tbd_attention";
$details_url = "/advertiser_property.php?idProperties=" . $record->getPK() . "&mac=";
$details_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
} else {
// send for initial approval
$line_style['advert_status'] = "tbd_attention";
$advert_status_url = "/advertiser_sendforapproval.php?idProperties=" . $record->getPK() . "&mac=";
$advert_status_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
$details_url = "/advertiser_property.php?idProperties=" . $record->getPK() . "&mac=";
$details_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
}
}
}
// image, availability and rates URLs
$manage_images_url = "/maxresources/advertiser_manageimages.php?idProperties=" . $record->getPK() . "&mac=";
$manage_images_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
$availability_url = "/advertiser_availability.php?idProperties=" . $record->getPK() . "&mac=";
$availability_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
$rates_url = "/advertiser_rates.php?idProperties=" . $record->getPK() . "&mac=";
$rates_url .= md5(strval($record->getPK()) . strval($_SESSION['advertiser_mac']));
?>
=$record->getPK()?>
if($record->getApproved() == 1) {
?>[view]
} else {
?>[preview]
}
?> echo $short_name?>[change]
echo $location_url?>
=showRenewalDate($record->getExpiry())?>
=(($record->getVisible() == 0) ? "Hidden" : "Visible")?>
if($record->getAwaitingApproval()) {
if($record->getApproved()) {
?>Awaiting update
-
} else {
?>Awaiting intial approval
-
}
} else {
if($record->getApproved()) {
if($record->getChangesMade()) {
?>[send changes for approval]
[details]
} else {
?>Approved
[details]
}
} else {
// if it has no bedrooms, then they haven't yet completed the initial details form
if(intval($record->getNumBeds()) == 0) {
?>add your details
[details]
} else {
?>[send for initial approval]
[details]
}
}
}
?>[photos]
[avail]
[rates]
}
?>
include_once "footer.html";
exit;
function propertyStatus($initialApproval, $update_approval) {
if($initialApproval == 0) {
return "Awaiting initial approval from moderator";
} else {
if($update_approval == 0) {
return "Approved";
} else {
return "Awaiting update";
}
}
} // end function propertyStatus
function showLocationUrl($url) {
if(strval($url) == 'default/default/default') {
return "Awaiting allocation";
} else {
list($country,$region,$destination) = split('/', $url);
return htmlentities($country)." ".htmlentities($region)." ".htmlentities($destination);
}
}
function showRenewalDate($d) {
// database dates are stored as yyyy-mm-dd
if((strval($d) == '') || (strval($d) == '0000-00-00') || (strval($d) == 'NULL')){
return "Awaiting";
} else {
return strftime("%d-%b-%y", strtotime($d));
}
}