SproutCMS

This is the code documentation for the SproutCMS project

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

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\Csrf;
  19.  
  20.  
  21. if (empty($action)) {
  22. $action = 'admin/call/' . $controller_name . '/reorderSave';
  23. if (isset($id)) $action .= '/' . $id;
  24. }
  25. ?>
  26.  
  27.  
  28. <!-- Sortable list -->
  29. <script type="text/javascript">
  30. $(document).ready(function() {
  31. $("#page-reorder .tree-list").sortable({
  32. placeholder: 'ui-state-highlight'
  33. });
  34. $("#page-reorder").disableSelection();
  35. });
  36. </script>
  37.  
  38.  
  39. <form action="SITE/<?php echo $action; ?>" method="post" id="main-form">
  40. <?= Csrf::token(); ?>
  41.  
  42. <p>Drag the records around below to re-order them:</p>
  43.  
  44. <div id="page-reorder">
  45.  
  46. <ul class="tree-list tree-list-grey">
  47. <?php foreach ($items as $item): ?>
  48. <li class="node depth1">
  49. <span>
  50. <span class="node-link"><?php echo Enc::html($item['name']); ?></span>
  51. <input type="hidden" name="items[]" value="<?php echo $item['id']; ?>">
  52. </span>
  53. </li>
  54. <?php endforeach; ?>
  55. </ul>
  56.  
  57. </div>
  58.  
  59. <div class="action-bar">
  60. <button type="submit" class="button button-regular button-green icon-after icon-save">Save changes</button>
  61. </div>
  62. </form>
  63.