00001 <?php
00002
00016 import('lib.pkp.classes.core.PKPPageRouter');
00017
00018 class PageRouter extends PKPPageRouter {
00023 function getCacheablePages() {
00024 return array('about', 'announcement', 'help', 'index', 'information', 'rt', '');
00025 }
00026
00031 function redirectHome(&$request) {
00032 $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
00033 $user = $request->getUser();
00034 $userId = $user->getId();
00035
00036 if ($press =& $this->getContext($request, 1)) {
00037
00038 $userGroups =& $userGroupDao->getByUserId($userId, $press->getId());
00039 if($userGroups->getCount() <= 1) {
00040 $userGroup =& $userGroups->next();
00041 if (!$userGroup || $userGroup->getRoleId() == ROLE_ID_READER) $request->redirect(null, 'index');
00042 }
00043 $request->redirect(null, 'dashboard');
00044 } else {
00045
00046
00047 $userGroups =& $userGroupDao->getByUserId($userId, CONTEXT_ID_NONE);
00048
00049 if($userGroups->getCount() == 1) {
00050 $pressDao =& DAORegistry::getDAO('PressDAO');
00051 $userGroup =& $userGroups->next();
00052 $press =& $pressDao->getById($userGroup->getContextId());
00053 if (!isset($press)) $request->redirect('index', 'index');
00054 if ($userGroup->getRoleId() == ROLE_ID_READER) $request->redirect(null, 'index');
00055 }
00056 $request->redirect('index', 'index');
00057 }
00058 }
00059 }
00060
00061 ?>