123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use yii\web\View;
- use app\helpers\Transliterator;
- $this->title = 'Tilda';
- $this->params['breadcrumbs'][] = ['label' => 'Tilda', 'url' => ['index'] ];
- $this->params['breadcrumbs'][] = 'Конфигурация';
- $main = $api->getpageexport($pages[0]);
- $cat = Transliterator::toUrl($main['title'].'-'.$main['id']);
- // $cat = '';
- ?>
- <div class="row">
- <div class="col-md-12">
- <div class="callout callout-danger">
- <h5>Настройка экспорта</h5>
- <p>Необходимо выбрать папку хранения проекта, и указать главную страницу входа в проект</p>
- </div>
- </div>
- </div>
- <?php $form = ActiveForm::begin([
- 'method' => 'post',
- 'action' => ['tilda/exportstart'],
- 'id' => 'eform'
- ]); ?>
- <div class="row">
- <input type="hidden" value="<?=$proj?>" name="proj">
- <div class="col">
- <div class="card card-success">
- <div class="card-header">
- <h3 class="card-title">Папка проекта</h3>
- </div>
- <div class="card-body">
- <div class="form-group">
- <label class="form-text-label" for="urltext">Каталог хранения проекта</label><input class="form-control form-control-lg" type="text" value="<?=$cat?>" id="urltext" name="url">
- </div>
- <div class="form-group">
- <label class="form-text-label" for="cats">Обновить существующий</label>
- <select class="form-control" id="cats">
- <option value="<?=$cat?>">Новая</option>
- <?
- $curcat = $api->local->getProjectFullDir();
- $cat = yii\helpers\FileHelper::findDirectories($curcat, ['recursive'=>false]);
- foreach( $cat as $url){
- $inx = $url.'/'.'index.html';
- if( file_exists( $inx ) ){
- if( $f = basename( @readlink( $url.'/'.'index.html') ) ){
- $fm = str_replace( '.html', '.php', $f );
- //echo $fm."<br>";
- if( file_exists( $url.'/meta/'.$fm ) ){
- $r = include($url.'/meta/'.$fm);
- $dname = basename($url);
- ?>
- <option value="<?=$dname?>"><?=$r['title']?></option>
- <?
- }
- }
- }
- }
- // print_a($cat);
- ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <?
- foreach($pages as $k=>$i){
- $item = $api->getpageexport($i);
- // print_a($item);
- ?>
- <div class="col-md-6">
- <div class="card card-widget widget-user-2">
- <div class="card-header">
- <h3 class="card-title">
- <input type="hidden" value="<?=$item['id']?>" name="Check[]">
- <div class="form-check">
- <input class="form-check-input" type="radio" name="main" <?=($k==0)?'checked=""':''?> value="<?=$item['id']?>" data-url="<?=Transliterator::toUrl($item['title'].'-'.$item['id']);?>">
- <label class="form-check-label">Главная страница</label>
- </div>
- </h3>
- </div>
- <div class="attachment-block clearfix">
- <?
- if( isset( $item['img'] ) && $item['img'] != '' ){
- $img = $item['img'];
- $img = str_replace( basename($img), '-/resize/160x/'.basename($img), $img );
- //
- //-/resize/160x/
- ?>
- <img src="<?=$img?>" class="attachment-img m-2">
- <?
- }
- ?>
- <h3 class="widget-user-username"><?=$item['title']?></h3>
- <p class="mx-2"><?=$item['date']?></p>
- <div class="card-footer p-0">
- <div class="card-body">
- <p><?=$item['filename']?></p>
- <?=$item['descr']?>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?
- //print_a($item);
- }
- ?>
- </div>
- <div class="form-group m-4">
- <?= Html::submitButton('Экспорт', ['class' => 'btn btn-success', 'id' => 'submitbtn']) ?>
- </div>
- <?php ActiveForm::end();
- $this->registerJs(
- <<<JS
- function sel(e){
- // console.log( );
- $( '#urltext' ).val($(this).attr("data-url"));
- }
- $("[name='main']").change( sel );
- $('#cats').on('change', function() {
- $( '#urltext' ).val(this.value);
- });
- $('#eform').on('submit', function() {
- console.log('end');
- $('#endModal').css('display', 'block');
- $('#endModal').modal('show');
- return true;
- });
- JS
- ,
- View::POS_READY,
- 'translit'
- );
- ?>
- <div class="modal fade" tabindex="-1" style="display: none;" aria-hidden="true" id="endModal">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">Начинается Экспорт</h5>
- </div>
- <div class="modal-body p-5">
- <div class="overlay">
- <div class="spinner-border text-secondary m-3" role="status">
- <span class="sr-only"></span>
- </div>
- <h2>Экспорт проекта ...</h2><br><br>
- </div>
- </div>
- </div>
- </div>
- </div>
|