Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
GridCellProvider.inc.php
1 <?php
2 
21  function GridCellProvider() {
22  }
23 
24  //
25  // Public methods
26  //
27 
36  function render($request, $row, $column) {
37  $columnId = $column->getId();
38  assert(!empty($columnId));
39 
40  // Construct a default cell id (null for "nonexistent" new rows)
41  $rowId = $row->getId(); // Potentially null (indicating row not backed in the DB)
42  $cellId = isset($rowId)?$rowId.'-'.$columnId:null;
43 
44  // Assign values extracted from the element for the cell.
45  $templateMgr = TemplateManager::getManager($request);
46  $templateVars = $this->getTemplateVarsFromRowColumn($row, $column);
47  foreach ($templateVars as $varName => $varValue) {
48  $templateMgr->assign($varName, $varValue);
49  }
50  $templateMgr->assign('id', $cellId);
51  $templateMgr->assign('column', $column);
52  $templateMgr->assign('actions', $this->getCellActions($request, $row, $column));
53  $templateMgr->assign('flags', $column->getFlags());
54  $templateMgr->assign('formLocales', AppLocale::getSupportedFormLocales());
55  $template = $column->getTemplate();
56  assert(!empty($template));
57  return $templateMgr->fetch($template);
58  }
59 
60  //
61  // Protected template methods
62  //
71  function getTemplateVarsFromRowColumn($row, $column) {
72  return array();
73  }
74 
90  function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
91  return $column->getCellActions($request, $row, $position);
92  }
93 }
94 
95 ?>
Base class for a grid column&#39;s cell provider.
getCellActions($request, $row, $column, $position=GRID_ACTION_POSITION_DEFAULT)
render($request, $row, $column)
static getSupportedFormLocales()
getTemplateVarsFromRowColumn($row, $column)