73 lines
2.5 KiB
PHP
73 lines
2.5 KiB
PHP
|
<?php
|
||
|
ini_set('display_errors', 0 );
|
||
|
unset($_SESSION['work_id']);
|
||
|
|
||
|
|
||
|
$smarty -> caching = false;
|
||
|
$smarty -> cache_lifetime = 86400;
|
||
|
|
||
|
/* ----------------------------------------------------------------------
|
||
|
01.05.2023
|
||
|
Получаем города и регионы
|
||
|
---------------------------------------------------------------------- */
|
||
|
$region=\DB::getAll("SELECT * FROM `region` WHERE `strana_id`=1");
|
||
|
$city=\DB::getAll("SELECT * FROM `city` WHERE `strana_id`=1");
|
||
|
$smarty->assign('region', $region );
|
||
|
$smarty->assign('city', $city );
|
||
|
|
||
|
/* ----------------------------------------------------------------------
|
||
|
01.05.2023
|
||
|
Получаем заказы
|
||
|
---------------------------------------------------------------------- */
|
||
|
|
||
|
|
||
|
if (!$_SESSION['city']){
|
||
|
$city = \core::get_geo_api($_SERVER['REMOTE_ADDR'])['city'];
|
||
|
$_SESSION['city']=\DB::getValue("SELECT `id` FROM `city` WHERE `txt`=? LIMIT 1", $city);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
$works=\DB::getAll("SELECT * FROM `quick-work` WHERE `status`=1 AND `city`=? ORDER BY `id` DESC", $_SESSION['city']);
|
||
|
|
||
|
require_once ('api/php/list_file.php');
|
||
|
|
||
|
for ($i=0; $i<count($works); $i++){
|
||
|
unset($list);
|
||
|
$list=list_file('img/quick-work/' . $_SERVER['SERVER_NAME'] . '/' . $works[$i]['id']);
|
||
|
if ($list)$count=count($list);
|
||
|
$works[$i]['img']=$list[rand(0, $count-1)];
|
||
|
$works[$i]['city']=\DB::getValue("SELECT `txt` FROM `city` WHERE `id`=?", $works[$i]['city']);
|
||
|
}
|
||
|
|
||
|
$smarty->assign('works', $works );
|
||
|
/* ----------------------------------------------------------------------
|
||
|
01.05.2023
|
||
|
Получаем заказ
|
||
|
---------------------------------------------------------------------- */
|
||
|
if ($_GET['id']){
|
||
|
|
||
|
$workInfo=\DB::getAll("SELECT * FROM `quick-work` WHERE `id`=?", $_GET['id']);
|
||
|
unset($list);
|
||
|
//все фото:
|
||
|
$fotos=list_file('img/quick-work/' . $_SERVER['SERVER_NAME'] . '/' . $_GET['id']);
|
||
|
$userInfo=\DB::getAll("SELECT * FROM `users` WHERE `id`=?", $workInfo[0]['user_id']);
|
||
|
|
||
|
|
||
|
|
||
|
$smarty->assign('fotos', $fotos );
|
||
|
$smarty->assign('userInfo', $userInfo );
|
||
|
//Количество откликов
|
||
|
$workInfo[0]['kvotklic']=\DB::getAll("SELECT count(*) FROM `quick-work-otklic` WHERE `work-id`=?", $_GET['id'])[0]['count(*)'];
|
||
|
|
||
|
$workInfo[0]['minCena']=\DB::getValue('SELECT `cena` FROM `quick-work-otklic` ORDER BY `cena` LIMIT 1' );
|
||
|
|
||
|
|
||
|
$smarty->assign('workInfo', $workInfo );
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
?>
|