0

Using QR-Code integration also in your vufind

Posted by Oliver Goldschmidt on 17. Februar 2011 in Allgemein @en |

As we reported we have integrated QR-Codes in TUBfind. How does that work? We are using a PHP implementation of a QR-Code-generator, which is available as OpenSource (QR-Class by Y. Swetake). This can be copied to the vufind application on the webserver – on our machine I have copied the sources into these directories:
qr_img.php -> to driectory web
data -> to directory sys
image -> to directory images

The following method must be inserted into RecordDrivers/IndexRecord.php:
public function getQRString() {
global $configArray;
global $interface;

$dates = $this->getPublicationDates();
$qrstring = rawurlencode($this->getPrimaryAuthor().“: „.$this->getShortTitle().“ / „.$dates[0].“ – „.$configArray[‚Site‘][‚url‘].$configArray[‚Site‘][‚path‘].“/Record/“.$this->getUniqueID());

return $qrstring;
}

The following line has to be pasted into services/Record/Record.php (e.g. behind the line $interface->assign(‚openURL‘, $this->recordDriver->getOpenURL());):
$interface->assign(‚qr‘, $this->recordDriver->getQRString());

In your theme template (web/interface/themes/~theme~/RecordDrivers/Index/core.tpl) you need the following sourcecode:
<tr valign=“top“>
<th>{translate text=’QR-Code‘}: </th>
<td>
<span class=“showqr“>
<a href=“#“ onClick=’document.getElementById(„qrcode“).style.display = „block“; document.getElementById(„showqr“).style.display = „none“; document.getElementById(„hideqr“).style.display = „block“;‘ id=“showqr“>{translate text=“Show QR-Code“}</a>
<a href=“#“ onClick=’document.getElementById(„qrcode“).style.display = „none“; document.getElementById(„hideqr“).style.display = „none“; document.getElementById(„showqr“).style.display = „block“;‘ style=“display:none;“ id=“hideqr“>{translate text=“Hide QR-Code“}</a>
</span>
<div id=“qrcode“ style=“display:none“>
<img alt=“QR-Image of this book“ src=“{$path}/qr_img.php?d={$qr}“>
</div>
</td>
</tr>

If you are using a special language, you should put the following lines into your language file (e.g. lang/de.ini for german language):

QR-Code = „QR-Code“
Show QR-Code = „QR-Code zeigen“
Hide QR-Code = „QR-Code verbergen“

Finito!

Warning: If you copy and paste the code above, the quotation marks (double and single ones) might be exchanged with non-conform characters. the code has to be corrected manually when you paste it to the vufind sources! Or you can use a patchfile for Vufind 1.0.1: QR-Code-Patch Vufind 1.0.1. Save this file to the vufind main directory and execute the following command patch -p0 < vufind-1.0.1_qrcode.txt (without warranty!).

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

*

Copyright © 2010-2023 tub.find Blog All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.