Arc-hive-omeka-theme/view/common/cross-site-search/results.phtml

105 lines
2.8 KiB
PHTML
Raw Normal View History

<?php
$fulltextSearch = $this->params()->fromQuery('fulltext_search');
$hasResults = false;
?>
<?php
//$archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
//$collections = $archiveSiteHelper->getCollections();
?>
2021-05-31 15:17:12 +02:00
<!-- arc-hive insert begins -->
2021-05-17 20:01:12 +02:00
<?php
$img_src = $this->getHelperPluginManager()->get('archiveSiteMeta')->getSiteImage($this->site);
2021-05-31 15:17:12 +02:00
if (!$img_src) {
$img_src = $this->assetUrl('img/ARC-HIVE-logo.svg');
2021-05-31 15:17:12 +02:00
}
if ($this->site->title() == "Collections") {
$image_height = "300px";
} else {
$image_height = "200px";
}
2021-05-17 20:01:12 +02:00
?>
2021-05-31 15:26:34 +02:00
<style>
#archive_header_img {
background: url("<?= $img_src ?>") no-repeat;
width: 100%;
height: <?= $image_height ?>;
2021-05-31 15:26:34 +02:00
}
</style>
2021-05-31 15:17:12 +02:00
<script>
<?php
$_html = '<a href="'.$this->site->url().'">'.$this->site->title().'</a>';
2021-05-31 15:17:12 +02:00
?>
$("#archive_page_title").html('<?php echo $_html ?>');
</script>
<!-- arc-hive insert ends -->
2021-05-17 20:01:12 +02:00
2021-10-08 00:13:54 +02:00
<h3 class="search-results-for-title"><?php echo sprintf($this->translate('Search results for “%s”'), $fulltextSearch); ?></h3>
2021-05-31 15:17:12 +02:00
<div class="results">
<?php
if ($this->site->title() == "Collections") {
/* convert all the results into sites and display the list of sites */
$result = array();
if ($responseSitePages && $responseSitePages->getTotalResults()) {
$hasResults = true;
foreach ($responseSitePages->getContent() as $sitePage) {
$site = $sitePage->site();
array_push($result, $site);
}
}
if ($responseItems && $responseItems->getTotalResults()) {
$hasResults = true;
foreach ($responseSitePages->getContent() as $sitePage) {
$site = $sitePage->site();
if (!in_array ($site , $result)) {
array_push($result, $site);
}
}
}
echo $this->partial('common/block-layout/list-of-sites', [
'sites' => $result,
'summaries' => 1,
]);
} else {
/* display the results as normal */
?>
<?php
if ($responseSitePages && $responseSitePages->getTotalResults()):
$hasResults = true;
?>
<?php
$sitePages = array();
foreach ($responseSitePages->getContent() as $sitePage) {
array_push($sitePages, $sitePage);
}
echo $this->partial('common/cross-site-search/site-page-results', [
'sitePages' => $sitePages,
]);
?>
<?php endif; ?>
<?php
if ($responseItems && $responseItems->getTotalResults()):
$hasResults = true;
?>
<?php
$items = array();
foreach ($responseItems->getContent() as $item) {
array_push($items, $item);
}
echo $this->partial('common/cross-site-search/item-results', [
'items' => $items,
]);
?>
<?php endif; ?>
<?php } ?>
</div>
<?php if (!$hasResults): ?>
<p><?php echo $this->translate('No result found'); ?>
<?php endif; ?>