Refactor
This commit is contained in:
parent
3710dbcf52
commit
c6a5ac7caa
1 changed files with 10 additions and 11 deletions
|
@ -69,25 +69,24 @@ class Wish
|
|||
|
||||
public bool $exists = false;
|
||||
|
||||
public function __construct(int|array $wish, bool $generateCache = false)
|
||||
public function __construct(int|array $idOrColumns, bool $generateCache = false)
|
||||
{
|
||||
global $database;
|
||||
|
||||
$columns = array();
|
||||
|
||||
if (is_numeric($wish)) {
|
||||
$wish = $database
|
||||
if (is_numeric($idOrColumns)) {
|
||||
$id = $idOrColumns;
|
||||
$columns = $database
|
||||
->query(
|
||||
'SELECT ' . self::SELECT . '
|
||||
FROM ' . self::FROM . '
|
||||
LEFT JOIN ' . self::LEFT_JOIN . '
|
||||
WHERE ' . sprintf(self::WHERE, $wish)
|
||||
WHERE ' . sprintf(self::WHERE, $id)
|
||||
)
|
||||
->fetch();
|
||||
|
||||
$columns = $wish;
|
||||
} elseif (is_array($wish)) {
|
||||
$columns = $wish;
|
||||
} elseif (is_array($idOrColumns)) {
|
||||
$columns = $idOrColumns;
|
||||
}
|
||||
|
||||
if ($columns) {
|
||||
|
@ -170,9 +169,9 @@ class Wish
|
|||
</div>
|
||||
|
||||
<div class="image">
|
||||
<?php if ($this->priority && isset(Wish::$priorities[$this->priority])) { ?>
|
||||
<div class="ui small <?= Wish::$priorities[$this->priority]['color'] ?> right ribbon label">
|
||||
<?= Wish::$priorities[$this->priority]['name'] ?>
|
||||
<?php if ($this->priority && isset(self::$priorities[$this->priority])) { ?>
|
||||
<div class="ui small <?= self::$priorities[$this->priority]['color'] ?> right ribbon label">
|
||||
<?= self::$priorities[$this->priority]['name'] ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
|
Loading…
Reference in a new issue