makes a search from the Collections site render a collections list

This commit is contained in:
buttle 2021-05-31 16:58:51 +02:00
parent 406a92b3f7
commit 551ba6b214
4 changed files with 68 additions and 28 deletions

View File

@ -1,6 +1,5 @@
<?php
$archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
$collections = $archiveSiteHelper->getCollections();
?>
<div class="list-of-sites">
@ -17,11 +16,9 @@ $collections = $archiveSiteHelper->getCollections();
</thead>
<tbody>
<?php
foreach($sites as $site):
$site_meta_values = $archiveSiteHelper->getSiteMetaValues($site);
//echo $this->partial('common/index/site-list-item', [
echo $this->partial('common/site-list-entry', [
'site' => $site,
'showSummary' => $summaries,
@ -36,7 +33,8 @@ $collections = $archiveSiteHelper->getCollections();
</div>
<?php
if ($pagination):
if (1 == 0):
//if ($pagination):
echo $this->pagination();
endif;
?>

View File

@ -2,7 +2,10 @@
$fulltextSearch = $this->params()->fromQuery('fulltext_search');
$hasResults = false;
?>
<?php
//$archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
//$collections = $archiveSiteHelper->getCollections();
?>
<!-- arc-hive insert begins -->
<?php
@ -22,11 +25,14 @@ if (!$img_src) {
<script>
<?php
$_html = '<a href="'.$this->site->url().'">'.$this->site->title().'</a>';
/*
if ($this->site->title() != "Collections") {
$_html = '<a href="'.$this->site->url().'">'.$this->site->title().'</a>';
} else {
$_html = $this->site->title();
}
*/
?>
$("#archive_page_title").html('<?php echo $_html ?>');
</script>
@ -37,35 +43,66 @@ $("#archive_page_title").html('<?php echo $_html ?>');
<div class="results">
<?php
if ($responseSitePages && $responseSitePages->getTotalResults()):
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;
?>
<?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()):
foreach ($responseSitePages->getContent() as $sitePage) {
$site = $sitePage->site();
array_push($result, $site);
}
}
if ($responseItems && $responseItems->getTotalResults()) {
$hasResults = true;
?>
<?php
$items = array();
foreach ($responseItems->getContent() as $item) {
array_push($items, $item);
foreach ($responseSitePages->getContent() as $sitePage) {
$site = $sitePage->site();
if (!in_array ($site , $result)) {
array_push($result, $site);
}
echo $this->partial('common/cross-site-search/item-results', [
'items' => $items,
]);
}
}
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 endif; ?>
<?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; ?>

View File

@ -4,6 +4,8 @@ $archiveSiteHelper = $this->getHelperPluginManager()->get('archiveSiteMeta');
$archive_collections = $archiveSiteHelper->getCollections();
?>
<!-- <h2><?php echo sprintf($this->translate('Site page results for "%s"'), $fulltextSearch); ?></h2> -->

View File

@ -22,11 +22,14 @@ if (!$img_src) {
</style>
<script>
<?php
$_html = '<a href="'.$this->site->url().'">'.$this->site->title().'</a>';
/*
if ($this->site->title() != "Collections") {
$_html = '<a href="'.$this->site->url().'">'.$this->site->title().'</a>';
} else {
$_html = $this->site->title();
}
*/
?>
$("#archive_page_title").html('<?php echo $_html ?>');
</script>