Skip to content

Commit

Permalink
Made code more resistant to changes in EOL classifications
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmpage committed Jan 27, 2015
1 parent 93c0b6f commit 6417504
Show file tree
Hide file tree
Showing 83 changed files with 226 additions and 8 deletions.
19 changes: 15 additions & 4 deletions eoliphone/children.php
Expand Up @@ -14,15 +14,25 @@

//echo $url;
$json = get($url);

//echo $json;

$obj = json_decode($json);

/*
echo '<pre>';
print_r($obj);
echo '</pre>';
exit();
*/

echo'
<!DOCTYPE html>
<html>
<head>
<title>EOL Classification</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0;">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="../css/jquery.mobile-1.0.css" />
Expand Down Expand Up @@ -54,15 +64,16 @@
switch ($obj->nameAccordingTo[0])
{
case 'WORMS Species Information (Marine Species)':
echo 'worms.html';
echo 'worms_root.php';
break;

case 'Species 2000 & ITIS Catalogue of Life: Annual Checklist 2010':
echo 'col.html';
case 'Species 2000 & ITIS Catalogue of Life: April 2013':
echo 'col_root.php';
break;

case 'NCBI Taxonomy':
echo 'ncbi.html';
echo 'ncbi_root.php';
break;

default:
Expand Down
60 changes: 60 additions & 0 deletions eoliphone/col_root.php
@@ -0,0 +1,60 @@
<?php

require_once('../lib.php');

// 1188 CoL

$url = 'http://eol.org/api/hierarchies/1.0/1188.json?cache_ttl=';

$json = get($url);

$obj = json_decode($json);

echo '
<!DOCTYPE html>
<html>
<head>
<title>Catalogue of Life</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="../css/jquery.mobile-1.0.css" />
<link rel="stylesheet" href="jquery.mobile.scrollview.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.mobile-1.0.js"></script>
<script src="jquery.easing.1.3.js"></script>
<script src="jquery.mobile.scrollview.js"></script>
<script src="scrollview.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<a href="index.html" data-transition="slide" data-direction="reverse" data-icon="arrow-l">EOL Classifications</a>
<h1>Catalogue of Life</h1>
</div><!-- /header -->
<div data-role="content" data-scroll="true">
<!-- CoL -->
<!-- this is hard coded which means it will break with new classifications -->
<ul data-role="listview" >';

foreach ($obj->roots as $root)
{
echo '<li><a href="children.php?id=' . $root->taxonID . '"><img src="thumbnail.php?taxonConceptID=' . $root->taxonConceptID . '"/>' . $root->scientificName . '</a></li>' . "\n";
}
echo ' </ul>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>';
27 changes: 27 additions & 0 deletions eoliphone/details.php
Expand Up @@ -85,6 +85,8 @@
$html .= '<h1>' . $obj->scientificName . '</h1>';


/*
// Ignore classifications as EOL API returns multiple classifications for some providers and hence we can get the wrong id for linking
if (isset($obj->taxonConcepts))
{
$html .= '<h2>Classifications</h2>';
Expand All @@ -108,8 +110,33 @@
}
$html .= '</ul>';
}
*/

// Text
if (isset($obj->dataObjects))
{
$text = '';
foreach ($obj->dataObjects as $dataObject)
{
if ($dataObject->dataType == 'http://purl.org/dc/dcmitype/Text')
{
if (isset($dataObject->description))
{
$text = $dataObject->description;
}
}
}

if ($text != '')
{
$html .= '<h2>Description</h2>';
$html .= $text;
}
}



// Images
if (isset($obj->dataObjects))
{
$html .= '<h2>Images</h2>';
Expand Down
8 changes: 4 additions & 4 deletions eoliphone/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<title>EOL Classifications</title>

<meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0;">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />

<link rel="stylesheet" href="../css/jquery.mobile-1.0.css" />
Expand All @@ -29,9 +29,9 @@ <h1>EOL Classifications</h1>
<div data-role="content">

<ul data-role="listview" data-inset="true">
<li><a href="col.html"><img src="images/catalogueoflife-twitter.JPG"/>Catalogue of Life</a></li>
<li><a href="ncbi.html"><img src="images/ncbi-twitter.jpg"/>NCBI Taxonomy</a></li>
<li><a href="worms.html"><img src="images/worms-twitter.gif"/>World Register of Marine Species</a></li>
<li><a href="col_root.php"><img src="images/catalogueoflife-twitter.JPG"/>Catalogue of Life</a></li>
<li><a href="ncbi_root.php"><img src="images/ncbi-twitter.jpg"/>NCBI Taxonomy</a></li>
<li><a href="worms_root.php"><img src="images/worms-twitter.gif"/>World Register of Marine Species</a></li>
</ul>
</div><!-- /content -->

Expand Down
60 changes: 60 additions & 0 deletions eoliphone/ncbi_root.php
@@ -0,0 +1,60 @@
<?php

require_once('../lib.php');

// 1172 NCBI

$url = 'http://eol.org/api/hierarchies/1.0/1172.json?cache_ttl=';

$json = get($url);

$obj = json_decode($json);

echo '
<!DOCTYPE html>
<html>
<head>
<title>NCBI Taxonomy</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="../css/jquery.mobile-1.0.css" />
<link rel="stylesheet" href="jquery.mobile.scrollview.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.mobile-1.0.js"></script>
<script src="jquery.easing.1.3.js"></script>
<script src="jquery.mobile.scrollview.js"></script>
<script src="scrollview.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<a href="index.html" data-transition="slide" data-direction="reverse" data-icon="arrow-l">EOL Classifications</a>
<h1>NCBI Taxonomy</h1>
</div><!-- /header -->
<div data-role="content" data-scroll="true">
<!-- CoL -->
<!-- this is hard coded which means it will break with new classifications -->
<ul data-role="listview" >';

foreach ($obj->roots as $root)
{
echo '<li><a href="children.php?id=' . $root->taxonID . '"><img src="thumbnail.php?taxonConceptID=' . $root->taxonConceptID . '"/>' . $root->scientificName . '</a></li>' . "\n";
}
echo ' </ul>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>';
Binary file modified eoliphone/tmp/1.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1498
Binary file not shown.
Binary file modified eoliphone/tmp/1498.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1525
Binary file not shown.
Binary file modified eoliphone/tmp/1525.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1539
Binary file not shown.
Binary file modified eoliphone/tmp/1539.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/164
Binary file not shown.
Binary file modified eoliphone/tmp/164.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1740
Binary file not shown.
Binary file modified eoliphone/tmp/1740.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1745
Binary file not shown.
Binary file modified eoliphone/tmp/1745.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1922
Binary file not shown.
Binary file modified eoliphone/tmp/1922.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/1926
Binary file not shown.
Binary file modified eoliphone/tmp/1926.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2
Binary file not shown.
Binary file modified eoliphone/tmp/2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2060
Binary file not shown.
Binary file modified eoliphone/tmp/2060.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2167
Binary file not shown.
Binary file modified eoliphone/tmp/2167.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2195
Binary file not shown.
Binary file modified eoliphone/tmp/2195.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2701
Binary file not shown.
Binary file modified eoliphone/tmp/2701.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2715
Binary file not shown.
Binary file modified eoliphone/tmp/2715.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/281
Binary file not shown.
Binary file modified eoliphone/tmp/281.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2855
Binary file not shown.
Binary file modified eoliphone/tmp/2855.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/288
Binary file not shown.
Binary file modified eoliphone/tmp/288.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/2884
Binary file not shown.
Binary file modified eoliphone/tmp/2884.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/3028491
Binary file not shown.
Binary file modified eoliphone/tmp/3028491.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/3142
Binary file not shown.
Binary file modified eoliphone/tmp/3142.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/3204
Binary file not shown.
Binary file modified eoliphone/tmp/3204.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/3352
Binary file not shown.
Binary file modified eoliphone/tmp/3352.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/36
Binary file not shown.
Binary file modified eoliphone/tmp/36.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/4651
Binary file not shown.
Binary file modified eoliphone/tmp/4651.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed eoliphone/tmp/5006
Binary file not shown.
Binary file modified eoliphone/tmp/5006.jpg
Binary file removed eoliphone/tmp/5559
Binary file not shown.
Binary file modified eoliphone/tmp/5559.jpg
Binary file removed eoliphone/tmp/6851
Binary file not shown.
Binary file modified eoliphone/tmp/6851.jpg
Binary file removed eoliphone/tmp/69
Binary file not shown.
Binary file modified eoliphone/tmp/69.jpg
Binary file removed eoliphone/tmp/6927
Binary file not shown.
Binary file modified eoliphone/tmp/6927.jpg
Binary file removed eoliphone/tmp/694
Binary file not shown.
Binary file modified eoliphone/tmp/694.jpg
Binary file removed eoliphone/tmp/7920
Binary file not shown.
Binary file modified eoliphone/tmp/7920.jpg
Binary file removed eoliphone/tmp/8728
Binary file not shown.
Binary file modified eoliphone/tmp/8728.jpg
Binary file removed eoliphone/tmp/8747
Binary file not shown.
Binary file modified eoliphone/tmp/8747.jpg
Binary file removed eoliphone/tmp/8773
Binary file not shown.
Binary file modified eoliphone/tmp/8773.jpg
Binary file removed eoliphone/tmp/8847
Binary file not shown.
Binary file modified eoliphone/tmp/8847.jpg
Binary file removed eoliphone/tmp/8854
Binary file not shown.
Binary file modified eoliphone/tmp/8854.jpg
Binary file removed eoliphone/tmp/8867
Binary file not shown.
Binary file modified eoliphone/tmp/8867.jpg
Binary file removed eoliphone/tmp/8871
Binary file not shown.
Binary file modified eoliphone/tmp/8871.jpg
60 changes: 60 additions & 0 deletions eoliphone/worms_root.php
@@ -0,0 +1,60 @@
<?php

require_once('../lib.php');

// 123 WoRMS

$url = 'http://eol.org/api/hierarchies/1.0/123.json?cache_ttl=';

$json = get($url);

$obj = json_decode($json);

echo '
<!DOCTYPE html>
<html>
<head>
<title>World Register of Marine Species</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="../css/jquery.mobile-1.0.css" />
<link rel="stylesheet" href="jquery.mobile.scrollview.css" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.mobile-1.0.js"></script>
<script src="jquery.easing.1.3.js"></script>
<script src="jquery.mobile.scrollview.js"></script>
<script src="scrollview.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<a href="index.html" data-transition="slide" data-direction="reverse" data-icon="arrow-l">EOL Classifications</a>
<h1>World Register of Marine Species</h1>
</div><!-- /header -->
<div data-role="content" data-scroll="true">
<!-- CoL -->
<!-- this is hard coded which means it will break with new classifications -->
<ul data-role="listview" >';

foreach ($obj->roots as $root)
{
echo '<li><a href="children.php?id=' . $root->taxonID . '"><img src="thumbnail.php?taxonConceptID=' . $root->taxonConceptID . '"/>' . $root->scientificName . '</a></li>' . "\n";
}
echo ' </ul>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>';

0 comments on commit 6417504

Please sign in to comment.