mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-23 05:04:14 +00:00
show user's magnets and comments on this node with access label
This commit is contained in:
parent
9f2841220a
commit
6b25c2ebff
@ -610,7 +610,7 @@ class Database {
|
||||
return $query->fetchAll();
|
||||
}
|
||||
|
||||
public function getMagnetsTotal() {
|
||||
public function getMagnetsTotal() : int {
|
||||
|
||||
$this->_debug->query->select->total++;
|
||||
|
||||
@ -621,6 +621,17 @@ class Database {
|
||||
return $query->fetch()->result;
|
||||
}
|
||||
|
||||
public function getMagnetsTotalByUserId(int $userId) : int {
|
||||
|
||||
$this->_debug->query->select->total++;
|
||||
|
||||
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnet` WHERE `userId` = ?');
|
||||
|
||||
$query->execute([$userId]);
|
||||
|
||||
return $query->fetch()->result;
|
||||
}
|
||||
|
||||
public function updateMagnetDn(int $magnetId, string $dn, int $timeUpdated) : int {
|
||||
|
||||
$this->_debug->query->update->total++;
|
||||
@ -1215,6 +1226,26 @@ class Database {
|
||||
return $query->fetch()->result;
|
||||
}
|
||||
|
||||
public function getMagnetCommentsTotalByUserId(int $userId, mixed $magnetId = null) : int {
|
||||
|
||||
$this->_debug->query->select->total++;
|
||||
|
||||
if ($magnetId)
|
||||
{
|
||||
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ? AND `magnetId` = ?');
|
||||
|
||||
$query->execute([$userId, $magnetId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = $this->_db->prepare('SELECT COUNT(*) AS `result` FROM `magnetComment` WHERE `userId` = ?');
|
||||
|
||||
$query->execute([$userId]);
|
||||
}
|
||||
|
||||
return $query->fetch()->result;
|
||||
}
|
||||
|
||||
public function getMagnetComments(int $magnetId, mixed $magnetCommentIdParent = null) {
|
||||
|
||||
$this->_debug->query->select->total++;
|
||||
|
@ -44,6 +44,10 @@
|
||||
color: #b55cab;
|
||||
}
|
||||
|
||||
.text-color-default {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/*
|
||||
.text-color-pink {
|
||||
color: #a44399;
|
||||
|
@ -112,11 +112,35 @@ else if (is_null($user->public))
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo _('Magnets') ?></td>
|
||||
<td><?php echo $db->getMagnetsTotal() ?></td>
|
||||
<td>
|
||||
<?php echo $db->getMagnetsTotal() ?>
|
||||
/
|
||||
<span class="cursor-default <?php echo $user->public ? 'text-color-green' : 'text-color-pink' ?>">
|
||||
<?php echo $db->getMagnetsTotalByUserId($user->userId) ?>
|
||||
<sub class="text-color-default opacity-0 parent-hover-opacity-09" title="<?php echo $user->public ? _('Your magnets on this node (shared)') : _('Your magnets on this node (local)') ?>">
|
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16">
|
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
|
||||
</svg>
|
||||
</sub>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo _('Comments') ?></td>
|
||||
<td><?php echo $db->getMagnetCommentsTotal() ?></td>
|
||||
<td>
|
||||
<?php echo $db->getMagnetCommentsTotal() ?>
|
||||
<?php if ($userMagnetCommentsTotal = $db->getMagnetCommentsTotalByUserId($user->userId)) { ?>
|
||||
/
|
||||
<span class="cursor-default <?php echo $user->public ? 'text-color-green' : 'text-color-pink' ?>">
|
||||
<?php echo $userMagnetCommentsTotal ?>
|
||||
<sub class="text-color-default opacity-0 parent-hover-opacity-09" title="<?php echo $user->public ? _('Your comments on this node (shared)') : _('Your comments on this node (local)') ?>">
|
||||
<svg class="width-13px" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16">
|
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
|
||||
</svg>
|
||||
</sub>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo _('Moderators') ?></td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user