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

controllers/grid/admin/systemInfo/SystemInfoGridHandler.inc.php

00001 <?php
00002 
00015 import('lib.pkp.classes.controllers.grid.CategoryGridHandler');
00016 import('controllers.grid.admin.systemInfo.SystemInfoGridCategoryRow');
00017 
00018 
00019 class SystemInfoGridHandler extends CategoryGridHandler {
00020 
00021    var $_configData;
00022 
00026    function SystemInfoGridHandler() {
00027       parent::CategoryGridHandler();
00028       $this->addRoleAssignment(array(
00029          ROLE_ID_SITE_ADMIN),
00030          array('fetchGrid', 'fetchCategory', 'fetchRow')
00031       );
00032    }
00033 
00034 
00035    //
00036    // Implement template methods from PKPHandler.
00037    //
00041    function authorize(&$request, $args, $roleAssignments) {
00042       import('lib.pkp.classes.security.authorization.PolicySet');
00043       $rolePolicy = new PolicySet(COMBINING_PERMIT_OVERRIDES);
00044 
00045       import('lib.pkp.classes.security.authorization.RoleBasedHandlerOperationPolicy');
00046       foreach($roleAssignments as $role => $operations) {
00047          $rolePolicy->addPolicy(new RoleBasedHandlerOperationPolicy($request, $role, $operations));
00048       }
00049       $this->addPolicy($rolePolicy);
00050 
00051       return parent::authorize($request, $args, $roleAssignments);
00052    }
00053 
00057    function initialize(&$request) {
00058       parent::initialize($request);
00059 
00060       // Load user-related translations.
00061       AppLocale::requireComponents(
00062          LOCALE_COMPONENT_PKP_USER,
00063          LOCALE_COMPONENT_OMP_ADMIN,
00064          LOCALE_COMPONENT_OMP_MANAGER,
00065          LOCALE_COMPONENT_APPLICATION_COMMON
00066       );
00067 
00068       // Basic grid configuration.
00069       $this->setTitle('admin.systemConfiguration');
00070       $this->setInstructions('admin.systemConfigurationDescription');
00071 
00072       //
00073       // Grid columns.
00074       //
00075       import('controllers.grid.admin.systemInfo.InfoGridCellProvider');
00076       $infoGridCellProvider = new InfoGridCellProvider();
00077 
00078       // setting name.
00079       $this->addColumn(
00080          new GridColumn(
00081             'name',
00082             'admin.systemInfo.settingName',
00083             null,
00084             'controllers/grid/gridCell.tpl',
00085             $infoGridCellProvider,
00086             array('width' => 20)
00087          )
00088       );
00089 
00090       // setting value.
00091       $this->addColumn(
00092          new GridColumn(
00093             'value',
00094             'admin.systemInfo.settingValue',
00095             null,
00096             'controllers/grid/gridCell.tpl',
00097             $infoGridCellProvider
00098          )
00099       );
00100 
00101       $this->_configData = Config::getData();
00102    }
00103 
00104 
00105    //
00106    // Implement template methods from CategoryGridHandler
00107    //
00111    function &getCategoryRowInstance() {
00112       $row = new SystemInfoGridCategoryRow();
00113       return $row;
00114    }
00115 
00119    function getCategoryData($configSection) {
00120       return $this->_configData[$configSection];
00121    }
00122 
00126    function loadData(&$request, $filter) {
00127       return array_keys($this->_configData);
00128    }
00129 }
00130 ?>

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