Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
GridRow.inc.php
1 <?php
2 
20 define('GRID_ACTION_POSITION_ROW_CLICK', 'row-click');
21 define('GRID_ACTION_POSITION_ROW_LEFT', 'row-left');
22 
23 import('lib.pkp.classes.controllers.grid.GridBodyElement');
24 
25 class GridRow extends GridBodyElement {
26 
28  var $_requestArgs;
29 
31  var $_gridId;
32 
34  var $_data;
35 
38 
41 
47  var $_actions = array(GRID_ACTION_POSITION_DEFAULT => array());
48 
50  var $_template;
51 
52 
56  function GridRow() {
57  parent::GridBodyElement();
58 
59  $this->_isModified = false;
60  }
61 
62 
63  //
64  // Getters/Setters
65  //
70  function setGridId($gridId) {
71  $this->_gridId = $gridId;
72  }
73 
78  function getGridId() {
79  return $this->_gridId;
80  }
81 
87  function setRequestArgs($requestArgs) {
88  $this->_requestArgs = $requestArgs;
89  }
90 
96  function getRequestArgs() {
97  return $this->_requestArgs;
98  }
99 
104  function setData(&$data) {
105  $this->_data =& $data;
106  }
107 
112  function &getData() {
113  return $this->_data;
114  }
115 
120  function setIsModified($isModified) {
121  $this->_isModified = $isModified;
122  }
123 
128  function getIsModified() {
129  return $this->_isModified;
130  }
131 
136  function setNoActionMessage($message) {
137  $this->_noActionMessage = $message;
138  }
139 
144  function getNoActionMessage() {
146  }
147 
152  function hasActions() {
153  $allActions = array();
154  foreach($this->_actions as $actions) {
155  $allActions = array_merge($allActions, $actions);
156  }
158  return !empty($allActions);
159  }
160 
166  function getActions($position = GRID_ACTION_POSITION_DEFAULT) {
167  if(!isset($this->_actions[$position])) return array();
168  return $this->_actions[$position];
169  }
170 
176  function addAction($action, $position = GRID_ACTION_POSITION_DEFAULT) {
177  if (!isset($this->_actions[$position])) $this->_actions[$position] = array();
178  $this->_actions[$position][$action->getId()] = $action;
179  }
180 
186  function getTemplate() {
188  }
189 
194  function setTemplate($template) {
195  $this->_template = $template;
196  }
198  //
199  // Public methods
200  //
209  function initialize($request, $template = null) {
210  if ($template === null) $template = 'controllers/grid/gridRow.tpl';
211  // Set the template.
212  $this->setTemplate($template);
213  }
214 }
216 ?>
getActions($position=GRID_ACTION_POSITION_DEFAULT)
initialize($request, $template=null)
$_noActionMessage
Definition: GridRow.inc.php:55
setTemplate($template)
setData(&$data)
setGridId($gridId)
Definition: GridRow.inc.php:91
setNoActionMessage($message)
& getData()
Class defining basic operations for handling HTML gridRows.
Definition: GridRow.inc.php:25
getRequestArgs()
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
setRequestArgs($requestArgs)
setIsModified($isModified)
Base class for grid body elements.
getIsModified()
getNoActionMessage()