Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
UserHandler.inc.php
1 <?php
2 
16 import('lib.pkp.pages.user.PKPUserHandler');
17 
18 class UserHandler extends PKPUserHandler {
22  function UserHandler() {
23  parent::PKPUserHandler();
24  }
25 
29  function initialize($request, &$args) {
30  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_GRID);
31  parent::initialize($request, $args);
32  }
33 
37  function index($args, $request) {
38  $request->redirect(null, null, 'profile');
39  }
40 
46  function become($args, $request) {
47  parent::validate(true);
48 
49  $press = $request->getPress();
50  $user = $request->getUser();
51 
52  switch (array_shift($args)) {
53  case 'author':
54  $roleId = ROLE_ID_AUTHOR;
55  $setting = 'allowRegAuthor';
56  $deniedKey = 'user.noRoles.submitMonographRegClosed';
57  break;
58  case 'reviewer':
59  $roleId = ROLE_ID_REVIEWER;
60  $setting = 'allowRegReviewer';
61  $deniedKey = 'user.noRoles.regReviewerClosed';
62  break;
63  default:
64  $request->redirect(null, null, 'index');
65  }
66 
67  if ($press->getSetting($setting)) {
68  $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
69  $userGroup = $userGroupDao->getDefaultByRoleId($press->getId(), $roleId);
70  $userGroupDao->assignUserToGroup($user->getId(), $userGroup->getId());
71  $request->redirectUrl($request->getUserVar('source'));
72  } else {
73  $templateMgr = TemplateManager::getManager($request);
74  $templateMgr->assign('message', $deniedKey);
75  return $templateMgr->display('common/message.tpl');
76  }
77  }
78 }
79 
80 ?>
static & getDAO($name, $dbconn=null)
static requireComponents()
Handle requests for user functions.
initialize($request, &$args)
index($args, $request)
Handle requests for user functions.
become($args, $request)