/** * 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); }
/** * 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); }
/** * 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); } }
/** * This implementation assumes a simple data element array that * has column ids as keys. * @see GridCellProvider::getTemplateVarsFromRowColumn() * @param $row GridRow * @param $column GridColumn * @return array */ function getTemplateVarsFromRowColumn($row, $column) { $file = $row->getData(); $columnId = $column->getId(); assert(is_a($file, 'SubmissionFile') && !empty($columnId)); switch ($columnId) { case 'name': return array('labelKey' => $file->getFileId(), 'label' => '<span class="label before_actions">' . $file->getFileId() . '-' . $file->getRevision() . '</span>' . htmlspecialchars($file->getFileLabel())); } return parent::getTemplateVarsFromRowColumn($row, $column); }
/** * 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); }
/** * 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); }
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); } }
/** * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * @param $row GridRow * @param $column GridColumn * @return array */ function getTemplateVarsFromRowColumn($row, $column) { $announcementType = $row->getData(); $columnId = $column->getId(); assert(is_a($announcementType, 'AnnouncementType') && !empty($columnId)); switch ($columnId) { case 'title': return array('label' => $announcementType->getLocalizedName()); break; default: break; } return parent::getTemplateVarsFromRowColumn($row, $column); }
/** * @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); }
/** * @see GridCellProvider::render() */ function render($request, $row, $column) { // Default category rows will only have the first column // as label columns. if ($column->hasFlag('firstColumn')) { // Store the current column template. $template = $column->getTemplate(); // Reset to the default column template. $column->setTemplate('controllers/grid/gridCell.tpl'); // Render the cell. $renderedCell = parent::render($request, $row, $column); // Restore the original column template. $column->setTemplate($template); return $renderedCell; } else { return ''; } }
/** * @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); }
/** * @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); }
/** * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * @param $row GridRow * @param $column GridColumn * @return array */ function getTemplateVarsFromRowColumn($row, $column) { $announcement = $row->getData(); $columnId = $column->getId(); assert(is_a($announcement, 'Announcement') && !empty($columnId)); switch ($columnId) { case 'title': return array('label' => ''); break; case 'type': $typeId = $announcement->getTypeId(); if ($typeId) { $announcementTypeDao = DAORegistry::getDAO('AnnouncementTypeDAO'); $announcementType = $announcementTypeDao->getById($typeId); return array('label' => $announcementType->getLocalizedTypeName()); } else { return array('label' => __('common.none')); } break; default: break; } return parent::getTemplateVarsFromRowColumn($row, $column); }
/** * Constructor */ function FilterGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function ColumnBasedGridCellProvider() { parent::GridCellProvider(); }
/** * @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); }
/** * Constructor */ function UserListbuilderGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function MastheadGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function IssueGalleyGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor * @param $dataProvider DataProvider The object to wrap * @param $format string See strftime */ function DateGridCellProvider($dataProvider, $format) { parent::GridCellProvider(); $this->_dataProvider = $dataProvider; $this->_format = $format; }
/** * Constructor */ function IssueGridCellProvider() { parent::GridCellProvider(); $this->dateFormatShort = Config::getVar('general', 'date_format_short'); }
/** * Constructor */ function __construct() { parent::__construct(); }
/** * Constructor */ function ChapterGridCategoryRowCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function DataObjectGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function CategoriesListbuilderGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function ReviewFormGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function ArrayGridCellProvider() { parent::GridCellProvider(); }
/** * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * @param $row GridRow * @param $column GridColumn * @return array */ function getTemplateVarsFromRowColumn($row, $column) { $signoff = $row->getData(); /* @var $element Signoff */ $columnId = $column->getId(); assert(is_a($signoff, 'Signoff') && !empty($columnId)); if ($columnId == 'name') { return array('label' => $this->_getLabel($signoff)); } return parent::getTemplateVarsFromRowColumn($row, $column); }
/** * Constructor */ function ArticleGalleyGridCellProvider() { parent::GridCellProvider(); }
/** * Constructor */ function FooterLinkListbuilderGridCellProvider() { parent::GridCellProvider(); }