forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/** | ||
* Obalky knih TOC content loader. | ||
* | ||
* PHP version 8 | ||
* | ||
* Copyright (C) Moravian Library 2024. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
* @category VuFind | ||
* @package Content | ||
* @author Josef Moravec <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development Wiki | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VuFind\Content\TOC; | ||
|
||
use VuFind\Content\ObalkyKnihService; | ||
|
||
/** | ||
* Class ObalkyKnih | ||
* | ||
* @category VuFind | ||
* @package Content | ||
* @author Josef Moravec <[email protected]> | ||
* @license https://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org/wiki/development Wiki | ||
*/ | ||
class ObalkyKnih extends \VuFind\Content\AbstractBase | ||
{ | ||
/** | ||
* Constructor | ||
* | ||
* @param ObalkyKnihService $service Service for getting metadata from obalkyknih.cz | ||
*/ | ||
public function __construct(protected ObalkyKnihService $service) | ||
{ | ||
} | ||
|
||
/** | ||
* This method is responsible for generating fake TOC data for testing | ||
* purposes. | ||
* | ||
* @param string $key API key | ||
* @param \VuFindCode\ISBN $isbnObj ISBN object | ||
* | ||
* @throws \Exception | ||
* @return array|string Returns html string with preview image and link to TOC PDF file | ||
*/ | ||
public function loadByIsbn($key, \VuFindCode\ISBN $isbnObj) | ||
{ | ||
$ids = [ | ||
'isbn' => $isbnObj, | ||
]; | ||
$data = $this->service->getData($ids); | ||
$toc = ''; | ||
if (isset($data->toc_thumbnail_url)) { | ||
$toc = "<p></p><a href='" . htmlspecialchars($data->toc_pdf_url) | ||
. "' target='_blank' ><img src='" | ||
. htmlspecialchars($data->toc_thumbnail_url) . "'></a></p>"; | ||
} | ||
return $toc; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters