예제 #1
0
파일: ajax.php 프로젝트: alex731/m12private
function getCommercialListByCity($param)
{
    global $config;
    $id = intval($param['id']);
    if (isset($_SESSION['user_id']) && in_array($_SESSION['user_id'], $config['user_workers'])) {
        $is_editor = true;
        $h = '<th></th>';
    } else {
        $is_editor = false;
        $h = '';
    }
    if (!$is_editor) {
        $limit = 5;
    } else {
        $limit = 30;
    }
    $html = '
	История продаж в этом населенном пункте:<br><br>
	<table class="table table-striped table-bordered table-condensed"><thead>
	<tr>
	<th>Дата</th><th>Цена (руб.)</th><th>Тип</th><th>Общ. пл.м<sup>2</sup></th><th>Описание</th><th>Сделка</th>' . $h . '
	</tr></thead>';
    $db_res = Commercial::getFullListLink("f.city_id={$id} AND (f.status=" . REALTY_STATUS_SALE . " OR f.status=" . REALTY_STATUS_RENT . ") GROUP BY f.id ORDER BY updated_on DESC LIMIT {$limit}");
    while ($row = $db_res->fetchRow()) {
        $html .= '<tr>';
        $date = formatDate($row['updated_on']);
        $t = $is_editor ? '<td><a href="/commercial.html?action=updateDate&id=' . $row['id'] . '" title="Обновить дату"><img src="/images/icon_update.png"></a></td>' : '';
        $price = number_format($row['price'], 0);
        $description = textReduce($row['description']);
        $type = Commercial::$TYPE[$row['type_id']];
        $type_sale = $row['status'] == REALTY_STATUS_SALE ? 'продажа' : 'аренда';
        $html .= "<td><a href='/commercial.html?action=view&id={$row['id']}' title='смотреть'>{$date}</a></td><td>{$price}</td><td>{$type}</td><td>{$row['total_area']}</td><td>{$description}</td><td>{$type_sale}</td>{$t}";
        $html .= '</tr>';
    }
    $html .= '</table>';
    if (isset($date)) {
        echo $html;
    } else {
        echo '';
    }
}
예제 #2
0
 public static function getAdminCommercialList($action, $per_page = 10, $current_page = 1)
 {
     if ($action == 'newSales') {
         $where = "f.status='" . REALTY_STATUS_APPLY . "'";
     } else {
         if ($action == 'newRent') {
             $where = "f.status='" . REALTY_STATUS_RENT_APPLY . "'";
         }
     }
     $start_pos = ($current_page - 1) * $per_page;
     $limit = " LIMIT {$start_pos},{$per_page}";
     $amount = Commercial::getAmountInList($where);
     $order = " ORDER BY id DESC";
     $db_res = Commercial::getFullListLink($where . ' GROUP BY f.id ' . $order . $limit);
     $paginator = self::paginator("commercial.php?action={$action}", $amount, $per_page, $current_page);
     $html = "\n\t\t<div>{$paginator}</div>\n\t\t<div><a href='commercial.html?action=activateAll'>Активировать все</a></div>\t\n\t\t<table class='base_text'>\n\t\t<thead>\n\t\t<tr>\n\t\t <th>Адрес</th>\n\t\t <th>Цена</th>\t\t \n\t\t <th>Тип</th>\n\t\t <th>Карта</th>\n\t\t <th>Юзер</th>\t\t \n\t\t <th></th>\n\t\t <th></th>\n\t\t <th></th>\n\t\t <th></th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t";
     $status = $action == 'newSales' ? REALTY_STATUS_SALE : REALTY_STATUS_RENT;
     while ($row = $db_res->fetchRow()) {
         $type = Commercial::$TYPE[$row['type_id']];
         $city = $row['city_id'] == 0 ? '' : $row['city'] . ',';
         $addr = $city;
         $price = number_format($row['price'], 0);
         $map = $row['lat'] && $row['lon'] ? 'Да' : '<b>Нет</b>';
         $user = '';
         if ($row['user_name'] != '') {
             $user = $row['user_name'];
         }
         if ($row['company_name'] != '') {
             $user .= ' - ' . $row['company_name'];
         }
         $html .= "<tr>\n\t\t\t<td>{$addr}</td>\n\t\t\t<td>{$price}</td>\n\t\t\t<td>{$type}</td>\t\t\t\n\t\t\t<td>{$map}</td>\n\t\t\t<td>{$user}</td>\n\t\t\t<td><a href='/commercial.html?action=edit&id={$row['id']}' target='_blank'>Редактировать</a></td>\t\t\t\n\t\t\t<td><a href='/commercial.html?action=view&id={$row['id']}' target='_blank'>Смотреть</a></td>\n\t\t\t<td><a href='javascript:delObject({$row['id']})'>Удалить</a></td>\n\t\t\t<td><a href='/commercial.html?action=approve&id={$row['id']}&status={$status}' target='_blank'>Активировать</a></td>\n\t\t\t</tr>";
     }
     $html .= "</tbody></table>\n\t\t<script>\t\t\n\t\t\tdelObject = function(id) {\n\t\t\tif (confirm('Вы уверены удалить этот объект?')) {\n\t\t\t\tlocation.href = '/commercial.html?action=delete&id='+id;\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\t\t\t\t\n\t\t</script>";
     return $html;
 }
