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

controllers/grid/users/chapter/ChapterGridCategoryRow.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.controllers.grid.GridCategoryRow');
00016 
00017 // Link actions
00018 import('lib.pkp.classes.linkAction.request.AjaxModal');
00019 import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
00020 
00021 class ChapterGridCategoryRow extends GridCategoryRow {
00023    var $_monograph;
00024 
00026    var $_chapter;
00027 
00029    var $_readOnly;
00030 
00034    function ChapterGridCategoryRow(&$monograph, $readOnly = false) {
00035       $this->_monograph =& $monograph;
00036       $this->_readOnly = $readOnly;
00037       parent::GridCategoryRow();
00038    }
00039 
00040    //
00041    // Overridden methods from GridCategoryRow
00042    //
00047    function initialize(&$request) {
00048       // Do the default initialization
00049       parent::initialize($request);
00050 
00051       // Retrieve the monograph id from the request
00052       $monograph =& $this->getMonograph();
00053 
00054       // Is this a new row or an existing row?
00055       $chapterId = $this->getId();
00056       if (!empty($chapterId) && is_numeric($chapterId)) {
00057          $chapter =& $this->getData();
00058          $this->_chapter =& $chapter;
00059 
00060          // Only add row actions if this is an existing row and the grid is not 'read only'
00061          if (!$this->isReadOnly()) {
00062             $router =& $request->getRouter();
00063             $actionArgs = array(
00064                'monographId' => $monograph->getId(),
00065                'chapterId' => $chapterId
00066             );
00067 
00068             $this->addAction(
00069                new LinkAction(
00070                   'deleteChapter',
00071                   new RemoteActionConfirmationModal(
00072                      __('common.confirmDelete'),
00073                      __('common.delete'),
00074                      $router->url($request, null, null, 'deleteChapter', null, $actionArgs),
00075                      'modal_delete'
00076                   ),
00077                   null,
00078                   'delete'
00079                ), GRID_ACTION_POSITION_ROW_LEFT
00080             );
00081          }
00082 
00083       }
00084    }
00085 
00090    function &getMonograph() {
00091       return $this->_monograph;
00092    }
00093 
00098    function &getChapter() {
00099       return $this->_chapter;
00100    }
00101 
00106    function isReadOnly() {
00107       return $this->_readOnly;
00108    }
00109 }
00110 ?>

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