Open Journal Systems  3.3.0
DataObjectGridCellProvider.inc.php
1 <?php
2 
20 import('lib.pkp.classes.controllers.grid.GridCellProvider');
21 
24  var $_locale = null;
25 
26 
27  //
28  // Setters and Getters
29  //
34  function setLocale($locale) {
35  $this->_locale = $locale;
36  }
37 
42  function getLocale() {
43  if (empty($this->_locale)) return AppLocale::getLocale();
44  return $this->_locale;
45  }
46 
47 
48  //
49  // Template methods from GridCellProvider
50  //
60  function getTemplateVarsFromRowColumn($row, $column) {
61  $element = $row->getData();
62  $columnId = $column->getId();
63  assert(is_a($element, 'DataObject') && !empty($columnId));
64 
65  $data = $element->getData($columnId);
66  // For localized fields, $data will be an array; otherwise,
67  // it will be a value suitable for conversion to string.
68  // If it's localized, fetch the value in the current locale.
69  if (is_array($data)) {
70  $data = $element->getLocalizedData($columnId);
71  }
72 
73  return array('label' => $data);
74  }
75 }
76 
77 
DataObjectGridCellProvider\$_locale
$_locale
Definition: DataObjectGridCellProvider.inc.php:27
GridCellProvider
Base class for a grid column's cell provider.
Definition: GridCellProvider.inc.php:20
DataObjectGridCellProvider
Base class for a cell provider that can retrieve simple labels from DataObjects. If you need more com...
Definition: DataObjectGridCellProvider.inc.php:22
DataObjectGridCellProvider\getLocale
getLocale()
Definition: DataObjectGridCellProvider.inc.php:45
AppLocale\getLocale
static getLocale()
Definition: env1/MockAppLocale.inc.php:40
DataObjectGridCellProvider\getTemplateVarsFromRowColumn
getTemplateVarsFromRowColumn($row, $column)
Definition: DataObjectGridCellProvider.inc.php:63
DataObjectGridCellProvider\setLocale
setLocale($locale)
Definition: DataObjectGridCellProvider.inc.php:37