mirror of
https://github.com/openvk/openvk
synced 2024-11-15 11:39:13 +03:00
Фильтр по продуктам в списке отчётов
This commit is contained in:
parent
5f32b6e837
commit
f41df39b0f
2 changed files with 8 additions and 4 deletions
|
@ -38,9 +38,11 @@ class BugtrackerReports
|
||||||
yield new BugReport($report);
|
yield new BugReport($report);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReportsCount(): int
|
function getReportsCount(int $product_id): int
|
||||||
{
|
{
|
||||||
return sizeof($this->reports->where(["deleted" => NULL]));
|
return $product_id
|
||||||
|
? sizeof($this->reports->where(["deleted" => NULL, "product_id" => $product_id]))
|
||||||
|
: sizeof($this->reports->where(["deleted" => NULL]));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getByReporter(int $reporter_id, int $page = 1): \Traversable
|
function getByReporter(int $reporter_id, int $page = 1): \Traversable
|
||||||
|
|
|
@ -39,8 +39,10 @@ final class BugtrackerPresenter extends OpenVKPresenter
|
||||||
$this->template->count = $this->reports->getCountByReporter((int) $this->queryParam("id"));
|
$this->template->count = $this->reports->getCountByReporter((int) $this->queryParam("id"));
|
||||||
} else {
|
} else {
|
||||||
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
||||||
$this->template->count = $this->reports->getReportsCount(0);
|
$this->template->count = $this->reports->getReportsCount((int) $this->queryParam("product"));
|
||||||
$this->template->iterator = $this->reports->getAllReports($this->template->page);
|
$this->template->iterator = $this->queryParam("product")
|
||||||
|
? $this->reports->getReports((int) $this->queryParam("product"), $this->template->page)
|
||||||
|
: $this->reports->getAllReports($this->template->page);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template->canAdminBugTracker = $this->user->identity->getChandlerUser()->can("admin")->model('openvk\Web\Models\Repositories\BugtrackerReports')->whichBelongsTo(NULL);
|
$this->template->canAdminBugTracker = $this->user->identity->getChandlerUser()->can("admin")->model('openvk\Web\Models\Repositories\BugtrackerReports')->whichBelongsTo(NULL);
|
||||||
|
|
Loading…
Reference in a new issue