Просмотр файла htmly-2.9.8/system/admin/views/static-pages.html.php

Размер файла: 3.7Kb
  1. <?php if (!defined('HTMLY')) die('HTMLy'); ?>
  2. <?php echo '<h2>' . i18n('Static_pages') . '</h2>';?>
  3. <br>
  4. <a class="btn btn-primary right" href="<?php echo site_url();?>add/page"><?php echo i18n('Add_new_page');?></a>
  5. <br><br>
  6. <script>
  7. $(function() {
  8. var order;
  9. $( "tbody" ).sortable({update: function(e, ui) {
  10. order = $(this).sortable('toArray');
  11. $("#saveButton").css({"display": "block"});
  12. }});
  13.  
  14. $("#saveButton").click(function(){
  15. $.ajax({
  16. type: 'POST',
  17. url: '<?php echo site_url();?>admin/pages',
  18. dataType: 'json',
  19. data: {'json': order},
  20. success: function (response) {
  21. alert(response.message);
  22. location.reload();
  23. },
  24. });
  25. });
  26. });
  27. </script>
  28. <?php if (isset($_SESSION[site_url()]['user'])):?>
  29. <?php $posts = find_page();
  30. if (!empty($posts)): ?>
  31. <table class="table post-list" id="sortable">
  32. <thead>
  33. <tr class="head" id="head">
  34. <th><?php echo i18n('Title');?> </th>
  35. <?php if (config("views.counter") == "true"): ?>
  36. <th><?php echo i18n('Views');?></th>
  37. <?php endif; ?>
  38. <th><?php echo i18n('Operations');?></th>
  39. <th>Sub <?php echo i18n('pages');?></th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <?php foreach ($posts as $p):?>
  44. <?php $dd = find_subpage($p->slug); ?>
  45. <?php $dr = find_draft_subpage($p->slug);?>
  46. <tr id="<?php echo $p->md;?>" class="sort-item" style="cursor:move;">
  47. <td><a href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>"><?php echo $p->title;?></a></td>
  48. <?php if (config("views.counter") == "true"):?><td><?php echo $p->views;?></td><?php endif;?>
  49. <td><a class="btn btn-primary btn-xs" href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>"><?php echo i18n('page');?> <?php echo i18n('settings');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/add?destination=admin/pages/<?php echo $p->slug;?>"><?php echo i18n('Add_sub');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <?php if (empty($dd) && empty($dr)):?><a class="btn btn-danger btn-xs" href="<?php echo $p->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a><?php endif;?></td>
  50. <td>
  51. <?php foreach ($dd as $sp):?>
  52. <div class="row">
  53. <div class="col-sm">
  54. <span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
  55. </div>
  56. <?php if (config("views.counter") == "true"):?><div class="col-sm"><i class="fa fa-line-chart" aria-hidden="true"></i> <?php echo $sp->views;?></div><?php endif;?>
  57. <div class="col-sm">
  58. <span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $sp->parentSlug;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $sp->parentSlug;?>"><?php echo i18n('Delete');?></a></span>
  59. </div>
  60. </div>
  61. <?php endforeach;?>
  62. </td>
  63. </tr>
  64. <?php endforeach;?>
  65. </tbody>
  66. </table>
  67. <br>
  68. <button class="btn btn-primary" style="display:none" id="saveButton"><?php echo i18n('save_config');?></button>
  69. <?php endif;?>
  70. <?php endif;?>