Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ChapterGridCategoryRow.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridCategoryRow');
17 
18 // Link actions
19 import('lib.pkp.classes.linkAction.request.AjaxModal');
20 import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
21 
24  var $_monograph;
25 
27  var $_chapter;
28 
30  var $_readOnly;
31 
35  function ChapterGridCategoryRow(&$monograph, $readOnly = false) {
36  $this->_monograph = $monograph;
37  $this->_readOnly = $readOnly;
38  parent::GridCategoryRow();
39  }
40 
41  //
42  // Overridden methods from GridCategoryRow
43  //
48  function initialize($request) {
49  // Do the default initialization
50  parent::initialize($request);
51 
52  // Retrieve the monograph id from the request
53  $monograph = $this->getMonograph();
54 
55  // Is this a new row or an existing row?
56  $chapterId = $this->getId();
57  if (!empty($chapterId) && is_numeric($chapterId)) {
58  $chapter = $this->getData();
59  $this->_chapter = $chapter;
60 
61  // Only add row actions if this is an existing row and the grid is not 'read only'
62  if (!$this->isReadOnly()) {
63  $router = $request->getRouter();
64  $actionArgs = array(
65  'submissionId' => $monograph->getId(),
66  'chapterId' => $chapterId
67  );
68 
69  $this->addAction(
70  new LinkAction(
71  'deleteChapter',
73  __('common.confirmDelete'),
74  __('common.delete'),
75  $router->url($request, null, null, 'deleteChapter', null, $actionArgs),
76  'modal_delete'
77  ),
78  null,
79  'delete'
80  ), GRID_ACTION_POSITION_ROW_LEFT
81  );
82  }
83 
84  }
85  }
86 
91  function &getMonograph() {
92  return $this->_monograph;
93  }
94 
99  function &getChapter() {
101  }
102 
107  function isReadOnly() {
109  }
110 }
111 ?>
Class defining basic operations for handling the category row in a grid.
Chapter grid category row definition.
& getData()
Class defining a simple confirmation modal with a remote action and ok/cancel buttons.
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
ChapterGridCategoryRow(&$monograph, $readOnly=false)
Base class defining an action that can be performed by the user in the user interface.