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

controllers/grid/content/announcements/AnnouncementGridCellProvider.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.controllers.grid.GridCellProvider');
00016 
00017 class AnnouncementGridCellProvider extends GridCellProvider {
00018 
00022    function AnnouncementGridCellProvider() {
00023       parent::GridCellProvider();
00024    }
00025 
00029    function getCellActions(&$request, &$row, &$column, $position = GRID_ACTION_POSITION_DEFAULT) {
00030       if ($column->getId() == 'title') {
00031          $announcement =& $row->getData();
00032          $label = $announcement->getLocalizedTitle();
00033 
00034          $router =& $request->getRouter();
00035          $actionArgs = array('announcementId' => $row->getId());
00036 
00037          import('lib.pkp.classes.linkAction.request.AjaxModal');
00038          $moreInformationAction = new LinkAction(
00039             'moreInformation',
00040             new AjaxModal(
00041                $router->url($request, null, null, 'moreInformation', null, $actionArgs),
00042                $label,
00043                null,
00044                true
00045             ),
00046             $label,
00047             'moreInformation'
00048          );
00049 
00050          return array($moreInformationAction);
00051       }
00052 
00053       return parent::getCellActions($request, $row, $column, $position);
00054    }
00055 
00063    function getTemplateVarsFromRowColumn(&$row, &$column) {
00064       $announcement =& $row->getData();
00065       $columnId = $column->getId();
00066       assert(is_a($announcement, 'Announcement') && !empty($columnId));
00067 
00068       switch ($columnId) {
00069          case 'title':
00070             return array('label' => '');
00071             break;
00072          case 'type':
00073             $typeId = $announcement->getTypeId();
00074             if ($typeId) {
00075                $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
00076                $announcementType =& $announcementTypeDao->getById($typeId);
00077                return array('label' => $announcementType->getLocalizedTypeName());
00078             } else {
00079                return array('label' => __('common.none'));
00080             }
00081             break;
00082          default:
00083             break;
00084       }
00085 
00086       return parent::getTemplateVarsFromRowColumn($row, $column);
00087    }
00088 }
00089 
00090 ?>

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