Joywork/templates/object-content__advert.php
2026-05-22 21:21:54 +03:00

558 lines
34 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$minAdvDays = 3;
$useAdverts = false;
$useInAdverts = boolval($obj['use_in_advert']);
$hasAdvertAlert = false;
$objectId = $obj['id'];
$hasAdvObject = (
$obj['add_to_bn_feed'] ||
$obj['add_to_yandex_feed'] ||
$obj['add_to_domclick_feed'] ||
$obj['add_to_avito_feed'] ||
$obj['add_to_emls_feed'] ||
$obj['add_to_cian_feed']
);
$zipalObjects = [];
$obj['zipal_active'] = 0;
if ($obj['add_to_zipal']) {
$sql = "SELECT id, days, created_at, destinations, add_to_zipal_at FROM `zipal_objects` WHERE object_id=$objectId ORDER BY id LIMIT 1";
$zipalRes = mysql_query($sql);
$zipalObjects = mysql_fetch_assoc($zipalRes);
}
$feedObjects = [];
if ($hasAdvObject) {
if (isset($objStatsArray)) {
foreach ($objStatsArray as $objSt) {
if ($objSt["object_id"] == $objectId) {
$feedObjects[] = $objSt;
}
}
} else {
$sqlStat = "SELECT object_id, destination, publish_start_date, publish_end_date, days_count FROM object_publish_statistic WHERE object_id = $objectId AND unpublish_user_id IS NULL AND advertising_package_object_publish_id IS NULL AND zipal_objects_id IS NULL AND on_moderation = 0";
$rezStat = mysql_query($sqlStat);
while ($stat = mysql_fetch_assoc($rezStat)) {
$feedObjects[] = $stat;
}
}
}
$packObjects = [];
if (isset($objPackStatsArray)) {
foreach ($objPackStatsArray as $objPackSt) {
if ($objPackSt["object_id"] == $objectId) {
$packObjects[] = $objPackSt;
}
}
} else {
$sql = "SELECT published.days AS days, published.publish_date AS publish_date, packs.name AS package
FROM advertising_package_object_publish published
JOIN advertising_package packs ON packs.id=published.advertising_package_id
WHERE published.active=1 AND published.object_id=$objectId";
$advRes = mysql_query($sql);
while ($advObjects = mysql_fetch_assoc($advRes)) {
$packObjects[] = $advObjects;
}
}
$hasAdvPackages = (count($packObjects) > 0);
if(isset($object_moderation)){
$objectModr = $object_moderation;
} else {
$moderationClass = new ModerationAdvert();
$objectModr = $moderationClass->get_object_moderation([$objectId], $user_ids=[$_SESSION['id']]);
}
$useModeration = false;
if(!empty($objectModr) && isset($objectModr[$objectId]) &&
($objectModr[$objectId]['add_to_bn_feed'] > 0 ||
$objectModr[$objectId]['add_to_yandex_feed'] > 0||
$objectModr[$objectId]['add_to_domclick_feed'] > 0 ||
$objectModr[$objectId]['add_to_avito_feed'] > 0||
$objectModr[$objectId]['add_to_emls_feed'] > 0||
$objectModr[$objectId]['add_to_cian_feed'] > 0 )
){
$useModeration = true;
}
?>
<?php if ($hasAdvObject || $zipalObjects || $hasAdvPackages) { ?>
<div class="object-content__advert source-how">
<div class="jw__popup advert__popup source-how__popup">
<div style="position:relative;z-index:1;">
<?php if ($hasAdvPackages) { ?>
<h4>Пакеты через Zipal</h4>
<?php
echo '<ul>';
foreach ($packObjects as $advObjects) {
$advDays = ceil(((strtotime($advObjects['publish_date']) + $advObjects['days'] * 86400) - time()) / 86400);
$advPackage = $advObjects['package'];
$advLeft = declOfNum($advDays, array('остался %d день', 'осталось %d дня', 'осталось %d дней'));
echo '<li>Пакет «' . $advPackage . '»';
if ($advDays <= $minAdvDays)
$hasAdvertAlert = true;
if ($advDays > $minAdvDays)
echo '<span class="note__text note__text-ok">' . (($advLeft) ? ', ' . $advLeft : '') . '</span>';
else
echo '<span class="note__text note__text-deny">' . (($advLeft) ? ', ' . $advLeft : '') . '</span>';
echo '</li>';
}
echo '</ul>';
$obj['zipal_active'] = 1;
$useAdverts = true;
} ?>
<?php if ($obj['add_to_zipal'] && isset($zipalObjects['days']) && isset($zipalObjects['destinations']) && isset($zipalObjects['add_to_zipal_at'])) { ?>
<h4>С отчетами через Zipal</h4>
<?php
$zipalDays = ceil(((strtotime($zipalObjects['add_to_zipal_at']) + $zipalObjects['days'] * 86400) - time()) / 86400);
$zipalLeft = declOfNum($zipalDays, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
echo '<ul class="columns-2">';
$data = json_decode($zipalObjects['destinations']);
foreach ($data as $item) {
$dest = $item->destination;
if (isset($ZIPAL_TARGETS[$dest]) && $item->feed == 'true') {
echo '<li>' . $ZIPAL_TARGETS[$dest] . '</li>';
}
}
echo '</ul>';
if ($zipalDays <= $minAdvDays)
$hasAdvertAlert = true;
if ($zipalDays > $minAdvDays)
echo '<span class="note__text note__text-ok">Размещается' . (($zipalLeft) ? ', ' . $zipalLeft : '') . '</span>';
else
echo '<span class="note__text note__text-deny">Размещается' . (($zipalLeft) ? ', ' . $zipalLeft : '') . '</span>';
$obj['zipal_active'] = 1;
$useAdverts = true;
} ?>
<h4>Выгрузки через xml</h4>
<?php
$hasWait = false;
$destinations = [];
if ($obj['add_to_avito_feed']) {
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'AVITO_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['avito'] || $obj['ads_errors'][1])) {
$destinations[] = 'Авито - ошибка размещения';
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['avito']) && $obj['ads_send']['avito']) || (isset($obj['ads_send'][1]) && $obj['ads_send'][1]))) {
$url = $obj['ads_send'][1];
if (!$url) {
$url = $obj['ads_send']['avito'];
}
$destinations[] = '<a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Авито</a> - размещается';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Авито - отправлен</span>';
}
}
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['avito'] || $obj['ads_errors'][1])) {
$destinations[] = '<span class="note__text">Авито - ошибка размещения</span>';
} else {
if ($daysNUmLeftNum > $minAdvDays) {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['avito']) && $obj['ads_send']['avito']) || (isset($obj['ads_send'][1]) && $obj['ads_send'][1]))) {
$url = $obj['ads_send'][1];
if (!$url) {
$url = $obj['ads_send']['avito'];
}
$destinations[] = '<span class="note__text note__text-ok"><a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Авито</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Авито' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['avito']) && $obj['ads_send']['avito']) || (isset($obj['ads_send'][1]) && $obj['ads_send'][1]))) {
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
$url = $obj['ads_send'][1];
if (!$url) {
$url = $obj['ads_send']['avito'];
}
$destinations[] = '<span class="note__text note__text-deny"><a style="color: #237ef7 !important;" href="' . $url . '" target="_blank">Авито</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Авито' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
}
}
}
break;
}
}
if (!$found) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['avito'] || $obj['ads_errors'][1])) {
$destinations[] = 'Авито - ошибка размещения';
} else {
$destinations[] = 'Авито - размещается';
}
}
}
if ($obj['add_to_cian_feed']) {
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'CIAN_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['cian'] || $obj['ads_errors'][2])) {
$destinations[] = 'Циан - ошибка размещения';
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['cian']) && $obj['ads_send']['cian']) || (isset($obj['ads_send'][2]) && $obj['ads_send'][2]))) {
$url = $obj['ads_send'][2];
if (!$url) {
$url = $obj['ads_send']['cian'];
}
$destinations[] = '<a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Циан</a> - размещается';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Циан - отправлен</span>';
}
}
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['cian'] || $obj['ads_errors'][2])) {
$destinations[] = '<span class="note__text">Циан - ошибка размещения</span>';
} else {
if ($daysNUmLeftNum > $minAdvDays) {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['cian']) && $obj['ads_send']['cian']) || (isset($obj['ads_send'][2]) && $obj['ads_send'][2]))) {
$url = $obj['ads_send'][2];
if (!$url) {
$url = $obj['ads_send']['cian'];
}
$destinations[] = '<span class="note__text note__text-ok"><a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Циан</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Циан' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['cian']) && $obj['ads_send']['cian']) || (isset($obj['ads_send'][2]) && $obj['ads_send'][2]))) {
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
$url = $obj['ads_send'][2];
if (!$url) {
$url = $obj['ads_send']['cian'];
}
$destinations[] = '<span class="note__text note__text-deny"><a target="_blank" href="' . $url . '">Циан</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Циан' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
}
}
}
break;
}
}
if (!$found) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['cian'] || $obj['ads_errors'][2])) {
$destinations[] = 'Циан - ошибка размещения';
} else {
$destinations[] = 'Циан - размещается';
}
}
}
if ($obj['add_to_domclick_feed']) {
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'DOMCLICK_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['domclick'] || $obj['ads_errors'][4])) {
$destinations[] = 'Домклик - ошибка размещения';
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['domclick']) && $obj['ads_send']['domclick']) || (isset($obj['ads_send'][4]) && $obj['ads_send'][4]))) {
$url = $obj['ads_send'][4];
if (!$url) {
$url = $obj['ads_send']['domclick'];
}
$destinations[] = '<a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Домклик</a> - размещается';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Домклик - отправлен</span>';
}
}
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['domclick'] || $obj['ads_errors'][4])) {
$destinations[] = '<span class="note__text">Домклик - ошибка размещения</span>';
} else {
if ($daysNUmLeftNum > $minAdvDays) {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['domclick']) && $obj['ads_send']['domclick']) || (isset($obj['ads_send'][4]) && $obj['ads_send'][4]))) {
$url = $obj['ads_send'][4];
if (!$url) {
$url = $obj['ads_send']['domclick'];
}
$destinations[] = '<span class="note__text note__text-ok"><a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Домклик</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Домклик' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['domclick']) && $obj['ads_send']['domclick']) || (isset($obj['ads_send'][4]) && $obj['ads_send'][4]))) {
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
$url = $obj['ads_send'][4];
if (!$url) {
$url = $obj['ads_send']['domclick'];
}
$destinations[] = '<span class="note__text note__text-deny"><a style="color: #237ef7 !important;" target="_blank" href="' . $url . '">Домклик</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Домклик' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
}
}
}
break;
}
}
if (!$found) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['domclick'] || $obj['ads_errors'][4])) {
$destinations[] = 'Домклик - ошибка размещения';
} else {
$destinations[] = 'Домклик - размещается';
}
}
}
if ($obj['add_to_emls_feed']) {
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'EMLS_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
$destinations[] = 'Jcat';
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
if ($daysNUmLeftNum > $minAdvDays) {
$destinations[] = '<span class="note__text note__text-ok">Jcat' . (($daysLeft) ? ', ' . $daysLeft : '') . '</span>';
} else {
$destinations[] = '<span class="note__text note__text-deny">Jcat' . (($daysLeft) ? ', ' . $daysLeft : '') . '</span>';
}
}
break;
}
}
if (!$found) {
$destinations[] = 'Jcat';
}
}
if ($obj['add_to_bn_feed']) {
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'YANDEX_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['yandex'] || $obj['ads_errors'][3])) {
$destinations[] = 'Яндекс - ошибка размещения';
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['yandex']) && $obj['ads_send']['yandex']) || (isset($obj['ads_send'][3]) && $obj['ads_send'][3]))) {
$url = $obj['ads_send'][3];
if (!$url) {
$url = $obj['ads_send']['yandex'];
}
$destinations[] = '<a style="color: #237ef7 !important;" style="color: #237ef7 !important;" href="' . $url . '" target="_blank">Яндекс</a> - размещается';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Яндекс - отправлен</span>';
}
}
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['yandex'] || $obj['ads_errors'][3])) {
$destinations[] = '<span class="note__text">Яндекс - ошибка размещения</span>';
} else {
if ($daysNUmLeftNum > $minAdvDays) {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['yandex']) && $obj['ads_send']['yandex']) || (isset($obj['ads_send'][3]) && $obj['ads_send'][3]))) {
$url = $obj['ads_send'][3];
if (!$url) {
$url = $obj['ads_send']['yandex'];
}
$destinations[] = '<span class="note__text note__text-ok"><a style="color: #237ef7 !important;" href="' . $url . '" target="_blank">Яндекс</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Яндекс' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
} else {
if (isset($obj['ads_send']) && ((isset($obj['ads_send']['yandex']) && $obj['ads_send']['yandex']) || (isset($obj['ads_send'][3]) && $obj['ads_send'][3]))) {
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
$url = $obj['ads_send'][3];
if (!$url) {
$url = $obj['ads_send']['yandex'];
}
$destinations[] = '<span class="note__text note__text-deny"><a style="color: #237ef7 !important;" href="' . $url . '" target="_blank">Яндекс</a>' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - размещается</span>';
} else {
$hasWait = true;
$destinations[] = '<span class="note__text note__text-wait">Яндекс' . (($daysLeft) ? ', ' . $daysLeft : '') . ' - отправлен</span>';
}
}
}
}
break;
}
}
if (!$found) {
if (count($obj['ads_errors']) > 0 && ($obj['ads_errors']['yandex'] || $obj['ads_errors'][3])) {
$destinations[] = 'Яндекс - ошибка размещения';
} else {
$destinations[] = 'Яндекс - размещается';
}
}
}
if (count($destinations) > 0) {
echo '<ul>';
foreach ($destinations as $dest) {
echo '<li>' . $dest . '</li>';
}
echo '</ul>';
$useAdverts = true;
} else {
echo '<span class="note__text note__text-deny">Не размещается</span>';
}
?>
<?php if ($obj['add_to_yandex_feed']) { ?>
<h4>Бесплатно</h4>
<?php
$useAdverts = true;
$found = false;
foreach ($feedObjects as $feedInfo) {
if ($feedInfo['destination'] == 'FREE_JW_FEED') {
$found = true;
$numDays = $feedInfo['days_count'];
if ($numDays == 5000) {
echo '<span class="note__text note__text-ok">Размещается</span>';
} else {
$daysNUmLeftNum = ceil(((strtotime($feedInfo['publish_start_date']) + $feedInfo['days_count'] * 86400) - time()) / 86400);
$daysLeft = declOfNum($daysNUmLeftNum, array('ещё %d день', 'ещё %d дня', 'ещё %d дней'));
if ($daysNUmLeftNum <= $minAdvDays) {
$hasAdvertAlert = true;
}
if ($daysNUmLeftNum > $minAdvDays) {
echo '<span class="note__text note__text-ok">Размещается' . (($daysLeft) ? ', ' . $daysLeft : '') . '</span>';
} else {
echo '<span class="note__text note__text-deny">Размещается' . (($daysLeft) ? ', ' . $daysLeft : '') . '</span>';
}
}
break;
}
}
if (!$found) {
echo '<span class="note__text note__text-ok">Размещается</span>';
}
} ?>
<?php
$hasErrors = false;
if (count($obj['ads_errors']) > 0) : ?>
<h4>Ошибки размещения</h4>
<?php foreach ($obj['ads_errors'] as $service => $errors) :
$serviceName = '';
if (($service == 'avito' || $service == 1) && $obj['add_to_avito_feed'])
$serviceName = 'Авито: ';
if (($service == 'cian' || $service == 2) && $obj['add_to_cian_feed'])
$serviceName = 'ЦИАН: ';
if (($service == 'yandex' || $service == 3) && $obj['add_to_bn_feed'])
$serviceName = 'Яндекс: ';
if (($service == 'domclick' || $service == 4) && $obj['add_to_domclick_feed'])
$serviceName = 'ДомКлик: ';
$errors = array_unique($errors);
if (count($errors) > 0 && $serviceName) {
$hasErrors = true;
echo '<dl class="note__text"><dt style="color: #757575;">' . $serviceName . '</dt>';
foreach ($errors as $error) {
echo '<dd style="color:rgb(226, 87, 76);">-&nbsp;' . $error . '</dd>';
}
echo '</dl>';
}
?>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php if ($useAdverts) : ?>
<?php if ($hasAdvertAlert || !$useInAdverts) : ?>
<a href="#" class="advert__status advert__status-outdate">Рекламный статус</a>
<?php else : ?>
<?php if ($hasErrors > 0) : ?>
<a href="#" class="advert__status advert__status-outdate" title="Есть ошибки размещения!">Рекламный статус <i class="ti-alert"></i></a>
<?php else : ?>
<?php if ($hasWait) : ?>
<a href="#" class="advert__status advert__status-wait">Рекламный статус</a>
<?php else : ?>
<a href="#" class="advert__status advert__status-active">Рекламный статус</a>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php } else { ?>
<div class="object-content__advert" style="display:none;"></div>
<?php } ?>
<?php if (!$useAdverts && !$useInAdverts && !$useModeration) : ?>
<script>
$('#addToAdvertSwitcher__<?= $objectId; ?>').prop('checked', false);
</script>
<?php elseif (($useAdverts && $useInAdverts) || $useModeration) : ?>
<script>$('#addToAdvertSwitcher__<?= $objectId; ?>').prop('checked', true);</script>
<?php endif; ?>