Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
DataObjectGridCellProvider.inc.php
1 <?php
2 
20 import('lib.pkp.classes.controllers.grid.GridCellProvider');
21 
24  var $_locale = null;
25 
29  function DataObjectGridCellProvider() {
30  parent::GridCellProvider();
31  }
32 
33  //
34  // Setters and Getters
35  //
40  function setLocale($locale) {
41  $this->_locale = $locale;
42  }
43 
48  function getLocale() {
49  return $this->_locale;
50  }
51 
52 
53  //
54  // Template methods from GridCellProvider
55  //
65  function getTemplateVarsFromRowColumn($row, $column) {
66  $element = $row->getData();
67  $columnId = $column->getId();
68  assert(is_a($element, 'DataObject') && !empty($columnId));
69 
70  $data = $element->getData($columnId);
71  // For localized fields, $data will be an array; otherwise,
72  // it will be a value suitable for conversion to string.
73  // If it's localized, fetch the value in the current locale.
74  if (is_array($data)) $data=$data[$this->getLocale()];
75 
76  return array('label' => $data);
77  }
78 }
79 
80 ?>
Base class for a grid column&#39;s cell provider.
Base class for a cell provider that can retrieve simple labels from DataObjects. If you need more com...