galleryManager.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. /**
  3. * @var $this View
  4. * @var $js string
  5. * @author Bogdan Savluk <savluk.bogdan@gmail.com>
  6. */
  7. use yii\helpers\Html;
  8. use yii\web\View;
  9. $gid = $this->context->model->galleryId;
  10. //print_a($this->context->model->galleryId);
  11. ?>
  12. <?php echo Html::beginTag('div', $this->context->options); ?>
  13. <!-- Gallery Toolbar -->
  14. <div class="btn-toolbar" style="padding:4px">
  15. <div class="btn-group" style="display: inline-block;">
  16. <div class="btn btn-success btn-file" style="display: inline-block">
  17. <i class="glyphicon glyphicon-plus"></i><?php echo Yii::t('galleryManager/main', 'Add…'); ?>
  18. <input type="file" name="gallery-image" class="afile" accept="image/*" multiple="multiple"/>
  19. </div>
  20. <div class="btn btn-success" style="display: inline-block">
  21. <i class="glyphicon glyphicon-plus"></i>
  22. <div id="addslid" data-toggle="modal" data-target="#md-<?=$this->context->options['id']?>">Добавить html</div>
  23. </div>
  24. </div>
  25. <div class="btn-group" style="display: inline-block;">
  26. <label class="btn btn-default">
  27. <input type="checkbox" style="margin-right: 4px;" class="select_all"><?php echo Yii::t(
  28. 'galleryManager/main',
  29. 'Select all'
  30. ); ?>
  31. </label>
  32. <div class="btn btn-default disabled edit_selected">
  33. <i class="fas fa-edit"></i> <?php echo Yii::t('galleryManager/main', 'Edit'); ?>
  34. </div>
  35. <div class="btn btn-default disabled remove_selected">
  36. <i class="fas fa-trash"></i> <?php echo Yii::t('galleryManager/main', 'Remove'); ?>
  37. </div>
  38. </div>
  39. </div>
  40. <hr/>
  41. <!-- Gallery Photos -->
  42. <div class="sorter">
  43. <div class="images"></div>
  44. <br style="clear: both;"/>
  45. </div>
  46. <!-- Modal window to edit photo information -->
  47. <div class="editor-modal modal fade">
  48. <div class="modal-dialog">
  49. <div class="modal-content">
  50. <div class="modal-header">
  51. <a class="close" data-dismiss="modal">×</a>
  52. <h3 class="modal-title"><?php echo Yii::t('galleryManager/main', 'Edit information') ?></h3>
  53. </div>
  54. <div class="modal-body">
  55. <div class="form"></div>
  56. </div>
  57. <div class="modal-footer">
  58. <a href="#" class="btn btn-primary save-changes">
  59. <?php echo Yii::t('galleryManager/main', 'Save changes') ?>
  60. </a>
  61. <a href="#" class="btn" data-dismiss="modal"><?php echo Yii::t(
  62. 'galleryManager/main',
  63. 'Close'
  64. ) ?></a>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="overlay">
  70. <div class="overlay-bg">&nbsp;</div>
  71. <div class="drop-hint">
  72. <span class="drop-hint-info"><?php echo Yii::t('galleryManager/main', 'Drop Files Here…') ?></span>
  73. </div>
  74. </div>
  75. <div class="progress-overlay">
  76. <div class="overlay-bg">&nbsp;</div>
  77. <!-- Upload Progress Modal-->
  78. <div class="modal progress-modal">
  79. <div class="modal-dialog">
  80. <div class="modal-content">
  81. <div class="modal-header">
  82. <h3><?php echo Yii::t('galleryManager/main', 'Uploading images…') ?></h3>
  83. </div>
  84. <div class="modal-body">
  85. <div class="progress ">
  86. <div class="progress-bar progress-bar-info progress-bar-striped active upload-progress"
  87. role="progressbar">
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="sl-modal-<?=$this->context->options['id']?> modal fade" id="md-<?=$this->context->options['id']?>">
  96. <div class="modal-dialog modal-lg">
  97. <div class="modal-content">
  98. <div class="modal-header">
  99. <h4 class="modal-title">Создание слайда в <?=$this->context->options['id']?></h4>
  100. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  101. </div>
  102. <div class="modal-body">
  103. <div class="form"><div class="photo-editor row"><div class="col-xs-4"><div class="col-xs-8"><div class="form-group">
  104. <label class="control-label" for="photo_name_<?=$this->context->options['id']?>">Название:</label>
  105. <input class="form-control" type="text" name="photo[<?=$this->context->options['id']?>][name]" value="" id="photo_name_<?=$this->context->options['id']?>"></div>
  106. <div class="form-group"><label class="control-label" for="photo_description_<?=$this->context->options['id']?>">Описание:</label>
  107. <textarea class="form-control" name="photo[<?=$this->context->options['id']?>][description]" rows="3" cols="80" id="photo_description_<?=$this->context->options['id']?>"></textarea>
  108. </div>
  109. </div></div></div></div>
  110. <div class="modal-footer justify-content-between">
  111. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  112. <button type="button" class="btn btn-primary savehtml" data-onClick='slSave("<?=$this->context->options['id']?>", <?=$gid?>)' rel-mid="<?=$this->context->options['id']?>" rel-id=<?=$gid?>>Save changes</button>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <?php echo Html::endTag('div'); ?>
  119. <!-- Расположите это -->
  120. <div class="position-fixed p-3" style="bottom: 0; right: 0; z-index: 1000;" id="notycont">
  121. <div class="toast hide fade" role="status" aria-live="assertive" aria-atomic="true" data-autohide="false" id="noty0" style="min-width:300px;">
  122. <div class="toast-header">
  123. <strong class="mr-auto">Загрузка</strong>
  124. <small class="text-muted">Загружаю</small>
  125. </div>
  126. <div class="toast-body">
  127. Увидеть? Именно так.
  128. </div>
  129. <div class="progress" style="height: 3px;">
  130. <div class="progress-bar" style="width: 0%"></div>
  131. </div>
  132. </div>
  133. </div>
  134. <script>
  135. if(typeof $().galleryManager !== 'undefined'){
  136. <?=$js?>
  137. }
  138. function slSave(e, id, obj){
  139. title = $("input[name='photo["+e+"][name]']").val();
  140. description = $("textarea[name='photo["+e+"][description]']").val();
  141. $.ajax( 'ajaxgalleryslide?id='+e+'&gid='+id+'&title='+title+'&description='+description).done(function( data ) {
  142. d = JSON.parse(data);
  143. $('#md-'+d.id).modal('hide');
  144. obj(d.id, null, d.title, d.description, 0);
  145. });
  146. }
  147. </script>