Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AnnouncementGridCellProvider.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridCellProvider');
17 
19 
24  parent::GridCellProvider();
25  }
26 
30  function getCellActions($request, $row, $column, $position = GRID_ACTION_POSITION_DEFAULT) {
31  if ($column->getId() == 'title') {
32  $announcement = $row->getData();
33  $label = $announcement->getLocalizedTitle();
34 
35  $router = $request->getRouter();
36  $actionArgs = array('announcementId' => $row->getId());
37 
38  import('lib.pkp.classes.linkAction.request.AjaxModal');
39  $moreInformationAction = new LinkAction(
40  'moreInformation',
41  new AjaxModal(
42  $router->url($request, null, null, 'moreInformation', null, $actionArgs),
43  $label,
44  null,
45  true
46  ),
47  $label,
48  'moreInformation'
49  );
50 
51  return array($moreInformationAction);
52  }
53 
54  return parent::getCellActions($request, $row, $column, $position);
55  }
56 
64  function getTemplateVarsFromRowColumn($row, $column) {
65  $announcement = $row->getData();
66  $columnId = $column->getId();
67  assert(is_a($announcement, 'Announcement') && !empty($columnId));
68 
69  switch ($columnId) {
70  case 'title':
71  return array('label' => '');
72  break;
73  case 'type':
74  $typeId = $announcement->getTypeId();
75  if ($typeId) {
76  $announcementTypeDao = DAORegistry::getDAO('AnnouncementTypeDAO');
77  $announcementType = $announcementTypeDao->getById($typeId);
78  return array('label' => $announcementType->getLocalizedTypeName());
79  } else {
80  return array('label' => __('common.none'));
81  }
82  break;
83  default:
84  break;
85  }
86 
87  return parent::getTemplateVarsFromRowColumn($row, $column);
88  }
89 }
90 
91 ?>
static & getDAO($name, $dbconn=null)
Cell provider for title column of a announcement grid.
Base class for a grid column&#39;s cell provider.
A modal that retrieves its content from via AJAX.
getCellActions($request, $row, $column, $position=GRID_ACTION_POSITION_DEFAULT)
Base class defining an action that can be performed by the user in the user interface.