Skip to content

Commit

Permalink
Listed sites in user page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM committed Jan 7, 2018
1 parent 9d120ce commit 43ad412
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions application/src/Api/Representation/UserRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public function getEntity()
return $this->resource;
}

public function sites()
{
$api = $this->getServiceLocator()->get('Omeka\ApiManager');
$sites = $api
->search('sites', ['owner_id' => $this->id()])->getContent();
return $sites;
}

public function displayRole()
{
$roleIndex = $this->resource->getRole();
Expand Down
26 changes: 26 additions & 0 deletions application/view/omeka/admin/user/show.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,30 @@
<?php echo $escape($user->isActive() ? $this->translate('yes') : $this->translate('no')); ?>
</div>
</div>
<div class="property sites">
<h4><?php echo $this->translate('Sites'); ?></h4>
<?php $sites = $user->sites(); ?>
<?php if (empty($sites)): ?>
<div class="value no-value">
<?php echo $escape($this->translate('None')); ?>
</div>
<?php else: ?>
<div class="value">
<ul style="list-style: none; margin: 0; padding-left: 0;">
<?php foreach ($sites as $site): ?>
<li>
<span class="actions" style="display: initial; margin-right: 6px;">
<?php echo $this->hyperlink('', $site->siteUrl(), [
'target' => '_blank',
'class' => 'o-icon-external public',
'title' => $this->translate('View public site'),
]); ?>
</span>
<?php echo $site->link($site->title()); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
<?php $this->trigger('view.show.after'); ?>

0 comments on commit 43ad412

Please sign in to comment.