| Total Complexity | 3 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class PageAjaxIgnore extends PageAjax { |
||
| 11 | /** |
||
| 12 | * List of allowed actions for this page |
||
| 13 | * |
||
| 14 | * @var array[] $allowedActions [(string)action] => true |
||
| 15 | */ |
||
| 16 | protected $allowedActions = [ |
||
| 17 | 'ignorePlayer' => true, |
||
| 18 | 'unIgnorePlayer' => true, |
||
| 19 | ]; |
||
| 20 | |||
| 21 | protected $subjectPlayerId = 0; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Loading page data from page params |
||
| 25 | */ |
||
| 26 | public function loadParams() { |
||
| 27 | $this->subjectPlayerId = sys_get_param_id('subjectId', 0); |
||
| 28 | } |
||
| 29 | |||
| 30 | // Page Actions ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
| 31 | public function ignorePlayer() { |
||
| 32 | global $user; |
||
| 33 | |||
| 34 | SN::$gc->ignores->ignore($user['id'], $this->subjectPlayerId); |
||
| 35 | |||
| 36 | return [ |
||
| 37 | 'player' => [ |
||
| 38 | 'id' => $user['id'], |
||
| 39 | 'ignores' => [ |
||
| 40 | $this->subjectPlayerId => true, |
||
| 41 | ], |
||
| 42 | ], |
||
| 43 | ]; |
||
| 44 | } |
||
| 45 | |||
| 46 | public function unIgnorePlayer() { |
||
| 56 | ], |
||
| 57 | ], |
||
| 58 | ]; |
||
| 62 |