[]]; /** @var string the row template */ public $_template; /** * Constructor. */ public function __construct() { parent::__construct(); $this->_isModified = false; } // // Getters/Setters // /** * Set the grid id * * @param string $gridId */ public function setGridId($gridId) { $this->_gridId = $gridId; } /** * Get the grid id * * @return string */ public function getGridId() { return $this->_gridId; } /** * Set the grid request parameters. * * @see GridHandler::getRequestArgs() * * @param array $requestArgs */ public function setRequestArgs($requestArgs) { $this->_requestArgs = $requestArgs; } /** * Get the grid request parameters. * * @see GridHandler::getRequestArgs() * * @return array */ public function getRequestArgs() { return $this->_requestArgs; } /** * Set the data element(s) for this controller * */ public function setData(&$data) { $this->_data = & $data; } /** * Get the data element(s) for this controller */ public function &getData() { return $this->_data; } /** * Set the modified flag for the row * * @param bool $isModified */ public function setIsModified($isModified) { $this->_isModified = $isModified; } /** * Get the modified flag for the row * * @return bool */ public function getIsModified() { return $this->_isModified; } /** * Get whether this row has any actions or not. * * @return bool */ public function hasActions() { $allActions = []; foreach ($this->_actions as $actions) { $allActions = array_merge($allActions, $actions); } return !empty($allActions); } /** * Get all actions for a given position within the controller * * @param string $position the position of the actions * * @return array the LinkActions for the given position */ public function getActions($position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { if (!isset($this->_actions[$position])) { return []; } return $this->_actions[$position]; } /** * Add an action * * @param mixed $action a single action * @param string $position the position of the action */ public function addAction($action, $position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { if (!isset($this->_actions[$position])) { $this->_actions[$position] = []; } $this->_actions[$position][$action->getId()] = $action; } /** * Get the row template - override base * implementation to provide a sensible default. * * @return string */ public function getTemplate() { return $this->_template; } /** * Set the controller template * * @param string $template */ public function setTemplate($template) { $this->_template = $template; } // // Public methods // /** * Initialize a row instance. * * Subclasses can override this method. * * @param PKPRequest $request * @param string $template */ public function initialize($request, $template = null) { if ($template === null) { $template = 'controllers/grid/gridRow.tpl'; } // Set the template. $this->setTemplate($template); } } if (!PKP_STRICT_MODE) { class_alias('\PKP\controllers\grid\GridRow', '\GridRow'); foreach ([ 'GRID_ACTION_POSITION_ROW_CLICK', 'GRID_ACTION_POSITION_ROW_LEFT', ] as $constantName) { define($constantName, constant('\GridRow::' . $constantName)); } }