HTML; $flipflop = false; foreach ($feed as $entry) { $title = printArray($entry->getTitles()); $volumeId = $entry->getVolumeId(); if ($thumbnailLink = $entry->getThumbnailLink()) { $thumbnail = $thumbnailLink->href; } else { $thumbnail = null; } $preview = $entry->getPreviewLink()->href; $embeddability = $entry->getEmbeddability()->getValue(); $creators = printArray($entry->getCreators()); if (!empty($creators)) $creators = "by " . $creators; if ($embeddability == "http://schemas.google.com/books/2008#embeddable") { $preview_link = ''. '' . '
'; } else { $preview_link = ''; } $thumbnail_img = (!$thumbnail) ? '' : ''; print << HTML; } print <<
$thumbnail_img
$title
$creators
$preview_link
 

HTML; } /* * The main controller logic of the Books volume browser demonstration app. */ $queryType = isset($_GET['queryType']) ? $_GET['queryType'] : null; include 'interface.html'; if ($queryType === null) { /* display the entire interface */ } else { $books = new Zend_Gdata_Books(); $query = $books->newVolumeQuery(); /* display a list of volumes */ if (isset($_GET['searchTerm'])) { $searchTerm = $_GET['searchTerm']; $query->setQuery($searchTerm); } if (isset($_GET['startIndex'])) { $startIndex = $_GET['startIndex']; $query->setStartIndex($startIndex); } if (isset($_GET['maxResults'])) { $maxResults = $_GET['maxResults']; $query->setMaxResults($maxResults); } if (isset($_GET['minViewability'])) { $minViewability = $_GET['minViewability']; $query->setMinViewability($minViewability); } /* check for one of the restricted feeds, or list from 'all' videos */ switch ($queryType) { case 'full_view': case 'partial_view': $query->setMinViewability($queryType); echo 'Requesting feed: ' . ($query->getQueryUrl()) . '

'; $feed = $books->getVolumeFeed($query); break; case 'all': echo 'Requesting feed: ' . ($query->getQueryUrl()) . '

'; $feed = $books->getVolumeFeed($query); break; default: echo 'ERROR - unknown queryType - "' . $queryType . '"'; break; } echoBookList($feed); }