Skip to content

Commit

Permalink
pkp#9914 fix for editorial masthead
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed May 14, 2024
1 parent f29ce26 commit b86a9b8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 30 deletions.
16 changes: 10 additions & 6 deletions pages/about/AboutContextHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ public function editorialMasthead($args, $request)

$mastheadUsers = [];
foreach ($mastheadRoles as $mastheadUserGroup) {
if ($mastheadUserGroup->getRoleId() == Role::ROLE_ID_REVIEWER) {
continue;
}
// Get all users that are active in the given role
// and that have accepted to be displayed on the masthead for that role.
// No need to filter by context ID, because the user groups are already filtered so.
$users = Repo::user()
->getCollector()
$usersCollector = Repo::user()->getCollector();
$users = $usersCollector
->filterByUserGroupIds([$mastheadUserGroup->getId()])
->filterByUserUserGroupMastheadStatus(UserUserGroupMastheadStatus::STATUS_ON)
->orderBy($usersCollector::ORDERBY_FAMILYNAME, $usersCollector::ORDER_DIR_ASC, [Locale::getLocale(), Application::get()->getRequest()->getSite()->getPrimaryLocale()])
->getMany();
foreach ($users as $user) {
$userUserGroup = UserUserGroup::withUserId($user->getId())
Expand All @@ -110,11 +114,11 @@ public function editorialMasthead($args, $request)

$previousYear = date('Y') - 1;
$reviewerIds = Repo::reviewAssignment()->getReviewerIdsByCompletedYear($context->getId(), $previousYear);
$reviewers = Repo::user()
->getCollector()
$usersCollector = Repo::user()->getCollector();
$reviewers = $usersCollector
->filterByUserIds($reviewerIds->toArray())
->getMany()
->all();
->orderBy($usersCollector::ORDERBY_FAMILYNAME, $usersCollector::ORDER_DIR_ASC, [Locale::getLocale(), Application::get()->getRequest()->getSite()->getPrimaryLocale()])
->getMany();

Hook::call('AboutContextHandler::editorialMasthead', [$mastheadRoles, $mastheadUsers, $reviewers, $previousYear]);

Expand Down
59 changes: 35 additions & 24 deletions templates/frontend/pages/editorialMasthead.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,27 @@

<h1>{translate key="common.editorialMasthead"}</h1>
{foreach from=$mastheadRoles item="mastheadRole"}
{if $mastheadRole->getRoleId() != \PKP\security\Role::ROLE_ID_REVIEWER}
{if array_key_exists($mastheadRole->getId(), $mastheadUsers)}
<h2>{$mastheadRole->getLocalizedName()|escape}</h2>
<ul>
{foreach from=$mastheadUsers[$mastheadRole->getId()] item="mastheadUser"}
<li>
{$mastheadUser['user']->getFullName()|escape},
{$mastheadUser['user']->getLocalizedData('affiliation')|escape},
{$mastheadUser['dateStart']}
{if $mastheadUser['user']->getData('orcid')}
<span class="orcid">
{if $mastheadUser['user']->getData('orcidAccessToken')}
{$orcidIcon}
{/if}
<a href="{$mastheadUser['user']->getData('orcid')|escape}" target="_blank">
{$mastheadUser['user']->getData('orcid')|escape}
</a>
</span>
{/if}
</li>
{/foreach}
</ul>
{/if}
{if array_key_exists($mastheadRole->getId(), $mastheadUsers)}
<h2>{$mastheadRole->getLocalizedName()|escape}</h2>
<ul>
{foreach from=$mastheadUsers[$mastheadRole->getId()] item="mastheadUser"}
<li>
{$mastheadUser['user']->getFullName()|escape},
{$mastheadUser['user']->getLocalizedData('affiliation')|escape},
{$mastheadUser['dateStart']}
{if $mastheadUser['user']->getData('orcid')}
<span class="orcid">
{if $mastheadUser['user']->getData('orcidAccessToken')}
{$orcidIcon}
{/if}
<a href="{$mastheadUser['user']->getData('orcid')|escape}" target="_blank">
{$mastheadUser['user']->getData('orcid')|escape}
</a>
</span>
{/if}
</li>
{/foreach}
</ul>
{/if}
{/foreach}

Expand All @@ -46,7 +44,20 @@
<p>{translate key="common.editorialMasthead.peerReviewers.description" year=$previousYear}</p>
<ul>
{foreach from=$reviewers item="reviewer"}
<li>{$reviewer->getFullName()|escape}</li>
<li>
{$reviewer->getFullName()|escape},
{$reviewer->getLocalizedData('affiliation')|escape}
{if $reviewer->getData('orcid')}
<span class="orcid">
{if $reviewer->getData('orcidAccessToken')}
{$orcidIcon}
{/if}
<a href="{$reviewer->getData('orcid')|escape}" target="_blank">
{$reviewer->getData('orcid')|escape}
</a>
</span>
{/if}
</li>
{/foreach}
</ul>
{/if}
Expand Down

0 comments on commit b86a9b8

Please sign in to comment.