From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- zend/demos/Zend/Gdata/BooksBrowser/index.php | 155 +++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100755 zend/demos/Zend/Gdata/BooksBrowser/index.php (limited to 'zend/demos/Zend/Gdata/BooksBrowser/index.php') diff --git a/zend/demos/Zend/Gdata/BooksBrowser/index.php b/zend/demos/Zend/Gdata/BooksBrowser/index.php new file mode 100755 index 0000000..8d5e9ad --- /dev/null +++ b/zend/demos/Zend/Gdata/BooksBrowser/index.php @@ -0,0 +1,155 @@ + +
+ +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); +} + -- cgit v1.2.3