public static function getAdminLandList($action, $per_page = 10, $current_page = 1) { if ($action == 'listActive') { $where = "f.status='" . REALTY_STATUS_ACTIVE . "' GROUP BY f.id"; } else { if ($action == 'listNew') { $where = "f.status='" . REALTY_STATUS_APPLY . "' GROUP BY f.id"; } } $start_pos = ($current_page - 1) * $per_page; $limit = " LIMIT {$start_pos},{$per_page}"; $amount = Land::getAmountInList($where); $order = " ORDER BY id DESC"; $db_res = Land::getFullListLink($where . $order . $limit); $paginator = self::paginator("land.php?action={$action}", $amount, $per_page, $current_page); $html = "\n\t\t<div><a href='land.html?action=activateAll'>Активировать все</a></div>\n\t\t<div>{$paginator}</div>\t\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>\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"; while ($row = $db_res->fetchRow()) { $city = $row['city_id'] == 0 ? '' : $row['city']; $addr = $city; $price = number_format($row['price'], 0); $map = $row['lat'] && $row['lon'] ? 'Да' : '<b>Нет</b>'; $html .= "<tr>\n\t\t\t<td>{$addr}</td>\n\t\t\t<td>{$price}</td>\t\t\t\n\t\t\t<td>{$row['description']}</td>\n\t\t\t<td>{$map}</td>\n\t\t\t<td><a href='/land.html?action=edit&id={$row['id']}' target='_blank'>Редактировать</a></td>\t\t\t\n\t\t\t<td><a href='/land.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='/land.html?action=approve&id={$row['id']}' 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 = '/land.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; }
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 = Land::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::pagelandMap()); $s->assign("block_html",$block_html); $s->display("land_map.tpl"); }
function getLandListByCity($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 = 3; } else { $limit = 30; } $html = ' История продаж в этом населенном пункте:<br><br> <table class="table table-striped table-bordered table-condensed"><thead> <tr> <th>Дата</th><th>Цена (руб.)</th></th><th>Площадь (соток)</th><th>Описание</th>' . $h . ' </tr></thead>'; $db_res = Land::getFullListLink("f.city_id={$id} AND f.status=" . REALTY_STATUS_SALE . " 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="/land.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']); $html .= "<td><a href='/land.html?action=view&id={$row['id']}' title='смотреть'>{$date}</a></td><td>{$price}</td><td>{$row['area']}</td><td>{$description}</td>{$t}"; $html .= '</tr>'; } $html .= '</table>'; if (isset($date)) { echo $html; } else { echo ''; } }