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; }