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

controllers/grid/files/signoff/SignoffGridRow.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.controllers.grid.GridRow');
00016 
00017 class SignoffGridRow extends GridRow {
00019    var $_stageId;
00020 
00024    function SignoffGridRow($stageId) {
00025       $this->_stageId = (int)$stageId;
00026       parent::GridRow();
00027    }
00028 
00029    //
00030    // Overridden template methods
00031    //
00032    /*
00033     * Configure the grid row
00034     * @param $request PKPRequest
00035     */
00036    function initialize(&$request) {
00037       parent::initialize($request);
00038 
00039       // Is this a new row or an existing row?
00040       $rowId = $this->getId();
00041 
00042       // Get the signoff (the row)
00043       $signoffDao =& DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
00044       $signoff =& $signoffDao->getById($rowId);
00045 
00046       // Get the id of the original file (the category header)
00047       $monographFileId = $signoff->getAssocId();
00048       $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
00049       $monographFile =& $submissionFileDao->getLatestRevision($monographFileId);
00050       $monographDao =& DAORegistry::getDAO('MonographDAO'); /* @var $monographDao MonographDAO */
00051       $monographId = $monographFile->getMonographId();
00052       $copyeditedFileId = $signoff->getFileId();
00053 
00054       $user =& $request->getUser();
00055 
00056       if (!empty($rowId) && is_numeric($rowId)) {
00057          // Actions
00058          $router =& $request->getRouter();
00059          $actionArgs = array_merge($this->getRequestArgs(),
00060             array('signoffId' => $rowId));
00061 
00062          // Add the history action.
00063          import('controllers.informationCenter.linkAction.ReadSignoffHistoryLinkAction');
00064          $this->addAction(new ReadSignoffHistoryLinkAction($request, $rowId, $monographId, $this->getStageId()));
00065 
00066          // Add the delete signoff if it isn't completed yet.
00067          if (!$signoff->getDateCompleted()) {
00068             import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
00069             $this->addAction(new LinkAction(
00070                'deleteSignoff',
00071                new RemoteActionConfirmationModal(
00072                   __('common.confirmDelete'), __('common.delete'),
00073                   $router->url(
00074                      $request, null, null, 'deleteSignoff',
00075                      null, array_merge(array(
00076                         'monographId' => $monographId,
00077                         'stageId' => $this->getStageId(),
00078                         'signoffId' => $rowId,
00079                         'fileId' => $copyeditedFileId
00080                      ), $this->getRequestArgs())
00081                   ),
00082                   'modal_delete'
00083                ),
00084                __('grid.copyediting.deleteSignoff'),
00085                'delete'
00086             ));
00087          }
00088 
00089          // If signoff has not been completed, allow the user to upload if it is their signoff (i.e. their copyediting assignment)
00090          if (!$signoff->getDateCompleted() && $signoff->getUserId() == $user->getId()) {
00091             if ($signoff->getUserId() == $user->getId()) {
00092                import('controllers.api.signoff.linkAction.AddSignoffFileLinkAction');
00093                $this->addAction(new AddSignoffFileLinkAction(
00094                   $request, $monographId,
00095                   $this->getStageId(), $signoff->getSymbolic(), $signoff->getId(),
00096                   __('submission.upload.signoff'), __('submission.upload.signoff')));
00097             }
00098          }
00099       }
00100    }
00101 
00102    //
00103    // Getters
00104    //
00109    function getStageId() {
00110       return $this->_stageId;
00111    }
00112 }
00113 
00114 ?>

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