nativegallery-weryskok/views/pages/Admin/Photo.php

165 lines
7.1 KiB
PHP
Raw Normal View History

2024-07-17 05:00:53 +03:00
<?php
use \App\Services\{Auth, DB, Date};
use \App\Models\User;
//$userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
?>
<tr>
2024-07-18 16:13:50 +03:00
<style>
#sbmt {
display: inline-block;
box-sizing: border-box;
vertical-align: middle;
cursor: pointer;
position: relative;
padding: 2px 15px 3px;
height: auto;
text-align: center;
font-family: var(--narrow-font);
font-size: 17px;
font-weight: bold;
color: var(--theme-fg-color);
background-color: #777;
background-color: var(--theme-bg-color);
transition: none;
border: none;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
border-radius: 0;
-webkit-border-radius: 0;
}
</style>
2024-07-17 05:00:53 +03:00
<td class="main">
2024-07-21 04:43:25 +03:00
<h1><b>Журнал</b></h1>
2024-07-17 05:00:53 +03:00
<script src="/js/diff.js"></script>
<script src="/js/pwrite-compare.js"></script>
2024-07-21 04:43:25 +03:00
<br clear="all"><br>
2024-07-17 05:00:53 +03:00
<div class="p20w" style="display:block">
2024-07-20 23:04:27 +03:00
<table class="table">
2024-07-17 05:00:53 +03:00
<tbody>
<tr>
<th width="100">Изображение</th>
2024-07-20 23:04:27 +03:00
<th width="50%">Информация</th>
2024-07-17 05:10:14 +03:00
<th>Действия</th>
2024-07-17 05:00:53 +03:00
</tr>
<?php
2024-07-18 16:05:32 +03:00
$photos = DB::query('SELECT * FROM photos WHERE moderated=0 ORDER BY id DESC');
2024-07-17 05:00:53 +03:00
foreach ($photos as $p) {
if ($p['moderated'] === 0) {
$color = 's0';
} else if ($p['moderated'] === 2) {
$color = 's15';
} else {
$color = 's12';
}
$author = new User($p['user_id']);
2024-07-21 04:43:25 +03:00
echo ' <tr id="pht'.$p['id'].'" class="'.$color.'">
2024-07-20 23:04:27 +03:00
<td>
2024-07-17 05:00:53 +03:00
<a href="/photo/'.$p['id'].'/" target="_blank" class="prw">
<img src="'.$p['photourl'].'" class="f">
</a>
</td>
2024-07-20 23:04:27 +03:00
<td>
2024-07-17 05:00:53 +03:00
<p><span style="word-spacing:-1px"><b>'.htmlspecialchars($p['place']).'</b></span></p>
<p class="sm"><b>'.Date::zmdate($p['posted_at']).'</b><br>Автор: <a href="/author/'.$p['user_id'].'/">'.htmlspecialchars($author->i('username')).'</a></p>
</td>
2024-07-17 05:10:14 +03:00
<td class="c">
';
if ($p['moderated'] === 0) {
2024-07-20 23:04:27 +03:00
echo '<a href="/api/admin/images/setvisibility?id='.$p['id'].'&mod=1" class="btn btn-primary">Принять</a>
2024-07-20 23:09:47 +03:00
<a data-bs-toggle="modal" data-bs-target="#declinePhotoModal'.$p['id'].'" href="#" class="btn btn-danger">Отклонить</a>';
2024-07-17 05:10:14 +03:00
}
echo '
</td>';
if ($p['endmoderation'] === -1) {
$endm = 'На модерации';
}
2024-07-20 23:04:27 +03:00
echo '
2024-07-20 23:09:47 +03:00
</tr>
<div class="modal fade" id="declinePhotoModal'.$p['id'].'" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel"><b>Причина отклонения</b></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="form-check">
2024-07-21 04:43:25 +03:00
<input name="decline" value="1" class="form-check-input" type="radio" name="flexRadioDefault" id="declineReason1">
<label class="form-check-label" for="declineReason1">
2024-07-20 23:09:47 +03:00
Малоинформативный бред
</label>
</div>
<div class="form-check">
2024-07-21 04:43:25 +03:00
<input name="decline'.$p['id'].'" checked value="2" class="form-check-input" type="radio" name="flexRadioDefault" id="declineReason2">
<label class="form-check-label" for="declineReason2">
2024-07-20 23:09:47 +03:00
Не подходит для сайта
</label>
</div>
<div class="form-check">
2024-07-21 04:43:25 +03:00
<input name="decline'.$p['id'].'" value="3" class="form-check-input" type="radio" name="flexRadioDefault" id="declineReason3">
<label class="form-check-label" for="declineReason3">
2024-07-20 23:09:47 +03:00
Порнография
</label>
</div>
<div class="form-check">
2024-07-21 04:43:25 +03:00
<input name="decline'.$p['id'].'" value="4" class="form-check-input" type="radio" name="flexRadioDefault" id="declineReason4">
<label class="form-check-label" for="declineReason4">
2024-07-20 23:09:47 +03:00
Травля/издевательство над человеком
</label>
</div>
<div class="form-check">
2024-07-21 04:43:25 +03:00
<input name="decline'.$p['id'].'" value="5" class="form-check-input" type="radio" name="flexRadioDefault" id="declineReason5">
<label class="form-check-label" for="declineReason5">
2024-07-20 23:09:47 +03:00
Расчленёнка
</label>
</div>
</div>
<div class="modal-footer">
2024-07-21 04:43:25 +03:00
<a type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</a>'; ?>
<a href="#" onclick="photoAction(<?=$p['id']?>, document.querySelector(`input[name='decline<?=$p['id']?>']:checked`).value, 2); return false;" data-bs-dismiss="modal" class="btn btn-primary">Сохранить</a>
<?php echo '
2024-07-20 23:09:47 +03:00
</div>
</div>
</div>
</div>
';
2024-07-17 05:00:53 +03:00
}
?>
</tbody>
</table>
</div><br>
</td>
</tr>
2024-07-21 04:43:25 +03:00
<script>
function photoAction(photo_id, decline_reason, mod) {
$.ajax({
type: "GET",
url: '/api/admin/images/setvisibility?id='+photo_id+'&mod='+mod+'&decline_reason='+decline_reason,
data: $(this).serialize(),
success: function(response) {
$('#pht'+photo_id).remove();
Notify.noty('success', 'OK!');
//$("#result").html("<div class='alert alert-successnew container mt-5' role='alert'>Успешный вход!</div>");
}
});
}
</script>
2024-07-20 23:04:27 +03:00