Esempio n. 1
0
 public static function getAdminHouseList($action, $per_page = 10, $current_page = 1)
 {
     if ($action == 'listActive') {
         $where = "f.status='" . REALTY_STATUS_ACTIVE . "'";
     } else {
         if ($action == 'listNew') {
             $where = "f.status='" . REALTY_STATUS_APPLY . "'";
         }
     }
     $start_pos = ($current_page - 1) * $per_page;
     $limit = " LIMIT {$start_pos},{$per_page}";
     $amount = House::getAmountInList($where);
     $order = " ORDER BY id DESC";
     $db_res = House::getFullListLink($where . $order . $limit);
     $paginator = self::paginator("house.php?action={$action}", $amount, $per_page, $current_page);
     $html = "\n\t\t<div>{$paginator}</div>\n\t\t<div><a href='house.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>\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()) {
         $type = House::$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>\n\t\t\t<td>{$row['storeys']}</td>\n\t\t\t<td>{$map}</td>\n\t\t\t<td>{$user}</td>\n\t\t\t<td><a href='/house.html?action=edit&id={$row['id']}' target='_blank'>Редактировать</a></td>\t\t\t\n\t\t\t<td><a href='/house.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='/house.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 = '/house.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;
 }
Esempio n. 2
0
function getHouseListByCity($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>Общ. пл.м<sup>2</sup></th><th>Участок (соток)</th><th>Описание</th>' . $h . '
	</tr></thead>';
    $db_res = House::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="/house.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='/house.html?action=view&id={$row['id']}' title='смотреть'>{$date}</a></td><td>{$price}</td><td>{$row['total_area']}</td><td>{$row['land_area']}</td><td>{$description}</td>{$t}";
        $html .= '</tr>';
    }
    $html .= '</table>';
    if (isset($date)) {
        echo $html;
    } else {
        echo '';
    }
}