Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
ManageLanguageGridHandler.inc.php
1 <?php
2 
16 import('lib.pkp.controllers.grid.languages.LanguageGridHandler');
17 import('lib.pkp.controllers.grid.languages.LanguageGridRow');
18 
24  parent::LanguageGridHandler();
25  $this->addRoleAssignment(
26  array(ROLE_ID_MANAGER),
27  array('saveLanguageSetting', 'setContextPrimaryLocale', 'fetchGrid', 'fetchRow')
28  );
29  }
30 
31 
32  //
33  // Implement methods from GridHandler.
34  //
38  function authorize($request, &$args, $roleAssignments) {
39  import('lib.pkp.classes.security.authorization.PkpContextAccessPolicy');
40  $this->addPolicy(new PkpContextAccessPolicy($request, $roleAssignments));
41  return parent::authorize($request, $args, $roleAssignments);
42  }
43 
47  function loadData($request, $filter) {
48  $site = $request->getSite();
49  $context = $request->getContext();
50 
51  $allLocales = AppLocale::getAllLocales();
52  $supportedLocales = $site->getSupportedLocales();
53  $contextPrimaryLocale = $context->getPrimaryLocale();
54  $data = array();
55 
56  foreach ($supportedLocales as $locale) {
57  $data[$locale] = array();
58  $data[$locale]['name'] = $allLocales[$locale];
59  $data[$locale]['supported'] = true;
60  $data[$locale]['primary'] = ($locale == $contextPrimaryLocale);
61  }
62 
63  $data = $this->addManagementData($request, $data);
64  return $data;
65  }
66 
67  //
68  // Extended methods from LanguageGridHandler.
69  //
73  function initialize($request) {
74  parent::initialize($request);
75  AppLocale::requireComponents(LOCALE_COMPONENT_APP_MANAGER);
76 
77  $this->setInstructions('manager.languages.languageInstructions');
78 
79  $this->addNameColumn();
80  $this->addPrimaryColumn('contextPrimary');
81  $this->addManagementColumns();
82  }
83 }
84 
85 ?>
addPolicy($authorizationPolicy, $addToTop=false)
static requireComponents()
Class to control access to PKP applications&#39; setup components.
addRoleAssignment($roleIds, $operations)
static & getAllLocales()
addManagementData($request, $data)
Handle language grid requests.
setInstructions($instructions)
authorize($request, &$args, $roleAssignments)
Handle language management grid requests only.