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 bool $exists = false;
|
||||||
|
|
||||||
public function __construct(int|array $wish, bool $generateCache = false)
|
public function __construct(int|array $idOrColumns, bool $generateCache = false)
|
||||||
{
|
{
|
||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
$columns = array();
|
$columns = array();
|
||||||
|
|
||||||
if (is_numeric($wish)) {
|
if (is_numeric($idOrColumns)) {
|
||||||
$wish = $database
|
$id = $idOrColumns;
|
||||||
|
$columns = $database
|
||||||
->query(
|
->query(
|
||||||
'SELECT ' . self::SELECT . '
|
'SELECT ' . self::SELECT . '
|
||||||
FROM ' . self::FROM . '
|
FROM ' . self::FROM . '
|
||||||
LEFT JOIN ' . self::LEFT_JOIN . '
|
LEFT JOIN ' . self::LEFT_JOIN . '
|
||||||
WHERE ' . sprintf(self::WHERE, $wish)
|
WHERE ' . sprintf(self::WHERE, $id)
|
||||||
)
|
)
|
||||||
->fetch();
|
->fetch();
|
||||||
|
} elseif (is_array($idOrColumns)) {
|
||||||
$columns = $wish;
|
$columns = $idOrColumns;
|
||||||
} elseif (is_array($wish)) {
|
|
||||||
$columns = $wish;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($columns) {
|
if ($columns) {
|
||||||
|
@ -170,9 +169,9 @@ class Wish
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<?php if ($this->priority && isset(Wish::$priorities[$this->priority])) { ?>
|
<?php if ($this->priority && isset(self::$priorities[$this->priority])) { ?>
|
||||||
<div class="ui small <?= Wish::$priorities[$this->priority]['color'] ?> right ribbon label">
|
<div class="ui small <?= self::$priorities[$this->priority]['color'] ?> right ribbon label">
|
||||||
<?= Wish::$priorities[$this->priority]['name'] ?>
|
<?= self::$priorities[$this->priority]['name'] ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue