first commit
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file pages/about/AboutContextHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AboutContextHandler
|
||||
*
|
||||
* @ingroup pages_about
|
||||
*
|
||||
* @brief Handle requests for context-level about functions.
|
||||
*/
|
||||
|
||||
namespace PKP\pages\about;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\facades\Repo;
|
||||
use APP\handler\Handler;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\security\authorization\ContextRequiredPolicy;
|
||||
use PKP\security\Role;
|
||||
|
||||
class AboutContextHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @see PKPHandler::authorize()
|
||||
*/
|
||||
public function authorize($request, &$args, $roleAssignments)
|
||||
{
|
||||
$context = $request->getContext();
|
||||
if (!$context || !$context->getData('restrictSiteAccess')) {
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$templateMgr->setCacheability(TemplateManager::CACHEABILITY_PUBLIC);
|
||||
}
|
||||
|
||||
$this->addPolicy(new ContextRequiredPolicy($request));
|
||||
return parent::authorize($request, $args, $roleAssignments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display about page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function index($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$templateMgr->display('frontend/pages/about.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display editorialTeam page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function editorialTeam($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$templateMgr->display('frontend/pages/editorialTeam.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display submissions page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function submissions($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$context = $request->getContext();
|
||||
$this->setupTemplate($request);
|
||||
|
||||
|
||||
$templateMgr->assign('submissionChecklist', $context->getLocalizedData('submissionChecklist'));
|
||||
|
||||
// Get sections for this context
|
||||
$canSubmitAll = false;
|
||||
$userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES);
|
||||
if ($userRoles && !empty(array_intersect([Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], $userRoles))) {
|
||||
$canSubmitAll = true;
|
||||
}
|
||||
|
||||
$sections = Repo::section()
|
||||
->getCollector()
|
||||
->filterByContextIds([$context->getId()])
|
||||
->excludeEditorOnly(!$canSubmitAll)
|
||||
->getMany()
|
||||
->all();
|
||||
|
||||
$templateMgr->assign('sections', $sections);
|
||||
$templateMgr->display('frontend/pages/submissions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display contact page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function contact($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$context = $request->getContext();
|
||||
$templateMgr->assign([
|
||||
'mailingAddress' => $context->getData('mailingAddress'),
|
||||
'contactPhone' => $context->getData('contactPhone'),
|
||||
'contactEmail' => $context->getData('contactEmail'),
|
||||
'contactName' => $context->getData('contactName'),
|
||||
'supportName' => $context->getData('supportName'),
|
||||
'supportPhone' => $context->getData('supportPhone'),
|
||||
'supportEmail' => $context->getData('supportEmail'),
|
||||
'contactTitle' => $context->getLocalizedData('contactTitle'),
|
||||
'contactAffiliation' => $context->getLocalizedData('contactAffiliation'),
|
||||
]);
|
||||
$templateMgr->display('frontend/pages/contact.tpl');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user