static-pages.html.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. $("#saveButton").click(function(){
  14. $.ajax({
  15. type: 'POST',
  16. url: '<?php echo site_url();?>admin/pages',
  17. dataType: 'json',
  18. data: {'json': order},
  19. success: function (response) {
  20. alert(response.message);
  21. location.reload();
  22. },
  23. });
  24. });
  25. });
  26. </script>
  27. <?php if (isset($_SESSION[site_url()]['user'])):?>
  28. <?php $posts = find_page();
  29. if (!empty($posts)): ?>
  30. <table class="table post-list" id="sortable">
  31. <thead>
  32. <tr class="head" id="head">
  33. <th><?php echo i18n('Title');?> </th>
  34. <?php if (config("views.counter") == "true"): ?>
  35. <th><?php echo i18n('Views');?></th>
  36. <?php endif; ?>
  37. <th><?php echo i18n('Operations');?></th>
  38. <th>Sub <?php echo i18n('pages');?></th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <?php foreach ($posts as $p):?>
  43. <?php $dd = find_subpage($p->slug); ?>
  44. <?php $dr = find_draft_subpage($p->slug);?>
  45. <tr id="<?php echo $p->md;?>" class="sort-item" style="cursor:move;">
  46. <td><a href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>"><?php echo $p->title;?></a></td>
  47. <?php if (config("views.counter") == "true"):?><td><?php echo $p->views;?></td><?php endif;?>
  48. <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>
  49. <td>
  50. <?php foreach ($dd as $sp):?>
  51. <div class="row">
  52. <div class="col-sm">
  53. <span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
  54. </div>
  55. <?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;?>
  56. <div class="col-sm">
  57. <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>
  58. </div>
  59. </div>
  60. <?php endforeach;?>
  61. </td>
  62. </tr>
  63. <?php endforeach;?>
  64. </tbody>
  65. </table>
  66. <br>
  67. <button class="btn btn-primary" style="display:none" id="saveButton"><?php echo i18n('save_config');?></button>
  68. <?php endif;?>
  69. <?php endif;?>