-
Notifications
You must be signed in to change notification settings - Fork 138
/
AnnouncementTypeGridRow.inc.php
79 lines (69 loc) · 1.83 KB
/
AnnouncementTypeGridRow.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file controllers/grid/content/announcements/AnnouncementTypeGridRow.inc.php
*
* Copyright (c) 2000-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class AnnouncementTypeGridRow
* @ingroup controllers_grid_content_announcements
*
* @brief Announcement type grid row definition
*/
import('lib.pkp.classes.controllers.grid.GridRow');
import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
class AnnouncementTypeGridRow extends GridRow {
/**
* Constructor
*/
function AnnouncementTypeGridRow() {
parent::GridRow();
}
//
// Overridden methods from GridRow
//
/**
* @see GridRow::initialize()
*/
function initialize(&$request) {
parent::initialize($request);
// Is this a new row or an existing row?
$element =& $this->getData();
assert(is_a($element, 'AnnouncementType'));
$rowId = $this->getId();
if (!empty($rowId) && is_numeric($rowId)) {
// Only add row actions if this is an existing row
$router =& $request->getRouter();
$actionArgs = array(
'announcementTypeId' => $rowId
);
$this->addAction(
new LinkAction(
'edit',
new AjaxModal(
$router->url($request, null, null, 'editAnnouncementType', null, $actionArgs),
__('grid.action.edit'),
'modal_edit',
true
),
__('grid.action.edit'),
'edit')
);
$this->addAction(
new LinkAction(
'remove',
new RemoteActionConfirmationModal(
__('common.confirmDelete'),
__('common.remove'),
$router->url($request, null, null, 'deleteAnnouncementType', null, $actionArgs),
'modal_delete'
),
__('grid.action.remove'),
'delete')
);
// Set a non-default template that supports row actions
$this->setTemplate('controllers/grid/gridRowWithActions.tpl');
}
}
}
?>