View file modules/donats/show.php

File size: 4.58Kb
<?php
$donats = db::get_string("SELECT * FROM `DONATS` WHERE `ID` = ? LIMIT 1", [intval(get('id'))]);
acms_header('Донаты - сбор');
is_active_module('PRIVATE_DONATS');

if (!isset($donats['ID'])) {
  
  error('Неверная директива');
  redirect('/m/donats/');

}

$sm = intval(db::get_column("SELECT SUM(`SUM`) FROM `DONATS_USERS` WHERE `D_ID` = ?", [$donats['ID']]));

if ($sm >= $donats['MAX_SUM'] && $donats['ACT'] == 0) {
  
  db::get_set("UPDATE `DONATS` SET `ACT` = ? WHERE `ID` = ? LIMIT 1", [1, $donats['ID']]);
  redirect('/m/donats/show/?id='.$donats['ID']);

}

if (MANAGEMENT == 1 || $donats['USER_ID'] == user('ID')) {
  
  require (ROOT.'/modules/donats/plugins/delete.php');
  
}

if (user('ID') > 0 && $donats['USER_ID'] == user('ID') && $donats['ACT'] == 1 && get('get') == 'sum') {
  
  require (ROOT.'/modules/donats/plugins/sum.php');
  
}

if (user('ID') > 0 && $donats['USER_ID'] != user('ID') && get('get') == 'go') {
  
  require (ROOT.'/modules/donats/plugins/go.php');
  
}

?>
<style>
  
#confettis {
  overflow: hidden;
  position: absolute;
  height: 100%;
  width: 100%;
}

.confetti {
  left: 50%;
  width: 16px;
  height: 16px;
  position: absolute;
  transform-origin: left top;
  animation: confetti 5s ease-in-out -2s infinite;
  background: red;
}

.confetti:nth-child(1) {
  left: 10%;
  animation-delay: 0;
  background-color: #fc0120;
}

.confetti:nth-child(2) {
  left: 20%;
  animation-delay: -5s;
  background-color: #8257e6;
}

.confetti:nth-child(3) {
  left: 30%;
  animation-delay: -3s;
  background-color: #ffbf4d;
}

.confetti:nth-child(4) {
  left: 40%;
  animation-delay: -2.5s;
  background-color: #fe5d7a;
}

.confetti:nth-child(5) {
  left: 50%;
  animation-delay: -4s;
  background-color: #45ec9c;
}

.confetti:nth-child(6) {
  left: 60%;
  animation-delay: -6s;
  background-color: #f6e327;
}

.confetti:nth-child(7) {
  left: 70%;
  animation-delay: -1.5s;
  background-color: #f769ce;
}

.confetti:nth-child(8) {
  left: 80%;
  animation-delay: -2s;
  background-color: #007de7;
}

.confetti<:nth-child(9) {
  left: 90%;
  animation-delay: -3.5s;
  background-color: #63b4fc;
}

.confetti:nth-child(10) {
  left: 100%;
  animation-delay: -2.5s;
  background-color: #f9c4ea;
}

@keyframes confetti {
  0% {
    transform: rotateZ(15deg) rotateY(0deg) translate(0, 0);
  }
  25% {
    transform: rotateZ(5deg) rotateY(360deg) translate(-5vw, 20vh);
  }
  50% {
    transform: rotateZ(15deg) rotateY(720deg) translate(5vw, 60vh);
  }
  75% {
    transform: rotateZ(5deg) rotateY(1080deg) translate(-10vw, 80vh);
  }
  100% {
    transform: rotateZ(15deg) rotateY(1440deg) translate(10vw, 110vh);
  }
}

</style> 
  
<?php if (MANAGEMENT == 1 || $donats['USER_ID'] == user('ID')) : ?>
<div class='list'>
<a href='/m/donats/edit/?id=<?=$donats['ID']?>' class='btn'><?=icons('pencil', 15, 'fa-fw')?> <?=lg('Редактировать')?></a>
<a href='/m/donats/show/?id=<?=$donats['ID']?>&get=delete&<?=TOKEN_URL?>' class='btn'><?=icons('trash', 15, 'fa-fw')?> <?=lg('Удалить')?></a>
</div>
<?php endif ?>
<?

require (ROOT.'/modules/donats/plugins/list.php');
echo $don_list;

?>  
<div class='list'>
<b><?=lg('Ссылка')?>:</b><br />
<?=html::input(null, null, null, null, SCHEME.HTTP_HOST.'/m/donats/show/?id='.$donats['ID'], 'form-control-100', null, null, 'link')?>
<small><?=lg('Отправьте ссылку пользователям для привлечения')?></small>
</div>  

<div class='list'><b><?=lg('Список пожертвований')?>:</b></div>
<?
  
$column = db::get_column("SELECT COUNT(*) FROM `DONATS_USERS` WHERE `D_ID` = ?", [$donats['ID']]);
$spage = spage($column, PAGE_SETTINGS);
$page = page($spage);
$limit = PAGE_SETTINGS * $page - PAGE_SETTINGS;

if ($column == 0){ 
  
  ?>
  <div class='list'><?=lg('Пожертвований пока нет')?></div>
  <?
  
}else{
  
  ?>
  <div style='position: relative'>
  <div id="confettis">
  <div class="confetti"></div>
  <div class="confetti"></div>
  <div class="confetti"></div>
  <div class="confetti"></div>
  <div class="confetti"></div>
  <div class="confetti'"></div>
  <div class="confetti"></div>
  <div class="confetti"></div>
  <div class="confetti"></div>
  </div>
  <?
  
}

$data = db::get_string_all("SELECT * FROM `DONATS_USERS` WHERE `D_ID` = ? ORDER BY `TIME` DESC LIMIT ".$limit.", ".PAGE_SETTINGS, [$donats['ID']]);
while ($list = $data->fetch()) {
  
  require (ROOT.'/modules/donats/plugins/ulist.php');
  echo $don_ulist;
  
}

if ($column > 0){ 
  
  ?>
  </div>
  <?
  
}

get_page('/m/donats/show/?id='.$donats['ID'].'&', $spage, $page, 'list');

back('/m/donats/');
acms_footer();