Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
CategoryGridCategoryRow.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridCategoryRow');
17 
18 // Link actions
19 import('lib.pkp.classes.linkAction.request.AjaxModal');
20 
26  parent::GridCategoryRow();
27  }
28 
29  //
30  // Overridden methods from GridCategoryRow
31  //
36  function initialize($request) {
37  // Do the default initialization
38  parent::initialize($request);
39 
40  // Is this a new row or an existing row?
41  $categoryId = $this->getId();
42  if (!empty($categoryId) && is_numeric($categoryId)) {
43  $category = $this->getData();
44 
45  // Only add row actions if this is an existing row
46  import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
47  $router = $request->getRouter();
48  $this->addAction(
49  new LinkAction(
50  'deleteCategory',
52  __('common.confirmDelete'),
53  __('common.delete'),
54  $router->url($request, null, null, 'deleteCategory', null, array('categoryId' => $categoryId)), 'modal_delete'
55  ),
56  null,
57  'delete'
58  ), GRID_ACTION_POSITION_ROW_LEFT
59  );
60 
61  $this->addAction(new LinkAction(
62  'editCategory',
63  new AjaxModal(
64  $router->url($request, null, null, 'editCategory', null, array('categoryId' => $categoryId)),
65  __('grid.category.edit'),
66  'modal_edit'
67  ),
68  $category->getLocalizedTitle()
69  ), GRID_ACTION_POSITION_ROW_CLICK);
70  }
71  }
72 
77  function getCategoryLabel() {
78  return '';
79  }
80 }
81 
82 ?>
Class defining basic operations for handling the category row in a grid.
A modal that retrieves its content from via AJAX.
& getData()
Class defining a simple confirmation modal with a remote action and ok/cancel buttons.
addAction($action, $position=GRID_ACTION_POSITION_DEFAULT)
Category grid category row definition.
Base class defining an action that can be performed by the user in the user interface.