16 import(
'lib.pkp.classes.controllers.grid.DataObjectGridCellProvider');
34 function __construct($submission, $stageId, $queriesAccessHelper) {
35 parent::__construct();
36 $this->_submission = $submission;
37 $this->_stageId = $stageId;
38 $this->_queriesAccessHelper = $queriesAccessHelper;
52 $element = $row->getData();
53 $columnId = $column->getId();
54 assert(is_a($element,
'DataObject') && !empty($columnId));
56 $headNote = $element->getHeadNote();
57 $user = $headNote?$headNote->getUser():
null;
58 $notes = $element->getReplies(
null, NOTE_ORDER_ID, SORT_DIRECTION_DESC);
60 $datetimeFormatShort = $context->getLocalizedDateTimeFormatShort();
64 return array(
'label' => max(0,$notes->getCount()-1));
66 return array(
'label' => ($user?$user->getUsername():
'—') .
'<br />' . ($headNote?strftime($datetimeFormatShort, strtotime($headNote->getDateCreated())):
''));
68 $latestReply = $notes->next();
69 if ($latestReply && $latestReply->getId() != $headNote->getId()) {
70 $repliedUser = $latestReply->getUser();
71 return array(
'label' => ($repliedUser?$repliedUser->getUsername():
'—') .
'<br />' . strftime($datetimeFormatShort, strtotime($latestReply->getDateCreated())));
73 return array(
'label' =>
'-');
77 'selected' => $element->getIsClosed(),
78 'disabled' => !$this->_queriesAccessHelper->getCanOpenClose($element),
81 return parent::getTemplateVarsFromRowColumn($row, $column);
87 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
88 import(
'lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
89 import(
'lib.pkp.classes.linkAction.request.AjaxAction');
91 $element = $row->getData();
92 $router = $request->getRouter();
94 switch ($column->getId()) {
96 if ($this->_queriesAccessHelper->getCanOpenClose($element)) {
97 $enabled = !$element->getIsClosed();
100 'close-' . $row->getId(),
101 new AjaxAction($router->url($request,
null,
null,
'closeQuery',
null, $actionArgs)),
106 'open-' . $row->getId(),
107 new AjaxAction($router->url($request,
null,
null,
'openQuery',
null, $actionArgs)),
114 return parent::getCellActions($request, $row, $column, $position);
124 'submissionId' => $this->_submission->getId(),
125 'stageId' => $this->_stageId,
126 'queryId' => $row->getId(),