Open Journal Systems  3.3.0
PluginGalleryGridCellProvider.inc.php
1 <?php
15 import('lib.pkp.classes.controllers.grid.GridCellProvider');
16 import('lib.pkp.classes.linkAction.request.AjaxModal');
17 
19 
27  function getTemplateVarsFromRowColumn($row, $column) {
28  $element = $row->getData();
29  $columnId = $column->getId();
30  assert(is_a($element, 'GalleryPlugin') && !empty($columnId));
31  switch ($columnId) {
32  case 'name':
33  // The name is returned as an action.
34  return array('label' => '');
35  break;
36  case 'summary':
37  $label = $element->getLocalizedSummary();
38  return array('label' => $label);
39  break;
40  case 'status':
41  switch ($element->getCurrentStatus()) {
42  case PLUGIN_GALLERY_STATE_NEWER:
43  $statusKey = 'manager.plugins.installedVersionNewer.short';
44  break;
45  case PLUGIN_GALLERY_STATE_UPGRADABLE:
46  $statusKey = 'manager.plugins.installedVersionOlder.short';
47  break;
48  case PLUGIN_GALLERY_STATE_CURRENT:
49  $statusKey = 'manager.plugins.installedVersionNewest.short';
50  break;
51  case PLUGIN_GALLERY_STATE_AVAILABLE:
52  $statusKey = null;
53  break;
54  case PLUGIN_GALLERY_STATE_INCOMPATIBLE:
55  $statusKey = 'manager.plugins.noCompatibleVersion.short';
56  break;
57  default: return assert(false);
58  }
59  return array('label' => __($statusKey));
60  default:
61  break;
62  }
63  }
64 
71  function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
72  $element = $row->getData();
73  switch ($column->getId()) {
74  case 'name':
75  $router = $request->getRouter();
76  return array(new LinkAction(
77  'moreInformation',
78  new AjaxModal(
79  $router->url($request, null, null, 'viewPlugin', null, array('rowId' => $row->getId()+1)),
80  htmlspecialchars($element->getLocalizedName()),
81  'modal_information',
82  true
83  ),
84  htmlspecialchars($element->getLocalizedName()),
85  'details'
86  ));
87  }
88  return parent::getCellActions($request, $row, $column, $position);
89  }
90 }
91 
92 
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
GridCellProvider
Base class for a grid column's cell provider.
Definition: GridCellProvider.inc.php:20
PluginGalleryGridCellProvider
Provide information about plugins to the plugin gallery grid handler.
Definition: PluginGalleryGridCellProvider.inc.php:18
PluginGalleryGridCellProvider\getCellActions
getCellActions($request, $row, $column, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: PluginGalleryGridCellProvider.inc.php:71
PluginGalleryGridCellProvider\getTemplateVarsFromRowColumn
getTemplateVarsFromRowColumn($row, $column)
Definition: PluginGalleryGridCellProvider.inc.php:27