Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
CategoryGridRow.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridRow');
17 
18 class CategoryGridRow extends GridRow {
22  function CategoryGridRow() {
23  parent::GridRow();
24  }
25 
26  //
27  // Overridden methods from GridRow
28  //
32  function initialize($request) {
33  parent::initialize($request);
34 
35  $rowData = $this->getData(); // a Category object
36  assert($rowData != null);
37 
38  $rowId = $this->getId();
39 
40  // Only add row actions if this is an existing row.
41  if (!empty($rowId) && is_numeric($rowId)) {
42  $actionArgs = array_merge(
43  $this->getRequestArgs(),
44  array('categoryId' => $rowData->getId())
45  );
46  $router = $request->getRouter();
47 
48  $this->addAction(new LinkAction(
49  'editCategory',
50  new AjaxModal(
51  $router->url($request, null, null, 'editCategory', null, $actionArgs),
52  __('grid.category.edit')
53  ),
54  __('grid.action.edit'),
55  'edit'
56  ));
57 
58  import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
59  $confirmationModal = new RemoteActionConfirmationModal(
60  __('grid.category.removeText'),
61  null,
62  $router->url($request, null, null, 'deleteCategory', null, $actionArgs)
63  );
64  $removeCategoryLinkAction = new LinkAction(
65  'removeCategory',
66  $confirmationModal,
67  __('grid.action.remove'),
68  'delete'
69  );
70  $this->addAction($removeCategoryLinkAction);
71  }
72  }
73 }
74 
75 ?>
A modal that retrieves its content from via AJAX.
& getData()
Class defining basic operations for handling HTML gridRows.
Definition: GridRow.inc.php:25
getRequestArgs()
Category grid row definition.
Class defining a simple confirmation modal with a remote action and ok/cancel buttons.
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Base class defining an action that can be performed by the user in the user interface.