Open Monograph Press  3.3.0
SpotlightsGridRow.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridRow');
17 
18 class SpotlightsGridRow extends GridRow {
20  var $_press;
21 
26  function __construct($press) {
27  $this->setPress($press);
28  parent::__construct();
29  }
30 
31  //
32  // Overridden methods from GridRow
33  //
37  function initialize($request, $template = null) {
38  // Do the default initialization
39  parent::initialize($request, $template);
40 
41  $press = $this->getPress();
42 
43  // Is this a new row or an existing row?
44  $spotlight = $this->_data;
45  if ($spotlight != null && is_numeric($spotlight->getId())) {
46  $router = $request->getRouter();
47  $actionArgs = array(
48  'pressId' => $press->getId(),
49  'spotlightId' => $spotlight->getId()
50  );
51 
52  // Add row-level actions
53  import('lib.pkp.classes.linkAction.request.AjaxModal');
54  $this->addAction(
55  new LinkAction(
56  'editSpotlight',
57  new AjaxModal(
58  $router->url($request, null, null, 'editSpotlight', null, $actionArgs),
59  __('grid.action.edit'),
60  'modal_edit'
61  ),
62  __('grid.action.edit'),
63  'edit'
64  )
65  );
66 
67  import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
68  $this->addAction(
69  new LinkAction(
70  'deleteSpotlight',
72  $request->getSession(),
73  __('common.confirmDelete'),
74  __('common.delete'),
75  $router->url($request, null, null, 'deleteSpotlight', null, $actionArgs),
76  'modal_delete'
77  ),
78  __('grid.action.delete'),
79  'delete'
80  )
81  );
82  }
83  }
84 
89  function getPress() {
90  return $this->_press;
91  }
92 
97  function setPress($press) {
98  $this->_press = $press;
99  }
100 }
101 
SpotlightsGridRow\getPress
getPress()
Definition: SpotlightsGridRow.inc.php:92
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
GridRow\addAction
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: GridRow.inc.php:179
SpotlightsGridRow\setPress
setPress($press)
Definition: SpotlightsGridRow.inc.php:100
SpotlightsGridRow\__construct
__construct($press)
Definition: SpotlightsGridRow.inc.php:29
SpotlightsGridRow
Spotlights grid row definition.
Definition: SpotlightsGridRow.inc.php:18
SpotlightsGridRow\$_press
$_press
Definition: SpotlightsGridRow.inc.php:23
SpotlightsGridRow\initialize
initialize($request, $template=null)
Definition: SpotlightsGridRow.inc.php:40
GridRow
GridRow implements a row of a Grid. See GridHandler for general information about grids.
Definition: GridRow.inc.php:29
AjaxModal
A modal that retrieves its content from via AJAX.
Definition: AjaxModal.inc.php:18
LinkAction
Base class defining an action that can be performed by the user in the user interface.
Definition: LinkAction.inc.php:22
GridRow\$_data
$_data
Definition: GridRow.inc.php:47