Joywork/find-objects.php

342 lines
12 KiB
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
$get=clearInputData($_GET);
if($_GET['ok_auth']) {
$user = new User;
$msg = $user->auth($get);
}
if (isset($_GET['ads_source']) && $_GET['ads_source'] != 0) {
$ads_sourceSelected = array();
foreach ($_GET['ads_source'] as $v) {
$ads_sourceSelected[$v] = 1;
}
}
if($get['msg']) $msg = $get['msg'];
if($_POST['ok_auth2'])
{
$post=clearInputData($_POST);
$user = new User;
$msg2 = $user->check_sms($post);
}
if($_POST['ok_auth3'])
{
$post=clearInputData($_POST);
$user = new User;
$msg2 = $user->check_sms($post,1);
}
require($_SERVER['DOCUMENT_ROOT']."/templates/new-header.php");
?>
<script>
window.authUser = <?php echo json_encode([ 'id' => $user->id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'middle_name' => $user->middle_name, 'email' => $user->email ])?>;
</script>
<script>
$(document).ready(function(){
<?php if($_GET['operation_type'] == 1){ echo "$('.srok-block').hide();"; } ?>
$('.operation_type [for="field_op0"]').bind('click', function(){
$('.srok-block').show();
});
$('.operation_type [for="field_op1"]').bind('click', function(){
$('.srok-block').hide();
});
});
</script>
<div class="content-right">
<div class="inner">
<?php
if($_SESSION['id'])
{
$user = new User;
$user->get($_SESSION['id']);
if (!isset($_SESSION['notes_bd_usl'])) {
$agencyId = User::getAgencyIdForUser($_SESSION['id']);
$usersIds = User::getAllAgencyUsers($agencyId);
$usersIds[] = $_SESSION['id'];
$usersIds = array_unique($usersIds);
$_SESSION['notes_bd_usl'] = "created_by IN (" . implode(",", $usersIds) . ")";
}
?>
<div class="main-title">
<h1>Поиск объектов</h1>
</div>
<?php
// $sqlForAd = "SELECT id FROM `users` WHERE id = 4 or id = 93 or id = 117 or id = 3455 or id in (SELECT id FROM `users` WHERE newbuildings_access = 1) or id_manager in (SELECT id FROM `users` WHERE newbuildings_access = 1) or id_manager in (select id from users where id_manager in (SELECT id FROM `users` WHERE newbuildings_access = 1)) or id_manager in (select id from users where id_manager in (select id from users where id_manager in (SELECT id FROM `users` WHERE newbuildings_access = 1)))";
// $rezForAd = mysql_query($sqlForAd);
// $sqlForNeedNb = "SELECT id FROM `users` WHERE id = 920 or id_manager = 920 or id_manager in (select id from users where id_manager = 290)";
$sqlForNeedNb = "SELECT COUNT(blocks.id) as count
FROM `blocks`
INNER JOIN regions r on r.id = blocks.region_id
INNER JOIN rf_regions rr on rr.id = r.rf_region_id
WHERE rr.id = $user->region_rf_id
";
$rezForNeedNb = mysql_query($sqlForNeedNb);
// $needNewbuildings = false;
$showNewbuildings = false;
// while($userId=mysql_fetch_assoc($rezForAd)) {
// if ($userId['id'] == $_SESSION['id']) {
// $needNewbuildings = true;
// break;
// }
// }
$countResult = mysql_fetch_assoc($rezForNeedNb);
if ($countResult['count'] != '0') {
$showNewbuildings = true;
}
// while($userId=mysql_fetch_assoc($rezForNeedNb)) {
// if ($userId['id'] == $_SESSION['id']) {
// $showNewbuildings = false;
// break;
// }
// }
$_GET['operation_type'] = ($_GET['operation_type'])? $_GET['operation_type'] : 0;
?>
<div class="new">
<div class="jw__page__tabs type__tabs">
<a href="/sale.php" class="tab sale_link">
<span>Продажа</span>
</a>
<a href="/main.php" class="tab main_link">
<span>Аренда</span>
</a>
<!-- <?php // if($user->region_rf_id == 2 || $user->region_rf_id == 1 ):?> -->
<?php if ($showNewbuildings) { ?>
<a href="/newbuildings.php" class="tab"> <!--добавлял класс <?php // if (!$needNewbuildings) { echo "show-newbuildings-modal"; } ?> -->
<span>Новостройки</span>
</a>
<?php }?>
<!-- <?php // endif ?> -->
<?php if (!$hasRestrictedAccess) {?>
<a href="/add-object.php" class="tab tab__new-object" style="padding-left: 35px;">
<i class="ti-plus"></i><span>Новый объект</span>
</a>
<?} else {
$db_sphinx = new MysqlPdo(hstsph2, null, null, null, true, '9306');
$sql_count = "SELECT id
FROM objects
WHERE del=0 AND id_add_user = {$user->id}
LIMIT 10 OPTION max_matches=10";
$vsego = $db_sphinx->num_rows($db_sphinx->query($sql_count, true));
if($vsego >= 3){
?>
<a href="javascript:{}" class="tab tab__new-object" onclick="trialperiod.modalObj();" style="padding-left: 35px;">
<i class="ti-plus"></i><span>Новый объект</span>
</a>
<?php
} else {
?>
<a href="/add-object.php" class="tab tab__new-object" style="padding-left: 35px;">
<i class="ti-plus"></i><span>Новый объект</span>
</a>
<?php
}?>
<?php } ?>
<a href="/find-objects.php?<?= http_build_query(clearInputData($_GET)) ?>" class="tab active">
<span>Поиск на карте</span>
</a>
</div>
</div>
<?php
require_once($_SERVER['DOCUMENT_ROOT']."/templates/find_object.php");
} else
{
?>
<div class="login-reg">
<div class="login-reg_inner">
<div class="main-title">
<h1>Вход</h1>
</div>
<?php
if($_GET['phone'] and !$msg)
{
?>
<form method="post">
<div class="control-group control-line">
<div class="form-search__main-label">Пароль в смс:</div>
<div class="control-inputs">
<div class="inputs-group">
<input type="text" name="sms" class="text" autofocus style="float:left;">
<input type="hidden" name="phone" value="<?php echo $get['phone']; ?>">
<input type="hidden" name="ok_auth2" value="1">
<button type="submit" class="fr-btn button-fl-left big-button">Вход</button>
</div>
</div>
<div class="clear"></div>
</div>
</form>
<?php
} elseif($_GET['phone2'] and !$msg)
{
?>
<form method="post">
<div class="control-group control-line" style="margin-bottom: 25px">
<div class="form-search__main-label">Пароль:</div>
<div class="control-inputs">
<div class="inputs-group">
<input type="password" name="pwd" class="text" autofocus style="float:left;">
<input type="hidden" name="phone" value="<?php echo $get['phone2']; ?>">
<input type="hidden" name="ok_auth3" value="1">
<button type="submit" class="fr-btn button-fl-right medium-button">Вход</button>
</div>
</div>
<div class="clear"></div>
</div>
</form>
<!--<a href="remind_pass.php">Забыли пароль?</a>-->
<?php
} else
{
?>
<form>
<div class="control-group control-line" style="margin-bottom: 25px">
<div class="form-search__main-label">Телефон:</div>
<div class="control-inputs">
<div class="inputs-group">
<input type="text" name="phone" placeholder="Телефон:" class="text phoneMask" autofocus value="<?php echo $post['phone']; ?>" style="float:left;">
<input type="hidden" name="ok_auth" value="1">
<button type="submit" class="fr-btn button-fl-right medium-button">Далее</button>
</div>
</div>
<div class="clear"></div>
</div>
</form>
<a href="reg.php">Регистрация</a>
<?php
}
if($msg or $msg2) echo '<div class="error_msg">'.$msg.$msg2.'</div>';
}
?>
</div>
</div>
</div>
</div>
<div class="full_modal-bg" id="newbuildings_adv_modal__bg" style="display: none">
<span class="pseudo-link closer"><i class="ti-close"></i></span>
<div class="full_modal jw__tele2-modal" id="newbuildings_adv_modal" style="display: none;">
<div class="modal-inner">
<h3 style="color: black;">Доступ к разделу "Новостройки" предоставляется бесплатно.</h3>
<div class="feature" style="margin: auto; width: 80%;">
<ul class="check-list">
<li>Более 70 застройщиков on-line</li>
<li>Фиксированное комиссионное вознаграждение</li>
<li>Мгновенное бронирование квартир у застройщика</li>
<li>Полное информирование по всем акциям строительных компаний</li>
<li>Бесплатный доступ</li>
</ul>
</div>
<div class="tele2-manager">
<h3>Для того, чтобы активировать данный раздел, оставьте заявку по тел. +7 812 765-08-01</h3>
</div>
</div>
</div>
</div>
<?php require($_SERVER['DOCUMENT_ROOT']."/templates/footer.php"); ?>