|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Edit donors page controller class file |
|
4
|
|
|
* |
|
5
|
|
|
* @package EBloodBank |
|
6
|
|
|
* @subpackage Controllers |
|
7
|
|
|
* @since 1.0 |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace EBloodBank\Controllers; |
|
10
|
|
|
|
|
11
|
|
|
use EBloodBank\Notices; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Edit donors page controller class |
|
15
|
|
|
* |
|
16
|
|
|
* @since 1.0 |
|
17
|
|
|
*/ |
|
18
|
|
|
class EditDonors extends ViewDonors |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* @return void |
|
22
|
|
|
* @since 1.0 |
|
23
|
|
|
*/ |
|
24
|
|
|
public function __invoke() |
|
25
|
|
|
{ |
|
26
|
|
|
if ($this->hasAuthenticatedUser() && $this->getAcl()->isUserAllowed($this->getAuthenticatedUser(), 'Donor', 'edit')) { |
|
27
|
|
|
$this->doActions(); |
|
28
|
|
|
$this->addNotices(); |
|
29
|
|
|
$view = $this->viewFactory->forgeView('edit-donors', [ |
|
30
|
|
|
'donors' => $this->getQueriedDonors(), |
|
31
|
|
|
'pagination.total' => $this->getPagesTotal(), |
|
32
|
|
|
'pagination.current' => $this->getCurrentPage(), |
|
33
|
|
|
'filter.criteria' => $this->getFilterCriteria(), |
|
34
|
|
|
'cityRepository' => $this->getCityRepository(), |
|
35
|
|
|
'districtRepository' => $this->getDistrictRepository(), |
|
36
|
|
|
]); |
|
37
|
|
|
} else { |
|
38
|
|
|
$view = $this->viewFactory->forgeView('error-403'); |
|
39
|
|
|
} |
|
40
|
|
|
$view(); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return void |
|
45
|
|
|
* @since 1.0 |
|
46
|
|
|
*/ |
|
47
|
|
|
protected function doActions() |
|
48
|
|
|
{ |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return void |
|
53
|
|
|
* @since 1.0 |
|
54
|
|
|
*/ |
|
55
|
|
|
protected function addNotices() |
|
56
|
|
|
{ |
|
57
|
|
|
if (filter_has_var(INPUT_GET, 'flag-approved')) { |
|
58
|
|
|
$approved = (int) filter_input(INPUT_GET, 'flag-approved'); |
|
59
|
|
|
Notices::addNotice('approved', sprintf(n__('%d donor approved.', '%d donors approved.', $approved), $approved), 'success'); |
|
60
|
|
|
} |
|
61
|
|
|
if (filter_has_var(INPUT_GET, 'flag-deleted')) { |
|
62
|
|
|
$deleted = (int) filter_input(INPUT_GET, 'flag-deleted'); |
|
63
|
|
|
Notices::addNotice('deleted', sprintf(n__('%d donor permanently deleted.', '%d donors permanently deleted.', $deleted), $deleted), 'success'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|