Open Monograph Press  3.3.0
CustomLocaleGridCellProvider.inc.php
1 <?php
2 
12 import('lib.pkp.classes.controllers.grid.GridCellProvider');
13 import('lib.pkp.classes.linkAction.request.RedirectAction');
14 
16 
25  function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
26  $customLocale = $row->getData();
27  import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
28  import('lib.pkp.classes.linkAction.request.AjaxAction');
29  import('lib.pkp.classes.linkAction.request.AjaxModal');
30  switch ($column->getId()) {
31  case 'path':
32  $dispatcher = $request->getDispatcher();
33  $router = $request->getRouter();
34 
35  return array(new LinkAction(
36  'edit',
37  new AjaxAction(
38  $router->url($request, null, null, 'edit', null, array('localeKey' => $customLocale->getPath()))
39  ),
40  'edit',
41  null
42  ));
43 
44  case 'filepath':
45  $dispatcher = $request->getDispatcher();
46  $router = $request->getRouter();
47 
48  return array(new LinkAction(
49  'edit',
50  new AjaxModal(
51  $router->url($request, null, null, 'editLocaleFile', null, array('locale'=>$customLocale->getLocale(),'filePath' => $customLocale->getFilePath())),
52  __('grid.action.edit'),
53  'modal_edit',
54  true
55  ),
56  __('common.edit'),
57  null
58  ));
59  }
60  return parent::getCellActions($request, $row, $column, $position);
61  }
62 
70  function getTemplateVarsFromRowColumn($row, $column) {
71  $customLocale = $row->getData();
72 
73  switch ($column->getId()) {
74  case 'path':
75  // The action has the label
76  return array('label' => '');
77  case 'filepath':
78  // The action has the label
79  return array('label' => '');
80  case 'title':
81  return array('label' => $customLocale->getLocalizedTitle());
82  case 'filetitle':
83  return array('label' => $customLocale->getFileTitle());
84  case 'key':
85  return array('label' => $customLocale->getKey());
86  }
87  return parent::getTemplateVarsFromColumn($row, $column);
88  }
89 }
90 
AjaxAction
Class defining an AJAX action.
Definition: AjaxAction.inc.php:21
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
CustomLocaleGridCellProvider
Definition: CustomLocaleGridCellProvider.inc.php:15
GridCellProvider
Base class for a grid column's cell provider.
Definition: GridCellProvider.inc.php:20
CustomLocaleGridCellProvider\getCellActions
getCellActions($request, $row, $column, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: CustomLocaleGridCellProvider.inc.php:25
CustomLocaleGridCellProvider\getTemplateVarsFromRowColumn
getTemplateVarsFromRowColumn($row, $column)
Definition: CustomLocaleGridCellProvider.inc.php:70