/** * Fetch the form. * @param $request PKPRequest */ function fetch($request) { $templateMgr = TemplateManager::getManager($request); $context = $request->getContext(); // Tell the form what fields are enabled (and which of those are required) foreach (array_keys(MetadataGridHandler::getNames()) as $field) { $templateMgr->assign($a = array($field . 'Enabled' => $context->getSetting($field . 'EnabledSubmission'), $field . 'Required' => $context->getSetting($field . 'Required'))); } return parent::fetch($request); }
/** * Fetch the form. */ function fetch($request) { $user = $request->getUser(); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('supportedSubmissionLocaleNames', $this->context->getSupportedSubmissionLocaleNames()); // if this context has a copyright notice that the author must agree to, present the form items. if ((bool) $this->context->getSetting('copyrightNoticeAgree')) { $templateMgr->assign('copyrightNotice', $this->context->getLocalizedSetting('copyrightNotice')); $templateMgr->assign('copyrightNoticeAgree', true); } // Get list of user's author user groups. If its more than one, we'll need to display an author user group selector $userGroupAssignmentDao = DAORegistry::getDAO('UserGroupAssignmentDAO'); $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); $authorUserGroupAssignments = $userGroupAssignmentDao->getByUserId($user->getId(), $this->context->getId(), ROLE_ID_AUTHOR); $userGroupNames = array(); if (!$authorUserGroupAssignments->wasEmpty()) { while ($authorUserGroupAssignment = $authorUserGroupAssignments->next()) { $authorUserGroup = $userGroupDao->getById($authorUserGroupAssignment->getUserGroupId()); if ($userGroupDao->userGroupAssignedToStage($authorUserGroup->getId(), WORKFLOW_STAGE_ID_SUBMISSION)) { $userGroupNames[$authorUserGroup->getId()] = $authorUserGroup->getLocalizedName(); } } $templateMgr->assign('authorUserGroupOptions', $userGroupNames); } else { // The user doesn't have any author user group assignments. They should be either a manager. // Add all manager user groups $managerUserGroupAssignments = $userGroupAssignmentDao->getByUserId($user->getId(), $this->context->getId(), ROLE_ID_MANAGER); if ($managerUserGroupAssignments) { while ($managerUserGroupAssignment = $managerUserGroupAssignments->next()) { $managerUserGroup = $userGroupDao->getById($managerUserGroupAssignment->getUserGroupId()); $userGroupNames[$managerUserGroup->getId()] = $managerUserGroup->getLocalizedName(); } } $templateMgr->assign('authorUserGroupOptions', $userGroupNames); } return parent::fetch($request); }