Open Journal Systems  3.3.0
GridRow.inc.php
1 <?php
2 
24 define('GRID_ACTION_POSITION_ROW_CLICK', 'row-click');
25 define('GRID_ACTION_POSITION_ROW_LEFT', 'row-left');
26 
27 import('lib.pkp.classes.controllers.grid.GridBodyElement');
28 
29 class GridRow extends GridBodyElement {
30 
32  var $_requestArgs;
33 
35  var $_gridId;
36 
38  var $_data;
39 
42 
48  var $_actions = array(GRID_ACTION_POSITION_DEFAULT => array());
49 
51  var $_template;
52 
53 
57  function __construct() {
58  parent::__construct();
59 
60  $this->_isModified = false;
61  }
62 
63 
64  //
65  // Getters/Setters
66  //
71  function setGridId($gridId) {
72  $this->_gridId = $gridId;
73  }
74 
79  function getGridId() {
80  return $this->_gridId;
81  }
82 
88  function setRequestArgs($requestArgs) {
89  $this->_requestArgs = $requestArgs;
90  }
91 
97  function getRequestArgs() {
98  return $this->_requestArgs;
99  }
100 
105  function setData(&$data) {
106  $this->_data =& $data;
107  }
108 
113  function &getData() {
114  return $this->_data;
115  }
116 
121  function setIsModified($isModified) {
122  $this->_isModified = $isModified;
123  }
124 
129  function getIsModified() {
130  return $this->_isModified;
131  }
132 
137  function hasActions() {
138  $allActions = array();
139  foreach($this->_actions as $actions) {
140  $allActions = array_merge($allActions, $actions);
141  }
142 
143  return !empty($allActions);
144  }
145 
151  function getActions($position = GRID_ACTION_POSITION_DEFAULT) {
152  if(!isset($this->_actions[$position])) return array();
153  return $this->_actions[$position];
154  }
155 
161  function addAction($action, $position = GRID_ACTION_POSITION_DEFAULT) {
162  if (!isset($this->_actions[$position])) $this->_actions[$position] = array();
163  $this->_actions[$position][$action->getId()] = $action;
164  }
165 
171  function getTemplate() {
172  return $this->_template;
173  }
174 
179  function setTemplate($template) {
180  $this->_template = $template;
181  }
182 
183  //
184  // Public methods
185  //
194  function initialize($request, $template = null) {
195  if ($template === null) $template = 'controllers/grid/gridRow.tpl';
196  // Set the template.
197  $this->setTemplate($template);
198  }
199 }
200 
201 
GridRow\__construct
__construct()
Definition: GridRow.inc.php:75
GridRow\setRequestArgs
setRequestArgs($requestArgs)
Definition: GridRow.inc.php:106
GridRow\addAction
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Definition: GridRow.inc.php:179
GridRow\getTemplate
getTemplate()
Definition: GridRow.inc.php:189
GridRow\$_isModified
$_isModified
Definition: GridRow.inc.php:53
GridRow\$_template
$_template
Definition: GridRow.inc.php:69
GridRow\setData
setData(&$data)
Definition: GridRow.inc.php:123
GridRow\setIsModified
setIsModified($isModified)
Definition: GridRow.inc.php:139
GridRow\hasActions
hasActions()
Definition: GridRow.inc.php:155
GridRow\getGridId
getGridId()
Definition: GridRow.inc.php:97
GridRow\getIsModified
getIsModified()
Definition: GridRow.inc.php:147
GridRow\initialize
initialize($request, $template=null)
Definition: GridRow.inc.php:212
GridRow\$_requestArgs
$_requestArgs
Definition: GridRow.inc.php:35
GridRow
GridRow implements a row of a Grid. See GridHandler for general information about grids.
Definition: GridRow.inc.php:29
GridRow\$_gridId
$_gridId
Definition: GridRow.inc.php:41
GridRow\getRequestArgs
getRequestArgs()
Definition: GridRow.inc.php:115
GridRow\setTemplate
setTemplate($template)
Definition: GridRow.inc.php:197
GridRow\$_data
$_data
Definition: GridRow.inc.php:47
GridRow\setGridId
setGridId($gridId)
Definition: GridRow.inc.php:89
GridRow\getActions
getActions($position=GRID_ACTION_POSITION_DEFAULT)
Definition: GridRow.inc.php:169
GridRow\$_actions
$_actions
Definition: GridRow.inc.php:63
GridBodyElement
Base class for grid body elements.
Definition: GridBodyElement.inc.php:16
GridRow\getData
& getData()
Definition: GridRow.inc.php:131