예제 #3
0
function map($s) {
	$s->assign("lat",LAT_YOLA);
	$s->assign("lon",LON_YOLA);
	$s->assign("YANDEX_KEY",YANDEX_KEY);
	
	$ids = '';	
	$rooms = '';
	$prices = '';
	$prices_m = '';
	$areas = '';
	$addresses = '';
	$storeys = '';
	$dates = '';
	$types = '';
	$lons = '';
	$lats = '';
	$photos = '';
	$icons = '';
	if (!isset($_REQUEST['act']) || $_REQUEST['act']=='sales') {
		$status=REALTY_STATUS_SALE;
	}
	else {
		$status=REALTY_STATUS_RENT;
	}
	$res = _filter($status);
	$add_sql = "f.updated_on>'".getNextDate(date('Y-m-d'),-30)."' AND t.status=".REALTY_STATUS_ACTIVE.' AND '.$res['sql'];
	$db_res = Commercial::getFullListLink($add_sql);
	while ($row = $db_res->fetchRow()) {
		$ids .= $row['id'].',';
		$rooms .= $row['rooms'].',';
		$prices .= "'".number_format($row['price'],0)."',";
		$prices_m .= "'".number_format($row['price_m'],0)."',";
		$areas .= "'".$row['total_area']."',";
		$addr = "{$row['street']}, {$row['tnum']}";
		$addresses .= "'".$addr."',";
		
		$date = explode(' ',$row['updated_on']);
		$ds = explode('-',$date[0]);
		$date = $ds[2].'.'.$ds[1].'.'.$ds[0];		
		$dates .= "'".$date."',";
		$storeys .= "'".$row['storey']."/".$row['storeys']."',";
		$types .= "'".Tenement::$TYPE[$row['ttype']]."',";		
		$lons .= "'".$row['lon']."',";
		$lats .= "'".$row['lat']."',";
		$photo = ($row['photo_tenement']!='') ? $row['tenement_id']."/".$row['photo_tenement']."_prev" : '';
		$photos .= "'".$photo."',";
		if ($row['price_m']<30000) {
			$color = 'a';				
		}
		else if ($row['price_m']<40000) {
			$color = 'b';				
		}
		else {
			$color = 'c';	
		}
		$ri = ($row['rooms']<4) ? $row['rooms'] : 3;
		$icons .= "'".$ri."k".$color."',";
	}
	
	$s->assign("ids",$ids);
	$s->assign("rooms",$rooms);
	$s->assign("prices",$prices);
	$s->assign("prices_m",$prices_m);
	$s->assign("areas",$areas);
	$s->assign("addresses",$addresses);
	$s->assign("storeys",$storeys);
	$s->assign("dates",$dates);
	$s->assign("types",$types);
	$s->assign("lons",$lons);
	$s->assign("lats",$lats);
	$s->assign("photos",$photos);
	$s->assign("icons",$icons);
		
	$block_html = Html::getBlock('Квартиры на продажу на карте Йошкар-Олы',Html::pageCommercialMap());
	$s->assign("block_html",$block_html);
	$s->display("commercial_map.tpl");
}