Open Journal Systems  3.3.0
QueryNotesGridRow.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridRow');
17 
18 class QueryNotesGridRow extends GridRow {
20  var $_actionArgs;
21 
23  var $_query;
24 
26  var $_queryNotesGrid;
27 
34  function __construct($actionArgs, $query, $queryNotesGrid) {
35  $this->_actionArgs = $actionArgs;
36  $this->_query = $query;
37  $this->_queryNotesGrid = $queryNotesGrid;
38 
39  parent::__construct();
40  }
41 
42  //
43  // Overridden methods from GridRow
44  //
48  function initialize($request, $template = null) {
49  // Do the default initialization
50  parent::initialize($request, $template);
51 
52  // Is this a new row or an existing row?
53  $rowId = $this->getId();
54  $headNote = $this->getQuery()->getHeadNote();
55  if (!empty($rowId) && is_numeric($rowId) && (!$headNote || $headNote->getId() != $rowId)) {
56  // Only add row actions if this is an existing row
57  $router = $request->getRouter();
58  $actionArgs = array_merge(
59  $this->_actionArgs,
60  array('noteId' => $rowId)
61  );
62 
63  // Add row-level actions
64  if ($this->_queryNotesGrid->getCanManage($this->getData())) {
65  import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
66  $this->addAction(
67  new LinkAction(
68  'deleteNote',
70  $request->getSession(),
71  __('common.confirmDelete'),
72  __('grid.action.delete'),
73  $router->url($request, null, null, 'deleteNote', null, $actionArgs), 'modal_delete'),
74  __('grid.action.delete'),
75  'delete')
76  );
77  }
78  }
79  }
80 
85  function getQuery() {
86  return $this->_query;
87  }
88 
93  function getRequestArgs() {
95  }
96 }
97 
98 
GridRow\__construct
__construct()
Definition: GridRow.inc.php:75
RemoteActionConfirmationModal
Class defining a simple confirmation modal with a remote action and ok/cancel buttons.
Definition: RemoteActionConfirmationModal.inc.php:18
QueryNotesGridRow\$_query
$_query
Definition: QueryNotesGridRow.inc.php:29
QueryNotesGridRow\__construct
__construct($actionArgs, $query, $queryNotesGrid)
Definition: QueryNotesGridRow.inc.php:43
GridRow\addAction
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: GridRow.inc.php:179
QueryNotesGridRow\$_actionArgs
$_actionArgs
Definition: QueryNotesGridRow.inc.php:23
QueryNotesGridRow\getQuery
getQuery()
Definition: QueryNotesGridRow.inc.php:94
GridBodyElement\getId
getId()
Definition: GridBodyElement.inc.php:57
QueryNotesGridRow\getRequestArgs
getRequestArgs()
Definition: QueryNotesGridRow.inc.php:102
GridRow
GridRow implements a row of a Grid. See GridHandler for general information about grids.
Definition: GridRow.inc.php:29
LinkAction
Base class defining an action that can be performed by the user in the user interface.
Definition: LinkAction.inc.php:22
QueryNotesGridRow\initialize
initialize($request, $template=null)
Definition: QueryNotesGridRow.inc.php:57
QueryNotesGridRow
Base class for query grid row definition.
Definition: QueryNotesGridRow.inc.php:18
QueryNotesGridRow\$_queryNotesGrid
$_queryNotesGrid
Definition: QueryNotesGridRow.inc.php:35