get($_SESSION['id']);
if ($obj['operation_type'] == 1) {
$dealType = 'SELL';
$sqlPriceTypePart = "1";
} else {
$dealType = 'RENT';
$priceType = 'MONTH';
if ($obj['srok'] == 1) {
$priceType = 'DAY';
}
$sqlPriceTypePart = " advertising_package_price_type_id in (SELECT id FROM advertising_package_price_type where code = '$priceType') ";
}
$hasPhotos = 0;
$isRoom = 0;
$sqlPhotoInfo = "SELECT id FROM objects_object_photo oop WHERE oop.object_id = $obj[id] LIMIT 1";
$rezPhotoInfo = mysql_query($sqlPhotoInfo);
if (mysql_num_rows($rezPhotoInfo) > 0) {
$hasPhotos = 1;
}
$objectType = 'FLAT';
switch ($obj['type']) {
case 1:
$objectType = 'FLAT';
break;
case 2:
$objectType = 'FLAT';
$isRoom = 1;
break;
case 3:
$objectType = 'HOUSE';
break;
case 4:
case 6:
if ($obj['type_category']) {
if ($obj['type_category'] == 1) {
$objectType = 'BUSINESS';
}
if ($obj['type_category'] == 2) {
$objectType = 'WAREHOUSE';
}
if ($obj['type_category'] >= 3) {
$objectType = 'BUSINESS';
}
} else {
$objectType = 'BUSINESS';
}
break;
case 5:
$objectType = 'HOUSE';
break;
case 7:
$objectType = 'LAND';
break;
}
if($obj['id_rf_region']){
$region = $obj['id_rf_region'];
}else{
$region = 78;
}
$sqlPackageList = "SELECT * FROM advertising_package WHERE is_room=$isRoom AND has_photo = $hasPhotos AND
advertising_package_deal_type_id in (SELECT id FROM advertising_package_deal_type where code = '$dealType') AND
advertising_package_object_type_id in (SELECT id FROM advertising_package_object_type where code = '$objectType') AND
$sqlPriceTypePart AND deleted = 0 and agency_id = $curUser->agencyId and (region_rf_id = $region or region_rf_id in (select parent from rf_regions where id = $region))";
if ($_SESSION['id'] == 93) {
echo $sqlPackageList;
echo '
';
}
$rezPackageList = mysql_query($sqlPackageList);
$num = 1;
if (mysql_num_rows($rezPackageList) > 0) {
echo '
| ';
echo $package['name'];
echo ' '; echo '(' . declOfNum($package['days_count'], array('%d день', '%d дня', '%d дней')) . ')'; echo ' | ';
echo ''; $sqlDestinations = "select * from advertising_package_destinations where advertising_package_id = $package[id] and deleted = 0"; $rezDestinations = mysql_query($sqlDestinations); while ($dest = mysql_fetch_assoc($rezDestinations)) { $targetName = $ZIPAL_TARGETS[$dest['destination']]; if (!$targetName) { $targetName = $dest['destination']; } echo $targetName . '; '; } echo ' | '; echo '';
echo ' ';
echo $daysResult['html'];
echo ' ';
echo ' | ';
echo '';
$errStyle = '';
$errTitle = '';
if ($publishObj != null && $publishObj['error_text']) {
$errStyle = 'border: 1px solid red;';
$errTitle = htmlentities($publishObj['error_text']);
}
?>
|