123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php /** Created by Anton on 06.03.2020. */
- $id = (int)$_GET['id'];
- $tmc = \app\models\entity\Tmc::findOne($id);
- $storage = \app\models\entity\Storage::findOne(['tmc' => $tmc->id]);
- function myQRcode($data, $matrixPointSize = 7, $errorCorrectionLevel = 'L')
- {
- $PNG_TEMP_DIR = 'temp' . DIRECTORY_SEPARATOR;
- $PNG_WEB_DIR = 'temp/';
- require "phpqrcode/qrlib.php";
- if (!file_exists($PNG_TEMP_DIR))
- mkdir($PNG_TEMP_DIR);
- if (in_array($errorCorrectionLevel, array('L', 'M', 'Q', 'H'))) {
- $matrixPointSize = min(max((int)$matrixPointSize, 1), 10);
- $data = intval($data);
- if ($data > 0) {
- $filename = $PNG_TEMP_DIR . $data . md5("tmc_inv_num|$data|$errorCorrectionLevel|$matrixPointSize") . '.png';
- QRcode::png("tmc_inv_$data", $filename, $errorCorrectionLevel, $matrixPointSize, 2);
- // QRcode::png("tmc_inv_$data", false, $errorCorrectionLevel, $matrixPointSize, 2);
- echo '<img src="' . $PNG_WEB_DIR . basename($filename) . '" /><br>';
- }
- }
- }
- ?>
- <div class="divContentScroll loco-scrol-blue">
- <div id="contentBox" class="contentBox">
- <p class="crumbs">Список устройств</p>
- <h2 class="contentHeader">Детали устройства</h2>
- <form action="/tmc/api/add_tmc.php" method="post">
- <fieldset>
- <?php
- myQRcode($tmc->inventory_num);
- ?>
- Вид устройства:
- <label class="info"><?= explode(' ', $tmc->title)[0] ?></label>
- <br clear="all">
- Инвентарный номер:
- <br>
- <label class="info"><?= $tmc->inventory_num ?></label>
- <br>
- <?php if ($tmc->ip): ?>
- IP:
- <br>
- <label class="info"><?= $tmc->ip ?></label>
- <br>
- <?php endif; ?>
- <?php if ($tmc->mac): ?>
- MAC-адрес:
- <br>
- <label class="info"><?= $tmc->mac ?></label>
- <br>
- <?php endif; ?>
- <?php if ($storage->title): ?>
- Место хранения:
- <label class="info" ><?= $storage->title ?></label>
- <br clear="all">
- <?php endif; ?>
- <?php if ($tmc->desc): ?>
- Примечание:<br>
- <textarea name="desc" disabled><?= $tmc->desc ?></textarea>
- <?php endif; ?>
- </fieldset>
- </form>
- </div>
- </div>
- <style>
- form {
- min-width: 350px;
- }
- .info {
- height: 50px;
- /*border: 1px solid #000;*/
- /*border-radius: 3px;*/
- /*border-color: #D1D1D1;*/
- font: bold 18px/22px "Neue Haas Unica W1G";
- padding: 12px 0;
- }
- form textarea {
- border: 0;
- }
- </style>
|