Open Journal Systems  3.3.0
PaymentsGridHandler.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridHandler');
17 
18 import('controllers.grid.subscriptions.PaymentsGridCellProvider');
19 
21 
25  function __construct() {
26  parent::__construct();
27  $this->addRoleAssignment(array(
28  ROLE_ID_MANAGER, ROLE_ID_SUBSCRIPTION_MANAGER),
29  array('fetchGrid', 'fetchRow', 'viewPayment')
30  );
31  }
32 
33 
34  //
35  // Implement template methods from PKPHandler.
36  //
40  function authorize($request, &$args, $roleAssignments) {
41  import('lib.pkp.classes.security.authorization.ContextAccessPolicy');
42  $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments));
43  return parent::authorize($request, $args, $roleAssignments);
44  }
45 
49  function initialize($request, $args = null) {
50  parent::initialize($request, $args);
51 
52  // Load user-related translations.
54  LOCALE_COMPONENT_APP_MANAGER,
55  LOCALE_COMPONENT_PKP_MANAGER,
56  LOCALE_COMPONENT_PKP_USER
57  );
58 
59  // Grid actions.
60  $router = $request->getRouter();
61 
62  //
63  // Grid columns.
64  //
65  $cellProvider = new PaymentsGridCellProvider($request);
66 
67  $this->addColumn(
68  new GridColumn(
69  'name',
70  'common.user',
71  null,
72  null,
73  $cellProvider
74  )
75  );
76  $this->addColumn(
77  new GridColumn(
78  'type',
79  'manager.payment.paymentType',
80  null,
81  null,
82  $cellProvider
83  )
84  );
85  $this->addColumn(
86  new GridColumn(
87  'amount',
88  'manager.payment.amount',
89  null,
90  null,
91  $cellProvider
92  )
93  );
94  $this->addColumn(
95  new GridColumn(
96  'timestamp',
97  'manager.payment.timestamp',
98  null,
99  null,
100  $cellProvider
101  )
102  );
103  }
104 
105 
109  function initFeatures($request, $args) {
110  import('lib.pkp.classes.controllers.grid.feature.PagingFeature');
111  return array(new PagingFeature());
112  }
113 
114 
118  protected function loadData($request, $filter) {
119  $paymentDao = DAORegistry::getDAO('OJSCompletedPaymentDAO'); /* @var $paymentDao OJSCompletedPaymentDAO */
120  $rangeInfo = $this->getGridRangeInfo($request, $this->getId());
121  return $paymentDao->getByContextId($request->getContext()->getId(), $rangeInfo);
122  }
123 
124  //
125  // Public grid actions.
126  //
132  function viewPayment($args, $request) {
133  // FIXME
134  }
135 }
136 
137 ?>
138 
PKPHandler\addRoleAssignment
addRoleAssignment($roleIds, $operations)
Definition: PKPHandler.inc.php:213
GridColumn
The GridColumn class represents a column within a grid. It is used to format the data presented in a ...
Definition: GridColumn.inc.php:27
AppLocale\requireComponents
static requireComponents()
Definition: env1/MockAppLocale.inc.php:56
ContextAccessPolicy
Class to control access to PKP applications' setup components.
Definition: ContextAccessPolicy.inc.php:17
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
PaymentsGridHandler
Handle payment grid requests.
Definition: PaymentsGridHandler.inc.php:20
PaymentsGridHandler\__construct
__construct()
Definition: PaymentsGridHandler.inc.php:25
PKPHandler\getId
getId()
Definition: PKPHandler.inc.php:107
GridHandler\addColumn
addColumn($column)
Definition: GridHandler.inc.php:335
PaymentsGridHandler\loadData
loadData($request, $filter)
Definition: PaymentsGridHandler.inc.php:118
PaymentsGridHandler\authorize
authorize($request, &$args, $roleAssignments)
Definition: PaymentsGridHandler.inc.php:40
PaymentsGridHandler\initialize
initialize($request, $args=null)
Definition: PaymentsGridHandler.inc.php:49
PaymentsGridHandler\viewPayment
viewPayment($args, $request)
Definition: PaymentsGridHandler.inc.php:132
PagingFeature
Add paging functionality to grids.
Definition: PagingFeature.inc.php:19
GridHandler\getGridRangeInfo
getGridRangeInfo($request, $rangeName, $contextData=null)
Definition: GridHandler.inc.php:589
GridHandler
This class defines basic operations for handling HTML grids. Grids are used to implement a standardiz...
Definition: GridHandler.inc.php:58
PaymentsGridCellProvider
Class for a cell provider to display information about payments.
Definition: PaymentsGridCellProvider.inc.php:18
PKPHandler\addPolicy
addPolicy($authorizationPolicy, $addToTop=false)
Definition: PKPHandler.inc.php:157
PaymentsGridHandler\initFeatures
initFeatures($request, $args)
Definition: PaymentsGridHandler.inc.php:109