101 lines
3.0 KiB
PHP
Executable File
101 lines
3.0 KiB
PHP
Executable File
<?php
|
|
$this->titre = "INTER-SANTE - "._("Recherche du patient par carte") ;
|
|
?>
|
|
|
|
<form id="frmrechercheparcarte" name="frmrechercheparcarte" method="post" action="Rechercheparcarte/index/">
|
|
<INPUT style='font-size:40pt;height: 50px;' class="form-control" TYPE="text" id="donneesCarte" name="donneesCarte" autofocus AUTOCOMPLETE="OFF" placeholder="<?= _("Veuillez scanner la carte NFC!")?>">
|
|
<input id="lancerrechercheparcarte" name="lancerrechercheparcarte" class="sr-only" type="submit" value="<?= _("Rechercher") ?>" >
|
|
</form>
|
|
|
|
<?php if (isset($msgErreur) && $msgErreur>" "): ?>
|
|
<div class="alert alert-danger" style="height:38px; padding:5px;" >
|
|
<H4><?= $msgErreur ?></H4>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div>
|
|
<h1>Welcome to NFC Tools KBC - Test Page</h1>
|
|
<p>Launch NFC Tools KBC, focus this web page then scan a tag. Current status:</p>
|
|
<p id="kbc-target">Waiting for a tag</p>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
/**
|
|
* Use NFC Tools - KeyBoard Controller on a Web Page
|
|
* @author: wakdev [https://www.wakdev.com]
|
|
*
|
|
* Usage:
|
|
*
|
|
* NFCToolsKBC.getInstance().registerCallback(function(content){
|
|
* // Do what you want!
|
|
* });
|
|
*
|
|
*/
|
|
var NFCToolsKBC = (function () {
|
|
|
|
// Variables
|
|
var instance = null; // Singleton instance
|
|
var callback = null; // Callback function
|
|
var isAlreadyRegister = false; // Is event already register ?
|
|
|
|
/**
|
|
* Create instance
|
|
*/
|
|
function create () {
|
|
|
|
/**
|
|
* To register a callback function
|
|
* Usage :
|
|
*/
|
|
function registerCallback(callback) {
|
|
|
|
// Check if callback param is a function
|
|
if (typeof callback == 'function') {
|
|
this.callback = callback; // Then, save the callback reference
|
|
|
|
// Register the event if is not already registered
|
|
if(this.callback != null && !isAlreadyRegister) {
|
|
document.addEventListener('paste', (event) => {
|
|
this.callback((event.clipboardData || window.clipboardData).getData('text')); // Call the callback function
|
|
event.preventDefault(); // To block the default event handling
|
|
});
|
|
isAlreadyRegister = true; // Event is now registered
|
|
}
|
|
} else {
|
|
// You must pass a function as a callback
|
|
console.log("Error: Unable to register callback");
|
|
}
|
|
}
|
|
return {
|
|
registerCallback: registerCallback
|
|
};
|
|
}
|
|
|
|
// Get instance
|
|
return {
|
|
getInstance: function() {
|
|
if(instance == null) {
|
|
instance = create();
|
|
}
|
|
return instance; // Return singleton
|
|
}
|
|
};
|
|
})();
|
|
|
|
// Wait for the HTML document has been completely loaded and parsed
|
|
document.addEventListener("DOMContentLoaded", function(event) {
|
|
|
|
// Here we register a callback function to get the NFC tag's content
|
|
NFCToolsKBC.getInstance().registerCallback(function(content){
|
|
// Do what you want here with the content
|
|
|
|
// For the demo, we show the content in a HTML element
|
|
var target = document.getElementById("kbc-target");
|
|
target.innerHTML = "Content detected: " + content;
|
|
});
|
|
|
|
});
|
|
|
|
alert("KANE");
|
|
</script>
|