SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/admin/tree_organise.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13. use Sprout\Helpers\AdminAuth;
  14. use Sprout\Helpers\Csrf;
  15. use Sprout\Helpers\Enc;
  16. use Sprout\Helpers\Needs;
  17.  
  18.  
  19. Needs::fileGroup('jstree');
  20. Needs::fileGroup('page_organise');
  21.  
  22. echo '<script>admin_auth = {is_remote: ', (AdminAuth::isSuper() ? 'true' : 'false'), '};</script>';
  23. ?>
  24.  
  25. <form id="main-form" action="SITE/admin/call/<?= Enc::html($controller_name); ?>/organiseAction" method="post" class="-clearfix">
  26. <?php echo Csrf::token(); ?>
  27.  
  28. <input type="hidden" name="data" value="" id="hidden-data">
  29.  
  30. <div class="mainbar-with-right-sidebar">
  31.  
  32. <div id="jstree_demo_div" class="white-box">
  33. <ul>
  34. <?php
  35. // Basic recursive tree node renderer in the format which jsTree expects
  36. function node($nd) {
  37. echo '<li id="', $nd['id'], '">', $nd['name'];
  38. if (count($nd->children)) {
  39. echo '<ul>';
  40. foreach ($nd->children as $child) {
  41. node($child);
  42. }
  43. echo '</ul>';
  44. }
  45. echo '</li>';
  46. }
  47.  
  48. // Render the top-level pages
  49. foreach ($root->children as $child) {
  50. node($child);
  51. }
  52. ?>
  53. </ul>
  54. </div>
  55.  
  56. <div class="del"></div>
  57.  
  58. </div>
  59.  
  60. <div class="right-sidebar">
  61. <div class="right-sidebar-anchor"></div>
  62. <div class="right-sidebar-inner">
  63. <div class="save-changes-box">
  64. <h2 class="icon-before icon-open_with">Organise</h2>
  65. <div class="save-changes-box-bottom -clearfix">
  66. <button type="submit" class="save-changes-save-button button button-regular button-green icon-after icon-save">Save changes</button>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71.  
  72. </form>
  73.