Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ServerInfoGridHandler.inc.php
1 <?php
2 
16 import('lib.pkp.classes.controllers.grid.GridHandler');
17 import('lib.pkp.controllers.grid.admin.systemInfo.InfoGridCellProvider');
18 
19 
24  function ServerInfoGridHandler() {
25  parent::GridHandler();
26  $this->addRoleAssignment(array(
27  ROLE_ID_SITE_ADMIN),
28  array('fetchGrid', 'fetchRow')
29  );
30  }
31 
32 
33  //
34  // Implement template methods from PKPHandler.
35  //
39  function authorize($request, &$args, $roleAssignments) {
40  import('lib.pkp.classes.security.authorization.PolicySet');
41  $rolePolicy = new PolicySet(COMBINING_PERMIT_OVERRIDES);
42 
43  import('lib.pkp.classes.security.authorization.RoleBasedHandlerOperationPolicy');
44  foreach($roleAssignments as $role => $operations) {
45  $rolePolicy->addPolicy(new RoleBasedHandlerOperationPolicy($request, $role, $operations));
46  }
47  $this->addPolicy($rolePolicy);
48 
49  return parent::authorize($request, $args, $roleAssignments);
50  }
51 
55  function initialize($request) {
56  parent::initialize($request);
57 
58  // Load user-related translations.
60  LOCALE_COMPONENT_PKP_USER,
61  LOCALE_COMPONENT_PKP_ADMIN,
62  LOCALE_COMPONENT_APP_ADMIN,
63  LOCALE_COMPONENT_APP_MANAGER,
64  LOCALE_COMPONENT_APP_COMMON
65  );
66 
67  // Basic grid configuration.
68  $this->setTitle('admin.serverInformation');
69  $this->setInstructions('admin.serverInformationDescription');
70 
71  //
72  // Grid columns.
73  //
74  $infoGridCellProvider = new InfoGridCellProvider(true);
75 
76  // Setting name.
77  $this->addColumn(
78  new GridColumn(
79  'name',
80  'admin.systemInfo.settingName',
81  null,
82  'controllers/grid/gridCell.tpl',
83  $infoGridCellProvider,
84  array('width' => 20, 'alignment' => COLUMN_ALIGNMENT_LEFT)
85  )
86  );
87 
88  // Setting value.
89  $this->addColumn(
90  new GridColumn(
91  'value',
92  'admin.systemInfo.settingValue',
93  null,
94  'controllers/grid/gridCell.tpl',
95  $infoGridCellProvider
96  )
97  );
98  }
99 
100 
101  //
102  // Implement template methods from GridHandler
103  //
104 
108  function loadData($request, $filter) {
109 
110  $dbconn = DBConnection::getConn();
111  $dbServerInfo = $dbconn->ServerInfo();
112 
113  $serverInfo = array(
114  'admin.server.platform' => Core::serverPHPOS(),
115  'admin.server.phpVersion' => Core::serverPHPVersion(),
116  'admin.server.apacheVersion' => (function_exists('apache_get_version') ? apache_get_version() : __('common.notAvailable')),
117  'admin.server.dbDriver' => Config::getVar('database', 'driver'),
118  'admin.server.dbVersion' => (empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description'])
119  );
120 
121  return $serverInfo;
122  }
123 }
124 ?>
An ordered list of policies. Policy sets can be added to decision managers like policies. The decision manager will evaluate the contained policies in the order they were added.
static serverPHPOS()
Definition: Core.inc.php:112
addPolicy($authorizationPolicy, $addToTop=false)
static requireComponents()
authorize($request, &$args, $roleAssignments)
addColumn($column)
Class defining basic operations for handling HTML grids.
Class to control access to handler operations via role based access control.
addRoleAssignment($roleIds, $operations)
Subclass for the admin sysInfo grid&#39;s cell provider.
static getVar($section, $key, $default=null)
Definition: Config.inc.php:35
static & getConn()
static serverPHPVersion()
Definition: Core.inc.php:120
Handle server info grid requests.
setInstructions($instructions)
Represents a column within a grid. It is used to configure the way cells within a column are displaye...