/** * Display user index page. */ function index() { $this->validate(); $user =& Request::getUser(); $userId = $user->getId(); $setupIncomplete = array(); $submissionsCount = array(); $isValid = array(); $schedConfsToDisplay = array(); $conferencesToDisplay = array(); $roleDao =& DAORegistry::getDAO('RoleDAO'); $schedConfDao =& DAORegistry::getDAO('SchedConfDAO'); $this->setupTemplate(); $templateMgr =& TemplateManager::getManager(); $conference =& Request::getConference(); $templateMgr->assign('helpTopicId', 'user.userHome'); $allConferences = $allSchedConfs = array(); if ($conference == null) { // Curently at site level unset($conference); // Show roles for all conferences $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); $conferences =& $conferenceDao->getConferences(); // Fetch the user's roles for each conference while ($conference =& $conferences->next()) { $conferenceId = $conference->getId(); $schedConfId = 0; // First, the generic roles for this conference $roles =& $roleDao->getRolesByUserId($userId, $conferenceId, 0); if (!empty($roles)) { $conferencesToDisplay[$conferenceId] =& $conference; $rolesToDisplay[$conferenceId] =& $roles; } // Determine if conference setup is incomplete, to provide a message for JM $setupIncomplete[$conferenceId] = $this->checkIncompleteSetup($conference); $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); // Second, scheduled conference-specific roles // TODO: don't display scheduled conference roles if granted at conference level too? $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conferenceId); while ($schedConf =& $schedConfs->next()) { $schedConfId = $schedConf->getId(); $schedConfRoles =& $roleDao->getRolesByUserId($userId, $conferenceId, $schedConfId); if (!empty($schedConfRoles)) { $schedConfsToDisplay[$conferenceId][$schedConfId] =& $schedConf; $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); } $allSchedConfs[$conference->getId()][$schedConf->getId()] =& $schedConf; unset($schedConf); } // If the user has Sched. Conf. roles and no Conf. roles, push the conf. object // into the conference array so it gets shown if (empty($roles) && !empty($schedConfsToDisplay[$conferenceId])) { $conferencesToDisplay[$conferenceId] =& $conference; } $allConferences[$conference->getId()] =& $conference; unset($schedConfs); unset($conference); } $templateMgr->assign('showAllConferences', 1); $templateMgr->assign_by_ref('userConferences', $conferencesToDisplay); } else { // Currently within a conference's context $conferenceId = $conference->getId(); $userConferences = array($conference); $this->getRoleDataForConference($userId, $conferenceId, 0, $submissionsCount, $isValid); $schedConfs =& $schedConfDao->getSchedConfsByConferenceId($conferenceId); while ($schedConf =& $schedConfs->next()) { $schedConfId = $schedConf->getId(); $schedConfRoles =& $roleDao->getRolesByUserId($userId, $conferenceId, $schedConfId); if (!empty($schedConfRoles)) { $this->getRoleDataForConference($userId, $conferenceId, $schedConfId, $submissionsCount, $isValid); $schedConfsToDisplay[$conferenceId][$schedConfId] =& $schedConf; } unset($schedConf); } $schedConf =& Request::getSchedConf(); if ($schedConf) { import('schedConf.SchedConfAction'); $templateMgr->assign('allowRegAuthor', SchedConfAction::allowRegAuthor($schedConf)); $templateMgr->assign('allowRegReviewer', SchedConfAction::allowRegReviewer($schedConf)); $templateMgr->assign('submissionsOpen', SchedConfAction::submissionsOpen($schedConf)); } $templateMgr->assign_by_ref('userConferences', $userConferences); } $templateMgr->assign('isSiteAdmin', $roleDao->getRole(0, 0, $userId, ROLE_ID_SITE_ADMIN)); $templateMgr->assign('allConferences', $allConferences); $templateMgr->assign('allSchedConfs', $allSchedConfs); $templateMgr->assign('userSchedConfs', $schedConfsToDisplay); $templateMgr->assign('isValid', $isValid); $templateMgr->assign('submissionsCount', $submissionsCount); $templateMgr->assign('setupIncomplete', $setupIncomplete); $templateMgr->display('user/index.tpl'); }
/** * Validation check for submission. * Checks that paper ID is valid, if specified. * @param $request object * @param $paperId int * @param $step int */ function validate($request, $paperId = null, $step = false) { parent::validate(); $conference =& $request->getConference(); $schedConf =& $request->getSchedConf(); $paperDao =& DAORegistry::getDAO('PaperDAO'); $user =& $request->getUser(); if ($step !== false && ($step < 1 || $step > 5 || !isset($paperId) && $step != 1)) { $request->redirect(null, null, null, 'submit', array(1)); } $paper = null; if ($paperId) { // Check that paper exists for this conference and user and that submission is incomplete $paper =& $paperDao->getPaper((int) $paperId); if (!$paper || $paper->getUserId() !== $user->getId() || $paper->getSchedConfId() !== $schedConf->getId()) { $request->redirect(null, null, null, 'submit'); } if ($step !== false && $step > $paper->getSubmissionProgress()) { $request->redirect(null, null, null, 'submit'); } } else { // If the paper does not exist, require that the // submission window be open or that this user be a // director or track director. import('classes.schedConf.SchedConfAction'); $schedConf =& $request->getSchedConf(); if (!$schedConf || !SchedConfAction::submissionsOpen($schedConf) && !Validation::isDirector($schedConf->getConferenceId(), $schedConf->getId()) && !Validation::isTrackDirector($schedConf->getConferenceId())) { $request->redirect(null, null, 'author', 'index'); } } $this->paper =& $paper; return true; }