Open Monograph Press  3.3.0
ChapterGridCategoryRowCellProvider.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridCellProvider');
17 
19 
21 
25  function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
26  if ($column->getId() =='name' && !$row->isReadOnly()) {
27  $chapter = $row->getData();
28  $monograph = $row->getMonograph();
29  $publication = $row->getPublication();
30 
31  $router = $request->getRouter();
32  $actionArgs = array(
33  'submissionId' => $monograph->getId(),
34  'publicationId' => $publication->getId(),
35  'chapterId' => $chapter->getId()
36  );
37 
38  return array(new LinkAction(
39  'editChapter',
40  new AjaxModal(
41  $router->url($request, null, null, 'editChapter', null, $actionArgs),
42  __('submission.chapter.editChapter'),
43  'modal_edit'
44  ),
45  htmlspecialchars($chapter->getLocalizedTitle())
46  )
47  );
48  }
49  return parent::getCellActions($request, $row, $column, $position);
50  }
51 
55  function getTemplateVarsFromRowColumn($row, $column) {
56  // If row is not read only, the cell will contains a link
57  // action. See getCellActions() above.
58  if ($column->getId() == 'name' && $row->isReadOnly()) {
59  $chapter = $row->getData();
60  $label = $chapter->getLocalizedTitle();
61  } else {
62  $label = '';
63  }
64 
65  return array('label' => $label);
66  }
67 }
68 
69 
ChapterGridCategoryRowCellProvider
Chapter grid category rows cell provider.
Definition: ChapterGridCategoryRowCellProvider.inc.php:18
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
ChapterGridCategoryRowCellProvider\$_readOnly
$_readOnly
Definition: ChapterGridCategoryRowCellProvider.inc.php:20
GridCellProvider
Base class for a grid column's cell provider.
Definition: GridCellProvider.inc.php:20
ChapterGridCategoryRowCellProvider\getTemplateVarsFromRowColumn
getTemplateVarsFromRowColumn($row, $column)
Definition: ChapterGridCategoryRowCellProvider.inc.php:55
ChapterGridCategoryRowCellProvider\getCellActions
getCellActions($request, $row, $column, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: ChapterGridCategoryRowCellProvider.inc.php:25