Initial import
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php if (!empty($_GET['webview_mode'])): ?>
|
||||
<?php
|
||||
/**
|
||||
* @var $title
|
||||
* @var $close
|
||||
*/
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
header, .page-header, footer, .cart, .mobile-logo {display: none !important;}
|
||||
.main-profile-panel, .booking-panel { margin: 0 !important; !important;}
|
||||
.content {width: calc(100% - 20px) !important; padding: 60px 10px 10px 10px !important;}
|
||||
.panel-box { background: #FFFFFF; border: 0}
|
||||
.header-app {
|
||||
background: #FFFFFF;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
position: fixed;
|
||||
box-shadow: 0 5px 10px rgba(0,0,0, 0.4);
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.close-browser-in-app {
|
||||
position: absolute;
|
||||
color: #FFFFFF;
|
||||
background: #000000;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
|
||||
right: 15px;
|
||||
top: 14px;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
border-radius: 5px !important;
|
||||
}
|
||||
.close-browser-in-app .la-times {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.footer-logos { display: none !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<link rel="stylesheet" href="/_public/assets/fonts/line-awesome/css/line-awesome.min.css">
|
||||
|
||||
<script>
|
||||
const closeBrowseBtn = document.createElement('div');
|
||||
closeBrowseBtn.className = 'close-browser-in-app';
|
||||
closeBrowseBtn.innerHTML = '<i class="la la-times"></i>';
|
||||
closeBrowseBtn.addEventListener('click', () => {
|
||||
window.location.href = '<?= Yii::$app->params['portal'] ?>/bg/mobile-api/browser-close/'
|
||||
})
|
||||
const headerApp = document.createElement('div');
|
||||
headerApp.className = 'header-app';
|
||||
headerApp.innerHTML = '<?= $close ?>'
|
||||
headerApp.appendChild(closeBrowseBtn);
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
document.body.appendChild(headerApp);
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
$domain = 'cms.nasle.eu:88';
|
||||
$endpoints = [
|
||||
/*
|
||||
'categories' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/categories',
|
||||
'Method' => 'GET'
|
||||
],
|
||||
'categories-tree' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/categories-tree/',
|
||||
'Method' => 'GET'
|
||||
],
|
||||
'object-types' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-types/',
|
||||
'Method' => 'GET',
|
||||
'Required parameters' => 'sub_category_id'
|
||||
],
|
||||
'object-template-create' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-template/create/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
*/
|
||||
'main-category-create' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/main-category/create/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
'main-category-update' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/main-category/update/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
'main-category-delete' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/main-category/delete/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_category_id": (int),
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
'sub-category-create' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/sub-category/create/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_category_id": (int),
|
||||
"rr_sub_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
'sub-category-update' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/sub-category/update/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_sub_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
],
|
||||
'sub-category-delete' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/sub-category/delete/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_sub_category_id": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
]
|
||||
,'object-template-create' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/object-template/create/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_ot_id": (int),
|
||||
"heritage_type": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}',
|
||||
'Info' => "
|
||||
<strong>heritage_type options:</strong>
|
||||
|
||||
1 => 'Недвижимо наследсвто',
|
||||
2 => 'Движимо материално наследство',
|
||||
3 => 'Движимо нематериално наследство',
|
||||
4 => 'Природно наследство'
|
||||
"],
|
||||
'object-template-update' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/object-template/update/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_ot_id": (int),
|
||||
"heritage_type": (int),
|
||||
"name":"(string)",
|
||||
"name_en":"(string)"
|
||||
}',
|
||||
'Response' => '{"success": 1}',
|
||||
],
|
||||
'object-template-delete' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api-sync/object-template/delete/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Header parameters' => 'api_token',
|
||||
'Required format' => '
|
||||
{
|
||||
"rr_ot_id": (int)
|
||||
}',
|
||||
'Response' => '{"success": 1}'
|
||||
]
|
||||
/*
|
||||
'object-create' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-create/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Required format' => 'register_id, '
|
||||
],
|
||||
'object-retrieve' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-retrieve/',
|
||||
'Method' => 'GET',
|
||||
'Required parameters' => 'id'
|
||||
],
|
||||
'object-update' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-update/',
|
||||
'Method' => 'POST',
|
||||
'Content type' => 'json',
|
||||
'Required format' => ''
|
||||
],
|
||||
'object-delete' => [
|
||||
'Domain' => $domain,
|
||||
'Url' => '/api/object-delete/',
|
||||
'Method' => 'POST',
|
||||
'Required parameter' => 'register_id'
|
||||
]
|
||||
*/
|
||||
];
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Nasledstvo Api</title>
|
||||
<link href="/_public/assets/css/api.css" rel="stylesheet">
|
||||
<script src="/_public/assets/js/api.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
<div class="left-navbar">
|
||||
<div class="left-bar-header">Nasledstvo Api</div>
|
||||
<?php foreach ($endpoints as $id => $endpoint): ?>
|
||||
<a onclick="setActive()" data-id="<?= $id ?>" class="link-to" href="#<?= $id ?>"><?= $id ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="content">
|
||||
<?php foreach ($endpoints as $id => $endpoint): ?>
|
||||
<div id="<?= $id ?>" class="endpoint-container">
|
||||
<div class="endpoint">
|
||||
<div class="header"><?= $id ?></div>
|
||||
<div class="body">
|
||||
<?php foreach ($endpoint as $key => $value): ?>
|
||||
<div class="row">
|
||||
<div class="key"><?= $key ?></div>
|
||||
<?php if ($key == 'Required format' || $key == 'Response' || $key == 'Info'): ?>
|
||||
<div class="value json-format">
|
||||
<pre><?= $value ?></pre>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="value <?= $value == 'GET' || 'POST' ? $value : '' ?>"><?= $value ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
setActive();
|
||||
})
|
||||
|
||||
function setActive() {
|
||||
setTimeout(function () {
|
||||
const url = window.location.href.split('#');
|
||||
console.log(url)
|
||||
document.querySelectorAll('.link-to').forEach(e => {
|
||||
if (url[1] && e.dataset.id === url[1]) {
|
||||
e.classList.add('active')
|
||||
} else {
|
||||
e.classList.remove('active')
|
||||
}
|
||||
})
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var \app\models\RegisterObjectFiles $objectFile */
|
||||
|
||||
//if (!empty($_GET['preview']) && $_GET['preview'] == 'pdf') {
|
||||
$file = $objectFile->file_url;
|
||||
$filename = $objectFile->video_title ?? 'PDF файл';
|
||||
header('Content-type: application/pdf');
|
||||
header('Content-Disposition: inline; filename="' . $filename . '"');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Accept-Ranges: bytes');
|
||||
@readfile($file);
|
||||
exit;
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* @var $id
|
||||
*/
|
||||
|
||||
use app\services\JWT;
|
||||
|
||||
?>
|
||||
<?php
|
||||
$message = ['bg' => 'Зареждане', 'en' => 'Loading'];
|
||||
$close = ['bg' => 'Затвори', 'en' => 'Close'];
|
||||
$lg = $_GET['lg'] ?? 'bg';
|
||||
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: #000000;
|
||||
}
|
||||
|
||||
.model-loading-progress {
|
||||
position: fixed;
|
||||
width: calc(100% - 20px);
|
||||
padding: 40px;
|
||||
background: rgba(204, 204, 204, 0.13);
|
||||
z-index: 100;
|
||||
bottom: 100px;
|
||||
|
||||
}
|
||||
|
||||
.model-loading-progress-load {
|
||||
background: #857750;
|
||||
height: 5px;
|
||||
width: 0;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.loading-message {
|
||||
font-size: 20px;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.loading-dots { display: flex; margin-top: -12px; margin-left: 5px}
|
||||
.loading-dots i {
|
||||
font-size: 30px;
|
||||
color: #FFFFFF;
|
||||
display: block;
|
||||
font-style: normal;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.loading-dots i {
|
||||
animation-name: blink;
|
||||
animation-duration: 1.4s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-fill-mode: both;
|
||||
transform: scale(1);
|
||||
}
|
||||
.loading-dots i:nth-child(2) { animation-delay: .2s; }
|
||||
.loading-dots i:nth-child(3) { animation-delay: .4s; }
|
||||
|
||||
@keyframes blink {
|
||||
0% {
|
||||
opacity: .1;
|
||||
}
|
||||
20% {
|
||||
opacity: 1;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
100% {
|
||||
opacity: .1;
|
||||
}
|
||||
}
|
||||
.model-title {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: 100px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
|
||||
<model-viewer id="modelView" style="width: 100%; height: 100%" src="/api/stream-file/<?= $id ?>/" shadow-intensity="1"
|
||||
camera-controls touch-action="pan-y" slot="progress-bar"></model-viewer>
|
||||
<div class="model-loading-progress">
|
||||
<div class="loading-message"><?= $message[$lg] ?> <span class="loading-dots"><i>.</i><i>.</i><i>.</i></span></div>
|
||||
<div class="model-loading-progress-load"></div>
|
||||
</div>
|
||||
<script>
|
||||
const modelView = document.querySelector('#modelView');
|
||||
const modelLoadingProgress = document.querySelector('.model-loading-progress');
|
||||
const modelLoadingProgressLoad = document.querySelector('.model-loading-progress-load');
|
||||
modelView.addEventListener('progress', (event) => {
|
||||
if (event.detail && event.detail.totalProgress) {
|
||||
modelLoadingProgressLoad.setAttribute('style', `width: ${100*event.detail.totalProgress}%`)
|
||||
}
|
||||
})
|
||||
modelView.addEventListener('load', () => {
|
||||
modelLoadingProgress.remove()
|
||||
}, true)
|
||||
</script>
|
||||
|
||||
<?= $this->render('/api/_mobile_view_mode', ['close' => $close[$lg], 'lg' => $lg]) ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var \app\models\RegisterObjectFiles $objectFile */
|
||||
|
||||
$filename = $objectFile->video_title ?? '3D Model';
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: inline; filename="3d model"');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Accept-Ranges: bytes');
|
||||
@readfile($objectFile->file_url);
|
||||
exit;
|
||||
Reference in New Issue
Block a user