Отчет для клиента:
agencyId})) and object_id = {$obj['id']} and cancel=0";
$qRequest = $pdo->query($sqlRequest);
if($pdo->num_rows($qRequest) > 0){
$total_req = $pdo->num_rows($qRequest);
}
$sqlShow = "SELECT e.*,
IF(
IFNULL(s.sub_comment, '') = '',
NULL,
s.sub_comment
) AS sub_comment,
IF(s.created_by <> 0, (
SELECT CONCAT(u.last_name, ' ', u.first_name, ' ', u.middle_name)
FROM users as u WHERE u.id = s.created_by
), NULL
) as sub_comment_author,
If(e.from_id <> 0,
(
SELECT u.user_logo FROM users as u WHERE u.id = e.from_id
), (
SELECT u.user_logo FROM users as u WHERE u.id = e.user_id
)
) as user_logo,
If(
e.from_id <> 0,
(
SELECT CONCAT(u.last_name, ' ', u.first_name, ' ', u.middle_name)
FROM users as u WHERE u.id = e.from_id
), (
SELECT CONCAT(u.last_name, ' ', u.first_name, ' ', u.middle_name)
FROM users as u WHERE u.id = e.user_id
)
) as user_fio
FROM user_object_events as e
LEFT JOIN user_sub_comments AS s ON s.event_id = e.id AND s.section_id = 1
WHERE e.object_id = {$obj['id']} AND
e.type = 'show' AND
e.calendar_view = 1
GROUP BY e.id
ORDER BY e.create_date ASC";
$qShow = $pdo->query($sqlShow);
if($pdo->num_rows($qShow) > 0){
$total_show = $pdo->num_rows($qShow);
while($rShow = $pdo->fetch_assoc($qShow)){
$array_show[] = $rShow;
}
}
?>
Количество звонков по объекту: =$total_req?>
0){
$req_s = $pdo->fetch_assoc($pdo->query("SELECT name, client_id FROM requisitions WHERE id = {$event['req_id']}"));
$name_req = $req_s['name'];
$name_client = $pdo->result($pdo->query("SELECT fio FROM clients WHERE id = {$req_s['client_id']}"));
}
?>
Показ =$d?> =getRusMonth($m)?> =$y?> в =date("H:i", strtotime($event['schedule_date']))?>
Адрес: =$event['address']?>
0 && isset($name_req)){ ?>
Заявка: =$name_req?>
Клиент: =$name_client?>
Комментарий: =$event['comment']?>
Комментарий Менеджера Объекта: = $event['sub_comment'] ?> (= $event['sub_comment_author'] ?>)
0) {
while ($row = mysql_fetch_assoc($resRegion)) {
if ($row['parent']) {
$parentRegion = $row['parent'];
}
}
}
$sqlParentRegion = "SELECT name FROM rf_regions WHERE id=$parentRegion";
$resParentRegion = mysql_query($sqlParentRegion);
if (mysql_num_rows($resParentRegion)) {
$parentReg = mysql_fetch_assoc($resParentRegion);
$parentRegionName = $parentReg['name'];
}
$komnSql = "";
$commTypeSql = "";
if ($obj['komnat']) {
$komnSql = "AND komnat=$obj[komnat]";
}
if ($obj['type'] == 4) {
$commTypeSql = "AND type_category=$obj[type_category]";
}
if (!preg_match('~\d~', $obj['adres']) && $obj['dom']) {
$obj['adres'] = $obj['adres'] . " " . $obj['dom'];
}
$adres_search = getAdresSearch($obj['adres']);
$adres_mas = explode(" ", $adres_search);
$ausl_mas = array();
for ($a = 0; $a < count($adres_mas); $a++) {
if ($adres_mas[$a]) {
$ausl_mas[] = trim($adres_mas[$a]);
}
}
$latitude = null;
$longitude = null;
if (isset($objLocationInfo)) {
$latitude = $objLocationInfo['latitude'];
$longitude = $objLocationInfo['longitude'];
$latitude = str_replace(",", ".", $latitude);
$longitude = str_replace(",", ".", $longitude);
}
$coordinatesSql = "";
if ($latitude != null && $longitude != null) {
$coordinatesSql = " | (@(id_rf_region,parent) $parentRegion @latitude $latitude @longitude $longitude)";
}
$strSph = '';
for ($a = 0; $a < count($ausl_mas); $a++) {
if (strlen($strSph) > 1) {
$strSph = $strSph . ' ';
}
$strSph = $strSph . '@adres ' . trim(str_replace("/", "-", $ausl_mas[$a]));
}
$adres_usl = "MATCH ('(@(id_rf_region,parent) $parentRegion $strSph) $coordinatesSql')";
$foundIds = array();
if ($latitude != null && $longitude != null) {
$coordinatesSql = "MATCH ('@(id_rf_region,parent) $parentRegion') AND latitude = " . $latitude . " AND longitude = " . $longitude;
$sqlCountCoords = "SELECT id FROM objects, objects_delta WHERE archive = 0 AND black = 0 AND moder = 0 AND id <> $obj[id] AND operation_type = $obj[operation_type] AND type=$obj[type] $commTypeSql $komnSql AND $coordinatesSql LIMIT 0, 10000 OPTION max_matches=1000000";
$rezCoordsSearch = $db->query($sqlCountCoords, true);
if ($db->num_rows($rezCoordsSearch) > 0) {
while ($objCoords = $db->fetch_assoc($rezCoordsSearch)) {
$foundIds[] = $objCoords['id'];
}
}
}
$strSph = '';
for ($a = 0; $a < count($ausl_mas); $a++) {
if (strlen($strSph) > 1) {
$strSph = $strSph . ' ';
}
$strSph = $strSph . '@adres ' . trim(str_replace("/", "-", $ausl_mas[$a]));
}
$adres_usl = "MATCH ('@(id_rf_region,parent) $parentRegion $strSph')";
$sqlCount = "SELECT id FROM objects, objects_delta WHERE archive = 0 AND black = 0 AND moder = 0 AND id <> $obj[id] AND operation_type = $obj[operation_type] AND type=$obj[type] $commTypeSql $komnSql AND $adres_usl LIMIT 0, 10000 OPTION max_matches=1000000";
$rezAddressSearch = $db->query($sqlCount, true);
if ($db->num_rows($rezAddressSearch) > 0) {
while ($objAddr = $db->fetch_assoc($rezAddressSearch)) {
if (!in_array($objAddr['id'], $foundIds)) {
$foundIds[] = $objAddr['id'];
}
}
}
} else {
$foundIds = $cabinetObjCompetitors;
}
$vsego = count($foundIds);
if ($vsego > 0) {
$sqlSearch = "SELECT * FROM objects, objects_delta WHERE id in (" . implode(",", $foundIds) . ") ORDER BY stoim ASC LIMIT 0, 100 OPTION max_matches=1000000";
$rezSearch = $db->query($sqlSearch);
if ($db->num_rows($rezSearch) > 0) {
?>
Похожие объекты - конкуренты
0) {?>
Среднерыночная стоимость «Квадратного метра»
Демпинговые цены от: 2 000 000 – 3 000 000 р
Средние цены от: 3 000 000 – 5 000 000 р
Высокие цены от: 5 000 000 – 8 000 000 р
Среднерыночная стоимость «Объекта»
Демпинговые цены от: 2 000 000 – 3 000 000 р
Средние цены от: 3 000 000 – 5 000 000 р
Высокие цены от: 155 000 000 р – 300 000 000 р
Рекомендованная цена продажи
За 12 месяцев: 300 000 000 р
За 3 месяца: 300 200 000 р
Сделка завтра: 300 150 000 р
fetch_assoc($rezSearch)) {
include($_SERVER['DOCUMENT_ROOT'] . "/templates/object_analytics_cabinet_template.php");
} ?>
0) {
$foundIds = ObjectCabinet::getCabinetObjCompetitorsAsObjectIds($mdb, $cabinet['object_id']);
$vsego = count($foundIds);
$asScript = true;
$objectId = $cabinet['object_id'];
include($_SERVER['DOCUMENT_ROOT'] . "/ajax/analytics/getAnalyticsPriceStats.php");
}
}
$agency_id = $user->agencyId;
$advrStat = [];
$services = [];
$obj_id = $obj['id'];
$period = [
'date_from' => date('Y-m-d', strtotime($obj['date_add'])),
'date_to' => date('Y-m-d'),
];
$api = new AdvertStats();
$available = [];
if ($obj['add_to_avito_feed'] == 1)
$available[1] = 'avito';
if ($obj['add_to_cian_feed'] == 1)
$available[2] = 'cian';
if ($obj['add_to_yandex_feed'] == 1)
$available[3] = 'yandex';
if ($obj['add_to_domclick_feed'] == 1)
$available[4] = 'domclick';
$services = [];
$settings = $api->getApiSettings($agency_id, true);
if (count($settings)) {
foreach ($settings as $setting) {
$service_id = $setting['service_id'];
$service = $api->getServiceName($service_id);
$services[] = $service;
}
$reports = $api->getReports(null, $agency_id, $obj_id);
foreach ($reports as $service => $report) {
if (!is_null($report)) {
$advrStat['stats'][$service] = $report;
}
}
/*foreach ($settings as $setting) {
$service_id = $setting['service_id'];
if ($service = $available[$service_id]) {
if ($service == 'avito')
continue;
if (!isset($advrStat['stats'][$service])) {
$client_id = $setting['client_id'];
$secret_key = $setting['secret_key'];
$ext_user_id = $setting['ext_user_id'];
if ($service == 'yandex' && strtotime($period['date_from']) < strtotime('-120 days')) {
$period['date_from'] = date('Y-m-d', strtotime('-120 days'));
}
if ($stats = $api->getStats($service_id, $period, $client_id, $secret_key, $ext_user_id, $obj_id, true))
$advrStat['stats'][$service] = $stats;
else
$advrStat['stats'][$service] = null;
if (count($api->errors))
$advrStat['errors'][$service] = array_merge($advrStat['stats'][$service]['errors'], array_unique($api->errors));
if (count($advrStat['errors'][$service]))
$advrStat['errors'][$service] = array_unique($advrStat['errors'][$service]);
}
}
}*/
}
$sqlCabinetFeeds = "SELECT * FROM object_cabinet_feeds WHERE object_cabinet_id=$cabinet[id]";
$rezCabinetFeeds = mysql_query($sqlCabinetFeeds);
$sqlCabinetFeedsSumStat = "SELECT sum(view_count) as sum_view_count from object_cabinet_feeds where object_cabinet_id = $cabinet[id]";
$rezCabinetFeedsSumStat = mysql_query($sqlCabinetFeedsSumStat);
$rezCabinetFeedsSumStatRes = mysql_fetch_assoc($rezCabinetFeedsSumStat);
$whereSqlPack = "zipal_id in (select pp.zipal_id from advertising_package_object_publish pp where pp.object_id = $obj[id] and pp.active=1)";
$whereSqlBut = "";
if ($obj['add_to_zipal'] == 1) {
$whereSqlBut = "or zipal_id in (select zo.zipal_id from zipal_objects zo where zo.object_id = $obj[id])";
}
$whereSqlJcat = "or jcat_id in (select zo.jcat_id from jcat_feed_report_objects zo where zo.object_id = $obj[id] and zo.active = 1)";
$sqlStat = "SELECT * from object_feed_stat where object_id = $obj[id] and deleted = 0 and ($whereSqlPack $whereSqlBut $whereSqlJcat)";
$rezStat = mysql_query($sqlStat);
$sqlSumStat = "SELECT sum(view_count) as sum_view_count from object_feed_stat where object_id = $obj[id] and deleted = 0 and ($whereSqlPack $whereSqlBut $whereSqlJcat)";
$rezSumStat = mysql_query($sqlSumStat);
$rezSumStatRes = mysql_fetch_assoc($rezSumStat);
$sum = $rezSumStatRes['sum_view_count'] + $rezCabinetFeedsSumStatRes['sum_view_count'];
$resultArray = [];
while ($stat = mysql_fetch_assoc($rezCabinetFeeds)) {
$result = [];
$result['url'] = $stat['url'];
$result['name'] = $stat['name'];
$result['view'] = $stat['view_count'];
$resultArray[] = $result;
}
while ($stat = mysql_fetch_assoc($rezStat)) {
if (strpos($stat['link'], 'http://') !== false || strpos($stat['link'], 'https://') !== false) {
$result = [];
$result['url'] = $stat['link'];
$result['name'] = $stat['feed_name'];
$result['view'] = $stat['view_count'];
$resultArray[] = $result;
}
}
if (count($advrStat) > 0 || count($resultArray) > 0 || $cabinet['show_empty_links'] == 1) {
$views = 0;
?>
0) {
?>
Основные сайты
Общее количество просмотров: 256
Площадка
Просмотров объявления
Просмотров контактов
Добавили в избранное
Звонков с сайта
= (!is_null($stats['url'])) ? 'Авито ' : "Авито" ?>
= (!is_null($stats['views'])) ? $stats['views'] : 'n/a '; ?>
= (!is_null($stats['contacts'])) ? $stats['contacts'] : 'n/a '; ?>
= (!is_null($stats['favorites'])) ? $stats['favorites'] : 'n/a '; ?>
= (!is_null($stats['calls'])) ? $stats['calls'] : 'n/a '; ?>
= (!is_null($stats['url'])) ? 'ЦИАН ' : "ЦИАН" ?>
= (!is_null($stats['views'])) ? $stats['views'] : 'n/a '; ?>
= (!is_null($stats['contacts'])) ? $stats['contacts'] : 'n/a '; ?>
= (!is_null($stats['favorites'])) ? $stats['favorites'] : 'n/a '; ?>
= (!is_null($stats['calls'])) ? $stats['calls'] : 'n/a '; ?>
= (!is_null($stats['url'])) ? 'Я.Недвижимость ' : "Яндекс.Недвижимость" ?>
= (!is_null($stats['views'])) ? $stats['views'] : 'n/a '; ?>
= (!is_null($stats['contacts'])) ? $stats['contacts'] : 'n/a '; ?>
= (!is_null($stats['favorites'])) ? $stats['favorites'] : 'n/a '; ?>
= (!is_null($stats['calls'])) ? $stats['calls'] : 'n/a '; ?>
= (!is_null($stats['url'])) ? 'ДомКлик ' : "ДомКлик" ?>
= (!is_null($stats['views'])) ? $stats['views'] : 'n/a '; ?>
= (!is_null($stats['contacts'])) ? $stats['contacts'] : 'n/a '; ?>
= (!is_null($stats['favorites'])) ? $stats['favorites'] : 'n/a '; ?>
= (!is_null($stats['calls'])) ? $stats['calls'] : 'n/a '; ?>
0 || $cabinet['show_empty_links'] == 1) {
?>
document.getElementById("viewsSpan").innerText = ' . $views . ';';
?>
} ?>