• Main Page
  • Modules
  • Classes
  • Files
  • File List

controllers/grid/files/FileNameGridColumn.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.controllers.grid.GridColumn');
00016 
00017 class FileNameGridColumn extends GridColumn {
00019    var $_includeNotes;
00020 
00022    var $_stageId;
00023 
00025    var $_removeHistoryTab;
00026 
00034    function FileNameGridColumn($includeNotes = true, $stageId = null, $removeHistoryTab = false) {
00035       $this->_includeNotes = $includeNotes;
00036       $this->_stageId = $stageId;
00037       $this->_removeHistoryTab = $removeHistoryTab;
00038 
00039       import('lib.pkp.classes.controllers.grid.ColumnBasedGridCellProvider');
00040       $cellProvider = new ColumnBasedGridCellProvider();
00041 
00042       parent::GridColumn('name', 'common.name', null, 'controllers/grid/gridCell.tpl', $cellProvider,
00043          array('width' => 60, 'alignment' => COLUMN_ALIGNMENT_LEFT));
00044    }
00045 
00046 
00047    //
00048    // Public methods
00049    //
00056    function getTemplateVarsFromRow($row) {
00057       // We do not need any template variables because
00058       // the only content of this column's cell will be
00059       // an action. See FileNameGridColumn::getCellActions().
00060       return array('label' => '');
00061    }
00062 
00063 
00064    //
00065    // Override methods from GridColumn
00066    //
00070    function getCellActions(&$request, &$row, $position = GRID_ACTION_POSITION_DEFAULT) {
00071       $cellActions = parent::getCellActions($request, $row, $position);
00072 
00073       // Retrieve the monograph file.
00074       $submissionFileData =& $row->getData();
00075       assert(isset($submissionFileData['submissionFile']));
00076       $monographFile = $submissionFileData['submissionFile']; /* @var $monographFile MonographFile */
00077 
00078       // Create the cell action to download a file.
00079       import('controllers.api.file.linkAction.DownloadFileLinkAction');
00080       $cellActions[] = new DownloadFileLinkAction($request, $monographFile, $this->_getStageId());
00081 
00082       if ($this->_getIncludeNotes()) {
00083          import('controllers.informationCenter.linkAction.FileNotesLinkAction');
00084          $user =& $request->getUser();
00085          $cellActions[] = new FileNotesLinkAction($request, $monographFile, $user, $this->_getStageId(), $this->_removeHistoryTab);
00086       }
00087       return $cellActions;
00088    }
00089 
00090    //
00091    // Private methods
00092    //
00096    function _getIncludeNotes() {
00097       return $this->_includeNotes;
00098    }
00099 
00104    function _getStageId() {
00105       return $this->_stageId;
00106    }
00107 }
00108 
00109 ?>

Generated on Mon Sep 17 2012 13:58:55 for Open Monograph Press by  doxygen 1.7.1