Browse Source

adjusted compare function to remove iframes

main
Simon Bowie 2 years ago
parent
commit
89d5a2c676
2 changed files with 263 additions and 9 deletions
  1. +249
    -9
      site/public/compare.php
  2. +14
    -0
      site/solr.php

+ 249
- 9
site/public/compare.php View File

# @author: Simon Bowie <ad7588@coventry.ac.uk> # @author: Simon Bowie <ad7588@coventry.ac.uk>
# @purpose: Displays two random records from the Solr index # @purpose: Displays two random records from the Solr index


include '../solr.php';
include '../ops_api.php';

$core = 'all';
$random_records = two_random_records($core);
$record_one = $random_records[0];
$record_two = $random_records[1];
$record_one_details = get_publication_details($record_one['doc_ref']);
$record_two_details = get_publication_details($record_two['doc_ref']);

?> ?>



<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style.css">
<script>
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
</script>
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col text-center">
<iframe class="compare_frame" src="./random.php" frameborder="0" scrolling="no" onload="resizeIframe(this)"> </iframe>
<div class="col-6 text-center">
Application ID:

<a href="id_search.php?id=<? echo $random_record['id']; ?>&core=all">
<?php
echo $record_one['application_id'];
?>
</a>

<br><br>

Year:

<?php
echo $record_one['year'];
?>

<br><br>

EPO publication:

<a href=<?php echo $record_one['epo_publication_url']; ?>>
<?php
echo $record_one['epo_publication_url'];
?>
</a>

<br><br>

IPC publication:

<a href=<?php echo $record_one['ipc_publication_url']; ?>>
<?php
echo $record_one['ipc_publication_url'];
?>
</a>

<br><br>

<?php
if (isset($record_one['title'])):
?>

Title:

<?php
echo $record_one['title'];
?>

<br><br>

<?php
endif;
?>

<?php
if (isset($record_one_details['original_title'])):
?>

Original language title:

<?php
echo $record_one_details['original_title'];
?>

<br><br>

<?php
endif;
?>

<?php
if (isset($record_one['abstract'])):
?>

Abstract:

<?php
echo $record_one['abstract'];
?>

<br><br>

<?
endif;
?>

<?php
if (isset($record_one_details['original_abstract'])):
?>

Original language abstract:

<?php
echo $record_one_details['original_abstract'];
?>

<br><br>

<?php
endif;
?>


<?php
if (check_for_images($record_one['doc_ref'])):
?>

<?php
$image = get_images($record_one["doc_ref"]);
?>

<?php
echo '<img class="img-fluid" src="data:image/jpg;base64,'.base64_encode($image->getImageBlob()).'" alt="Drawing of patent" />';
?>

<?php
endif;
?>
</div> </div>


<div class="col text-center">
<iframe class="compare_frame" src="./random.php" frameborder="0" scrolling="no" onload="resizeIframe(this)"></iframe>
<div class="col-6 text-center">
Application ID:

<a href="id_search.php?id=<? echo $record_two['id']; ?>&core=all">
<?php
echo $record_two['application_id'];
?>
</a>

<br><br>

Year:

<?php
echo $record_two['year'];
?>

<br><br>

EPO publication:

<a href=<?php echo $record_two['epo_publication_url']; ?>>
<?php
echo $record_two['epo_publication_url'];
?>
</a>

<br><br>

IPC publication:

<a href=<?php echo $record_two['ipc_publication_url']; ?>>
<?php
echo $record_two['ipc_publication_url'];
?>
</a>

<br><br>

<?php
if (isset($record_two['title'])):
?>

Title:

<?php
echo $record_two['title'];
?>

<br><br>

<?php
endif;
?>

<?php
if (isset($record_two_details['original_title'])):
?>

Original language title:

<?php
echo $record_two_details['original_title'];
?>

<br><br>

<?php
endif;
?>

<?php
if (isset($record_two['abstract'])):
?>

Abstract:

<?php
echo $record_two['abstract'];
?>

<br><br>

<?
endif;
?>

<?php
if (isset($record_two_details['original_abstract'])):
?>

Original language abstract:

<?php
echo $record_two_details['original_abstract'];
?>

<br><br>

<?php
endif;
?>


<?php
if (check_for_images($record_two['doc_ref'])):
?>

<?php
$image = get_images($record_two["doc_ref"]);
?>

<?php
echo '<img class="img-fluid" src="data:image/jpg;base64,'.base64_encode($image->getImageBlob()).'" alt="Drawing of patent" />';
?>

<?php
endif;
?>
</div> </div>
</div> </div>
</div> </div>

+ 14
- 0
site/solr.php View File

return $output; return $output;
} }


function two_random_records($core){

$x = 0;
while ($x <= 1) {
$random = get_random_record($core);

foreach($random as $id => $content){
$output[$x] = parse_result($id, $content);
++$x;
}
}
return $output;
}

function ten_random_titles ($core){ function ten_random_titles ($core){


$x = 0; $x = 0;

Loading…
Cancel
Save