Open Monograph Press  3.3.0
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 
28 
30  var $_chapter;
31 
34 
38  function __construct($monograph, $publication, $readOnly = false) {
39  $this->_monograph = $monograph;
40  $this->_publication = $publication;
41  $this->_readOnly = $readOnly;
42  parent::__construct();
43  }
44 
45  //
46  // Overridden methods from GridCategoryRow
47  //
51  function initialize($request, $template = null) {
52  // Do the default initialization
53  parent::initialize($request, $template);
54 
55  // Retrieve the monograph id from the request
56  $monograph = $this->getMonograph();
57 
58  // Is this a new row or an existing row?
59  $chapterId = $this->getId();
60  if (!empty($chapterId) && is_numeric($chapterId)) {
61  $chapter = $this->getData();
62  $this->_chapter = $chapter;
63 
64  // Only add row actions if this is an existing row and the grid is not 'read only'
65  if (!$this->isReadOnly()) {
66  $router = $request->getRouter();
67  $actionArgs = array(
68  'submissionId' => $monograph->getId(),
69  'publicationId' => $this->getPublication()->getId(),
70  'chapterId' => $chapterId
71  );
72 
73  $this->addAction(
74  new LinkAction(
75  'deleteChapter',
77  $request->getSession(),
78  __('common.confirmDelete'),
79  __('common.delete'),
80  $router->url($request, null, null, 'deleteChapter', null, $actionArgs),
81  'modal_delete'
82  ),
83  __('common.delete'),
84  'delete'
85  )
86  );
87  }
88  }
89  }
90 
95  function getMonograph() {
96  return $this->_monograph;
97  }
98 
103  function getPublication() {
104  return $this->_publication;
105  }
106 
111  function getChapter() {
112  return $this->_chapter;
113  }
114 
119  function isReadOnly() {
120  return $this->_readOnly;
121  }
122 }
123 
RemoteActionConfirmationModal
Class defining a simple confirmation modal with a remote action and ok/cancel buttons.
Definition: RemoteActionConfirmationModal.inc.php:18
ChapterGridCategoryRow\getPublication
getPublication()
Definition: ChapterGridCategoryRow.inc.php:115
GridRow\addAction
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: GridRow.inc.php:179
GridBodyElement\getId
getId()
Definition: GridBodyElement.inc.php:57
ChapterGridCategoryRow\__construct
__construct($monograph, $publication, $readOnly=false)
Definition: ChapterGridCategoryRow.inc.php:50
ChapterGridCategoryRow\$_monograph
$_monograph
Definition: ChapterGridCategoryRow.inc.php:27
GridCategoryRow
Class defining basic operations for handling the category row in a grid.
Definition: GridCategoryRow.inc.php:19
GridCategoryRow\__construct
__construct()
Definition: GridCategoryRow.inc.php:29
ChapterGridCategoryRow\$_chapter
$_chapter
Definition: ChapterGridCategoryRow.inc.php:39
ChapterGridCategoryRow\getChapter
getChapter()
Definition: ChapterGridCategoryRow.inc.php:123
LinkAction
Base class defining an action that can be performed by the user in the user interface.
Definition: LinkAction.inc.php:22
ChapterGridCategoryRow
Chapter grid category row definition.
Definition: ChapterGridCategoryRow.inc.php:22
ChapterGridCategoryRow\initialize
initialize($request, $template=null)
Definition: ChapterGridCategoryRow.inc.php:63
ChapterGridCategoryRow\getMonograph
getMonograph()
Definition: ChapterGridCategoryRow.inc.php:107
ChapterGridCategoryRow\$_readOnly
$_readOnly
Definition: ChapterGridCategoryRow.inc.php:45
GridRow\getData
& getData()
Definition: GridRow.inc.php:131
ChapterGridCategoryRow\isReadOnly
isReadOnly()
Definition: ChapterGridCategoryRow.inc.php:131
ChapterGridCategoryRow\$_publication
$_publication
Definition: ChapterGridCategoryRow.inc.php:33