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);
62 return array(
'label' => max(0,$notes->getCount()-1));
64 return array(
'label' => ($user?$user->getUsername():
'—') .
'<br />' . ($headNote?strftime(
Config::getVar(
'general',
'datetime_format_short'), strtotime($headNote->getDateCreated())):
''));
66 $latestReply = $notes->next();
67 if ($latestReply && $latestReply->getId() != $headNote->getId()) {
68 $repliedUser = $latestReply->getUser();
69 return array(
'label' => ($repliedUser?$repliedUser->getUsername():
'—') .
'<br />' . strftime(
Config::getVar(
'general',
'datetime_format_short'), strtotime($latestReply->getDateCreated())));
71 return array(
'label' =>
'-');
75 'selected' => $element->getIsClosed(),
76 'disabled' => !$this->_queriesAccessHelper->getCanOpenClose($element),
79 return parent::getTemplateVarsFromRowColumn($row, $column);
85 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
86 import(
'lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
87 import(
'lib.pkp.classes.linkAction.request.AjaxAction');
89 $element = $row->getData();
90 $router = $request->getRouter();
92 switch ($column->getId()) {
94 if ($this->_queriesAccessHelper->getCanOpenClose($element)) {
95 $enabled = !$element->getIsClosed();
98 'close-' . $row->getId(),
99 new AjaxAction($router->url($request,
null,
null,
'closeQuery',
null, $actionArgs)),
104 'open-' . $row->getId(),
105 new AjaxAction($router->url($request,
null,
null,
'openQuery',
null, $actionArgs)),
112 return parent::getCellActions($request, $row, $column, $position);
122 'submissionId' => $this->_submission->getId(),
123 'stageId' => $this->_stageId,
124 'queryId' => $row->getId(),