getCellActions() public method

NB: The default implementation delegates to the grid column for cell-specific actions. Another thinkable implementation would be row-specific actions in which case action instantiation should be delegated to the row.
public getCellActions ( $request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT ) : array
$request Request
$row GridRow
$column GridColumn
$position int GRID_ACTION_POSITION_...
return array an array of LinkAction instances
コード例 #1
0
 /**
  * Get cell actions associated with this row/column combination
  * Adds a link to the file if there is an uploaded file present
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LinkAction instances
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'name') {
         $user = $request->getUser();
         $actionArgs = array_merge($row->getRequestArgs(), array('signoffId' => $row->getId()));
         $signoff = $row->getData();
         $actions = array();
         if ($signoff->getDateCompleted()) {
             import('lib.pkp.controllers.informationCenter.linkAction.SignoffNotesLinkAction');
             $actions[] = new SignoffNotesLinkAction($request, $signoff, $this->getSubmissionId(), $this->getStageId());
         } else {
             if (time() > strtotime($signoff->getDateUnderway())) {
                 import('lib.pkp.controllers.api.task.SendReminderLinkAction');
                 $actions[] = new SendReminderLinkAction($request, 'editor.submission.proof.reminder', $actionArgs);
             }
         }
         if (!$signoff->getDateCompleted() && $signoff->getUserId() == $user->getId()) {
             // User own the unfinished signoff, let it complete the task.
             import('lib.pkp.controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
             $addFileAction = new AddSignoffFileLinkAction($request, $this->getSubmissionId(), $this->getStageId(), $signoff->getSymbolic(), $signoff->getId(), __('submission.upload.signoff'), __('submission.upload.signoff'));
             // FIXME: This is not ideal.
             $addFileAction->_title = null;
             $actions[] = $addFileAction;
         }
     }
     return array_merge(parent::getCellActions($request, $row, $column, $position), $actions);
 }
コード例 #2
0
 /**
  * Get cell actions associated with this row/column combination
  * Adds a link to the file if there is an uploaded file present
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LegacyLinkAction instances
  */
 function getCellActions(&$request, &$row, &$column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'name') {
         $signoff =& $row->getData();
         $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
         /* @var $submissionFileDao SubmissionFileDAO */
         if ($signoff->getFileId()) {
             $monographFile =& $submissionFileDao->getLatestRevision($signoff->getFileId());
             $fileId = $signoff->getFileId();
             $router =& $request->getRouter();
             $actionArgs = array('gridId' => $row->getGridId(), 'monographId' => $monographFile->getMonographId(), 'fileId' => $fileId);
             $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
             $userDao =& DAORegistry::getDAO('UserDAO');
             $userGroup =& $userGroupDao->getById($signoff->getUserGroupId());
             $user =& $userDao->getUser($signoff->getUserId());
             $label = $user->getFullName() . " (" . $userGroup->getLocalizedName() . ") - " . $monographFile->getLocalizedName();
             $action = new LegacyLinkAction('downloadFile', LINK_ACTION_MODE_LINK, LINK_ACTION_TYPE_NOTHING, $router->url($request, null, null, 'downloadFile', null, $actionArgs), null, $label);
             return array($action);
         } else {
             $fileId = $monographFile = null;
             return null;
         }
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #3
0
 /**
  * Get cell actions associated with this row/column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LinkAction instances
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     $element = $row->getData();
     switch ($column->getId()) {
         case 'name':
             $router = $request->getRouter();
             return array(new LinkAction('moreInformation', new AjaxModal($router->url($request, null, null, 'viewPlugin', null, array('rowId' => $row->getId() + 1)), $element->getLocalizedName(), 'modal_information', true), $element->getLocalizedName(), 'details'));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #4
0
 /**
  * Get cell actions associated with this row/column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LinkAction instances
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     $staticPage = $row->getData();
     switch ($column->getId()) {
         case 'path':
             $dispatcher = $request->getDispatcher();
             return array(new LinkAction('details', new RedirectAction($dispatcher->url($request, ROUTE_PAGE, null) . '/' . $staticPage->getPath(), 'staticPage'), $staticPage->getPath()));
         default:
             return parent::getCellActions($request, $row, $column, $position);
     }
 }
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     switch ($column->getId()) {
         case 'title':
             $announcement = $row->getData();
             $router = $request->getRouter();
             $actionArgs = array('announcementId' => $row->getId());
             import('lib.pkp.classes.linkAction.request.AjaxModal');
             return array(new LinkAction('moreInformation', new AjaxModal($router->url($request, null, null, 'moreInformation', null, $actionArgs), $announcement->getLocalizedTitle(), null, true), $announcement->getLocalizedTitle(), 'moreInformation'));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #6
0
 /**
  * Get cell actions associated with this row/column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LegacyLinkAction instances
  */
 function getCellActions(&$request, &$row, &$column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'name') {
         $monographFile =& $row->getData();
         $router =& $request->getRouter();
         $actionArgs = array('gridId' => $row->getGridId(), 'monographId' => $monographFile->getMonographId(), 'fileId' => $monographFile->getFileId());
         $fileLabel = $monographFile->getRevision() > 1 ? $monographFile->getLocalizedName() . " (" . $monographFile->getRevision() . ")" : $monographFile->getLocalizedName();
         $action =& new LegacyLinkAction('downloadFile', LINK_ACTION_MODE_LINK, LINK_ACTION_TYPE_NOTHING, $router->url($request, null, null, 'downloadFile', null, $actionArgs), null, $fileLabel);
         return array($action);
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
 /**
  * Get cell actions associated with this row/column combination
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LinkAction instances
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     switch ($column->getId()) {
         case 'files':
             $element = $row->getData();
             assert(is_a($element, 'LibraryFile'));
             // Create the cell action to download a file.
             import('lib.pkp.controllers.api.file.linkAction.DownloadLibraryFileLinkAction');
             return array(new DownloadLibraryFileLinkAction($request, $element));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #8
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     switch ($column->getId()) {
         case 'name':
             $announcementType = $row->getData();
             $router = $request->getRouter();
             $actionArgs = array('announcementTypeId' => $row->getId());
             import('lib.pkp.classes.linkAction.request.AjaxModal');
             return array(new LinkAction('edit', new AjaxModal($router->url($request, null, null, 'editAnnouncementType', null, $actionArgs), __('grid.action.edit'), null, true), $announcementType->getLocalizedTypeName()));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #9
0
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_ROW_CLICK)
 {
     $submissionFile = $row->getData();
     $router = $request->getRouter();
     switch ($column->getId()) {
         case 'name':
             $dispatcher = $request->getDispatcher();
             return array(new LinkAction('editSubmissionFile', new AjaxModal($router->url($request, null, null, 'editSubmissionFile', null, array('submissionFileId' => $submissionFile->getFileId(), 'submissionId' => $this->_submissionId)), __('grid.action.edit'), 'modal_edit', true), ''));
         default:
             return parent::getCellActions($request, $row, $column, $position);
     }
 }
コード例 #10
0
 /**
  * @see GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     switch ($column->getId()) {
         case 'active':
             $element = $row->getData();
             /* @var $element DataObject */
             $router = $request->getRouter();
             import('lib.pkp.classes.linkAction.LinkAction');
             if ($element->getActive()) {
                 return array(new LinkAction('deactivateReviewForm', new RemoteActionConfirmationModal(__('manager.reviewForms.confirmDeactivate'), null, $router->url($request, null, 'grid.settings.reviewForms.ReviewFormGridHandler', 'deactivateReviewForm', null, array('reviewFormKey' => $element->getId())))));
             } else {
                 return array(new LinkAction('activateReviewForm', new RemoteActionConfirmationModal(__('manager.reviewForms.confirmActivate'), null, $router->url($request, null, 'grid.settings.reviewForms.ReviewFormGridHandler', 'activateReviewForm', null, array('reviewFormKey' => $element->getId())))));
             }
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #11
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     $submissionFile = $row->getData();
     assert(is_a($submissionFile, 'SubmissionFile'));
     switch ($column->getId()) {
         case 'name':
             import('lib.pkp.controllers.grid.files.FileNameGridColumn');
             $fileNameColumn = new FileNameGridColumn(true, WORKFLOW_STAGE_ID_PRODUCTION, true);
             // Set the row data as expected in FileNameGridColumn object.
             $rowData = array('submissionFile' => $submissionFile);
             $row->setData($rowData);
             $actions = $fileNameColumn->getCellActions($request, $row);
             // Back the row data as expected by the signoff grid.
             $row->setData($submissionFile);
             return $actions;
         case 'approved':
             return array($this->_getApprovedCellAction($request, $submissionFile, $this->getCellState($row, $column)));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #12
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     switch ($column->getId()) {
         case 'enabled':
             $plugin = $row->getData();
             /* @var $plugin Plugin */
             $requestArgs = array_merge(array('plugin' => $plugin->getName()), $row->getRequestArgs());
             switch (true) {
                 case $plugin->getEnabled() && $plugin->getCanDisable():
                     // Create an action to disable the plugin
                     import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
                     return array(new LinkAction('disable', new RemoteActionConfirmationModal($request->getSession(), __('grid.plugin.disable'), __('common.disable'), $request->url(null, null, 'disable', null, $requestArgs)), __('manager.plugins.disable'), null));
                     break;
                 case !$plugin->getEnabled() && $plugin->getCanEnable():
                     // Create an action to enable the plugin
                     import('lib.pkp.classes.linkAction.request.AjaxAction');
                     return array(new LinkAction('enable', new AjaxAction($request->url(null, null, 'enable', null, $requestArgs)), __('manager.plugins.enable'), null));
                     break;
             }
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #13
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'enabled') {
         $plugin = $row->getData();
         /* @var $plugin Plugin */
         $router = $request->getRouter();
         $managementVerbs = $plugin->getManagementVerbs();
         if (!is_null($managementVerbs)) {
             foreach ($managementVerbs as $verb) {
                 list($verbName, $verbLocalizedName) = $verb;
                 $actionArgs = array_merge(array('plugin' => $plugin->getName(), 'verb' => $verbName), $row->getRequestArgs());
                 $actionRequest = null;
                 $defaultUrl = $router->url($request, null, null, 'plugin', null, $actionArgs);
                 if ($verbName === 'enable') {
                     import('lib.pkp.classes.linkAction.request.AjaxAction');
                     $actionRequest = new AjaxAction($defaultUrl);
                 } else {
                     if ($verbName === 'disable') {
                         import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
                         $actionRequest = new RemoteActionConfirmationModal(__('grid.plugin.disable'), __('common.disable'), $defaultUrl);
                     }
                 }
                 if ($actionRequest) {
                     $linkAction = new LinkAction($verbName, $actionRequest, $verbLocalizedName, null);
                     return array($linkAction);
                 }
             }
         }
         // Plugin can't be disabled or don't have
         // management verbs for that.
         return array();
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
コード例 #14
0
 /**
  * @copydoc GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     $workflowStages = Application::getApplicationStages();
     $columnId = $column->getId();
     if (in_array($columnId, $workflowStages)) {
         $userGroup = $row->getData();
         /* @var $userGroup UserGroup */
         $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
         /* @var $userGroupDao UserGroupDAO */
         $assignedStages = $userGroupDao->getAssignedStagesByUserGroupId($userGroup->getContextId(), $userGroup->getId());
         $router = $request->getRouter();
         $roleDao = DAORegistry::getDAO('RoleDAO');
         /* @var $roleDao RoleDAO */
         if (!in_array($columnId, $roleDao->getForbiddenStages($userGroup->getRoleId()))) {
             if (in_array($columnId, array_keys($assignedStages))) {
                 $operation = 'unassignStage';
                 $actionTitleKey = 'grid.userGroup.unassignStage';
             } else {
                 $operation = 'assignStage';
                 $actionTitleKey = 'grid.userGroup.assignStage';
             }
             $actionArgs = array_merge(array('stageId' => $columnId), $row->getRequestArgs());
             $actionUrl = $router->url($request, null, null, $operation, null, $actionArgs);
             import('lib.pkp.classes.linkAction.request.AjaxAction');
             $actionRequest = new AjaxAction($actionUrl);
             $linkAction = new LinkAction($operation, $actionRequest, __($actionTitleKey), null);
             return array($linkAction);
         }
     }
     return parent::getCellActions($request, $row, $column, $position);
 }
 /**
  * @see GridCellProvider::getCellActions()
  */
 function getCellActions($request, $row, $column)
 {
     import('lib.pkp.classes.linkAction.request.AjaxAction');
     $monograph = $row->getData();
     $router = $request->getRouter();
     $currentState = $toggleType = null;
     switch ($column->getId()) {
         case 'isFeatured':
             $featureDao = DAORegistry::getDAO('FeatureDAO');
             $currentState = $featureDao->isFeatured($monograph->getId(), $this->_assocType, $this->_assocId);
             $toggleType = 'setFeatured';
             break;
         case 'isNewRelease':
             $newReleaseDao = DAORegistry::getDAO('NewReleaseDAO');
             $currentState = $newReleaseDao->isNewRelease($monograph->getId(), $this->_assocType, $this->_assocId);
             $toggleType = 'setNewRelease';
             break;
     }
     if ($toggleType) {
         return array(new LinkAction('toggleFeature', new AjaxAction($router->url($request, null, null, 'toggle', null, array_merge(array('rowId' => $monograph->getId(), 'assocType' => $this->_assocType, 'assocId' => $this->_assocId, 'toggleType' => $toggleType, 'newState' => $currentState ? 0 : 1), $this->_requestArgs)))));
     } else {
         return parent::getCellActions($request, $row, $column);
     }
 }
コード例 #16
0
 /**
  * Get cell actions associated with this row/column combination
  * Adds a link to the file if there is an uploaded file present
  * @param $row GridRow
  * @param $column GridColumn
  * @return array an array of LinkAction instances
  */
 function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT)
 {
     if ($column->getId() == 'response') {
         $signoff = $this->getSignoff($row);
         $submission = $this->getSubmission();
         if (!$signoff->getDateCompleted()) {
             import('lib.pkp.controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
             $addFileAction = new AddSignoffFileLinkAction($request, $submission->getId(), $this->getStageId(), $signoff->getSymbolic(), $signoff->getId(), __('submission.upload.signoff'), __('submission.upload.signoff'));
             // FIXME: This is not ideal.
             $addFileAction->_title = null;
             return array($addFileAction);
         }
         import('lib.pkp.controllers.informationCenter.linkAction.SignoffNotesLinkAction');
         return array(new SignoffNotesLinkAction($request, $signoff, $submission->getId(), $this->getStageId()));
     }
     return parent::getCellActions($request, $row, $column, $position);
 }