settings_index.tpl 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {% set admin_chamilo_announcements_disable = 'admin_chamilo_announcements_disable'|api_get_configuration_value %}
  2. <script>
  3. $(document).ready(function () {
  4. $.ajax({
  5. url: '{{ web_admin_ajax_url }}?a=version',
  6. success: function (version) {
  7. $(".admin-block-version").html(version);
  8. }
  9. });
  10. {% if _u.is_admin %}
  11. (function (CKEDITOR) {
  12. CKEDITOR.replace('extra_content');
  13. var extraContentEditor = CKEDITOR.instances.extra_content;
  14. $('button.admin-edit-block').on('click', function (e) {
  15. e.preventDefault();
  16. var $self = $(this);
  17. var extraContent = $.ajax('{{ _p.web_ajax }}admin.ajax.php', {
  18. type: 'post',
  19. data: {
  20. a: 'get_extra_content',
  21. block: $self.data('id')
  22. }
  23. });
  24. $.when(extraContent).done(function (content) {
  25. extraContentEditor.setData(content);
  26. $('#extra-block').val($self.data('id'));
  27. $('#modal-extra-title').text($self.data('label'));
  28. $('#modal-extra').modal('show');
  29. });
  30. });
  31. })(window.CKEDITOR);
  32. {% if not admin_chamilo_announcements_disable %}
  33. $
  34. .ajax('{{ web_admin_ajax_url }}?a=get_latest_news')
  35. .then(function (response) {
  36. if (!response.length) {
  37. return;
  38. }
  39. $('#chamilo-news').show(150);
  40. $('#chamilo-news-content').html(response);
  41. });
  42. {% endif %}
  43. {% endif %}
  44. });
  45. </script>
  46. <section id="settings" class="row">
  47. {% set columns = 2 %}
  48. {% for block_item in blocks %}
  49. {% if block_item.items %}
  50. <div id="tabs-{{ loop.index }}" class="settings-block col-md-6">
  51. <div class="panel panel-default {{ block_item.class }}">
  52. <div class="panel-heading">
  53. {{ block_item.icon }} {{ block_item.label }}
  54. {% if block_item.editable and _u.is_admin %}
  55. <button type="button" class="btn btn-link btn-sm admin-edit-block pull-right"
  56. data-label="{{ block_item.label }}" data-id="{{ block_item.class }}">
  57. <img src="{{ "edit.png"|icon(22) }}" width="22" height="22" alt="{{ "Edit"|get_lang }}"
  58. title="{{ "Edit"|get_lang }}"/>
  59. </button>
  60. {% endif %}
  61. </div>
  62. <div class="panel-body">
  63. <div style="display: block;">
  64. {{ block_item.search_form }}
  65. </div>
  66. {% if block_item.items is not null %}
  67. <div class="block-items-admin">
  68. <ul class="list-items-admin">
  69. {% for url in block_item.items %}
  70. <li>
  71. <a href="{{ url.url }}">
  72. {{ url.label }}
  73. </a>
  74. </li>
  75. {% endfor %}
  76. </ul>
  77. </div>
  78. {% endif %}
  79. {% if block_item.extra is not null %}
  80. <div>
  81. {{ block_item.extra }}
  82. </div>
  83. {% endif %}
  84. {% if block_item.extraContent %}
  85. <div>{{ block_item.extraContent }}</div>
  86. {% endif %}
  87. </div>
  88. </div>
  89. </div>
  90. {% endif %}
  91. {% endfor %}
  92. </section>
  93. {% if not admin_chamilo_announcements_disable %}
  94. <section id="chamilo-news" style="display: none;">
  95. <div class="alert alert-info">
  96. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  97. <span aria-hidden="true">&times;</span>
  98. </button>
  99. <div id="chamilo-news-content"></div>
  100. </div>
  101. </section>
  102. {% endif %}
  103. {% if _u.is_admin %}
  104. <div class="modal fade" id="modal-extra">
  105. <div class="modal-dialog">
  106. <div class="modal-content">
  107. <div class="modal-header">
  108. <button type="button" class="close" data-dismiss="modal" aria-label="{{ 'Close'|get_lang }}">
  109. <span aria-hidden="true">&times;</span>
  110. </button>
  111. <h4 class="modal-title" id="modal-extra-title">{{ 'Blocks'|get_lang }}</h4>
  112. </div>
  113. <div class="modal-body">
  114. {{ extraDataForm }}
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. {% endif %}