Пример #1
0
function tzs_search_pr_parameters_to_str($p)
{
    $sql = '';
    if (isset($p['country_from']) || isset($p['region_from']) || isset($p['cityname_from'])) {
        if (strlen($sql) > 0) {
            $sql .= ' ';
        }
        //$sql .= 'местонахождение:';
        if (isset($p['country_from'])) {
            $sql .= ' ' . tzs_get_country($p['country_from']);
        }
        if (isset($p['region_from'])) {
            $sql .= ' ' . tzs_get_region($p['region_from']);
        }
        if (isset($p['cityname_from'])) {
            $name = $p['cityname_from'];
            $sql .= " {$name}";
        }
    }
    if (isset($p['type_id']) && $p['type_id'] > 0) {
        if (!isset($p['cur_type_id']) || $p['cur_type_id'] < 1 || $p['cur_type_id'] !== $p['type_id']) {
            if (strlen($sql) > 0) {
                $sql .= ' * ';
            }
            $sql .= get_the_title($p['type_id']);
        }
    }
    if (isset($p['pr_title'])) {
        if (strlen($sql) > 0) {
            $sql .= ' * ';
        }
        $name = $p['pr_title'];
        $sql .= "описание содержит '{$name}'";
    }
    if (isset($p['data_from_str']) || isset($p['data_to_str'])) {
        if (strlen($sql) > 0) {
            $sql .= ' * ';
        }
        $sql .= 'добавлены ';
        if (isset($p['data_from_str'])) {
            $sql .= ' с ' . $p['data_from_str'];
        }
        if (isset($p['data_to_str'])) {
            $sql .= ' по ' . $p['data_to_str'];
        }
    }
    if (isset($p['price_from']) || isset($p['price_to'])) {
        if (strlen($sql) > 0) {
            $sql .= ' * ';
        }
        $sql .= 'стоимость ';
        if (isset($p['price_from'])) {
            $sql .= ' от ' . $p['price_from'];
        }
        if (isset($p['price_to'])) {
            $sql .= ' до ' . $p['price_to'];
        }
    }
    if (isset($p['auction_type']) && $p['auction_type'] > 0) {
        if (strlen($sql) > 0) {
            $sql .= ' * ';
        }
        $sql .= 'тип тендера: ';
        if ($p['auction_type'] == 1) {
            $sql .= 'продажа';
        } else {
            $sql .= 'покупка';
        }
    }
    if (isset($p['rate_from']) || isset($p['rate_to'])) {
        if (strlen($sql) > 0) {
            $sql .= ' * ';
        }
        $sql .= 'ставки ';
        if (isset($p['rate_from'])) {
            $sql .= ' от ' . $p['rate_from'];
        }
        if (isset($p['rate_to'])) {
            $sql .= ' до ' . $p['rate_to'];
        }
    }
    return $sql;
}
Пример #2
0
function tzs_city_to_str($country_id, $region_id, $city_id, $def, $title = '')
{
    $def = htmlspecialchars($def);
    if ($city_id != NULL && $city_id > 0) {
        return '<span title="' . ($title !== '' ? $title : $def) . '"><strong>' . htmlspecialchars(tzs_get_city($city_id)) . '</strong>' . ($region_id != NULL && $region_id > 0 && $region_id != 20070188 ? '<br>' . htmlspecialchars(tzs_get_region($region_id)) : '') . ($country_id != 23424976 ? ' (' . htmlspecialchars(tzs_get_country_code($country_id)) . ')' : '') . '</span>';
    } elseif ($region_id != NULL && $region_id > 0) {
        return "<span title=\"{$def}\">" . htmlspecialchars(tzs_get_region($region_id)) . " (" . htmlspecialchars(tzs_get_country_code($country_id)) . ")</span>";
    } elseif ($country_id != NULL && $country_id > 0) {
        return "<span title=\"{$def}\">" . htmlspecialchars(tzs_get_country($country_id)) . "</span>";
    } else {
        return "<span>" . $def . "</span>";
    }
}
Пример #3
0
function tzs_search_parameters_to_str($p)
{
    $sql = '';
    if (isset($p['country_from']) || isset($p['region_from']) || isset($p['cargo_cityname_from'])) {
        if (strlen($sql) > 0) {
            $sql .= ' ';
        }
        $sql .= 'из';
        if (isset($p['country_from'])) {
            $sql .= ' ' . tzs_get_country($p['country_from']);
        }
        if (isset($p['region_from'])) {
            $sql .= ' ' . tzs_get_region($p['region_from']);
        }
        if (isset($p['cargo_cityname_from'])) {
            $name = $p['cargo_cityname_from'];
            $sql .= " {$name}";
        }
        if (isset($p['cargo_city_from_radius_ids'])) {
            $sql .= " (погрузка в радиусе " . $p['cargo_city_from_radius_value'] . " км)";
        }
    }
    if (isset($p['country_to']) || isset($p['region_to']) || isset($p['cargo_cityname_to'])) {
        if (strlen($sql) > 0) {
            $sql .= ' ';
        }
        $sql .= 'в';
        if (isset($p['country_to'])) {
            $sql .= ' ' . tzs_get_country($p['country_to']);
        }
        if (isset($p['region_to'])) {
            $sql .= ' ' . tzs_get_region($p['region_to']);
        }
        if (isset($p['cargo_cityname_to'])) {
            $name = $p['cargo_cityname_to'];
            $sql .= " {$name}";
        }
    }
    if (isset($p['data_from_str']) || isset($p['data_to_str'])) {
        if (strlen($sql) > 0) {
            $sql .= ', ';
        }
        $sql .= 'погрузка';
        if (isset($p['data_from_str'])) {
            $sql .= ' с ' . $p['data_from_str'];
        }
        if (isset($p['data_to_str'])) {
            $sql .= ' по ' . $p['data_to_str'];
        }
    }
    if (isset($p['weight_from']) || isset($p['weight_to'])) {
        if (strlen($sql) > 0) {
            $sql .= ', ';
        }
        $sql .= 'масса';
        if (isset($p['weight_from'])) {
            $sql .= ' от ' . $p['weight_from'] . 'т';
        }
        if (isset($p['weight_to'])) {
            $sql .= ' до ' . $p['weight_to'] . 'т';
        }
    }
    if (isset($p['volume_from']) || isset($p['volume_to'])) {
        if (strlen($sql) > 0) {
            $sql .= ', ';
        }
        $sql .= 'объем';
        if (isset($p['volume_from'])) {
            $sql .= ' от ' . $p['volume_from'] . 'м³';
        }
        if (isset($p['volume_to'])) {
            $sql .= ' до ' . $p['volume_to'] . 'м³';
        }
    }
    if (isset($p['trans_type'])) {
        $type = isset($GLOBALS['tzs_tr_types'][$p['trans_type']]) ? $GLOBALS['tzs_tr_types'][$p['trans_type']] : "?";
        if (strlen($sql) > 0) {
            $sql .= ', ';
        }
        $sql .= "тип транспорта: {$type}";
    }
    if (isset($p['sh_type'])) {
        $type = isset($GLOBALS['tzs_sh_types'][$p['sh_type']]) ? $GLOBALS['tzs_sh_types'][$p['sh_type']] : "?";
        if (strlen($sql) > 0) {
            $sql .= ', ';
        }
        $sql .= "тип груза: {$type}";
    }
    return $sql;
}