Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
ManagementFeedbackListLogic | |
0.00% |
0 / 15 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
validateImpl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
executeImpl | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Domain\Page\Management; |
6 | |
7 | use PeServer\App\Models\AppDatabaseCache; |
8 | use PeServer\App\Models\Dao\Entities\FeedbacksEntityDao; |
9 | use PeServer\App\Models\Domain\AppArchiver; |
10 | use PeServer\App\Models\Domain\Page\PageLogicBase; |
11 | use PeServer\Core\Mvc\LogicCallMode; |
12 | use PeServer\Core\Mvc\LogicParameter; |
13 | use PeServer\Core\Mvc\Pagination; |
14 | use PeServer\Core\Stopwatch; |
15 | use PeServer\Core\TypeUtility; |
16 | |
17 | class ManagementFeedbackListLogic extends PageLogicBase |
18 | { |
19 | #region define |
20 | |
21 | public const ITEM_COUNT_IN_PAGE = 25; |
22 | |
23 | #endregion |
24 | |
25 | public function __construct(LogicParameter $parameter) |
26 | { |
27 | parent::__construct($parameter); |
28 | } |
29 | |
30 | protected function validateImpl(LogicCallMode $callMode): void |
31 | { |
32 | //NOP |
33 | } |
34 | |
35 | protected function executeImpl(LogicCallMode $callMode): void |
36 | { |
37 | $pageNumber = 1; |
38 | if ($callMode === LogicCallMode::Submit) { |
39 | $requestPageNumber = $this->getRequest('page_number'); |
40 | if (TypeUtility::tryParsePositiveInteger($requestPageNumber, $temp)) { |
41 | $pageNumber = $temp; |
42 | } |
43 | } |
44 | |
45 | $database = $this->openDatabase(); |
46 | $feedbacksEntityDao = new FeedbacksEntityDao($database); |
47 | |
48 | $totalCount = $feedbacksEntityDao->selectFeedbacksPageTotalCount(); |
49 | |
50 | $pagination = new Pagination($pageNumber, self::ITEM_COUNT_IN_PAGE, $totalCount); |
51 | $items = $feedbacksEntityDao->selectFeedbacksPageItems(($pagination->currentPageNumber - 1) * $pagination->itemCountInPage, $pagination->itemCountInPage); |
52 | |
53 | $this->setValue('total_count', $totalCount); |
54 | $this->setValue('items', $items); |
55 | $this->setValue('pager', $pagination); |
56 | } |
57 | } |