/theme/boost/classes/output/core/files_renderer.php

https://gitlab.com/unofficial-mirrors/moodle · PHP · 140 lines · 45 code · 15 blank · 80 comment · 1 complexity · 5609ed437a634d143a1c349dc7309127 MD5 · raw file

  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. namespace theme_boost\output\core;
  17. use plugin_renderer_base;
  18. defined('MOODLE_INTERNAL') || die();
  19. require_once($CFG->dirroot . '/files/renderer.php');
  20. /**
  21. * Rendering of files viewer related widgets.
  22. * @package theme_boost
  23. * @copyright 2016 Damyon Wiese
  24. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25. */
  26. /**
  27. * Rendering of files viewer related widgets.
  28. * @package theme_boost
  29. * @copyright 2016 Damyon Wiese
  30. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  31. */
  32. class files_renderer extends \core_files_renderer {
  33. /**
  34. * FileManager JS template for window with file information/actions.
  35. *
  36. */
  37. protected function fm_js_template_fileselectlayout() {
  38. $context = [
  39. 'helpicon' => $this->help_icon('setmainfile', 'repository')
  40. ];
  41. return $this->render_from_template('core/filemanager_fileselect', $context);
  42. }
  43. /**
  44. * FileManager JS template for popup confirm dialogue window.
  45. *
  46. * @return string
  47. */
  48. protected function fm_js_template_confirmdialog() {
  49. return $this->render_from_template('core/filemanager_confirmdialog', []);
  50. }
  51. /**
  52. * Template for FilePicker with general layout (not QuickUpload).
  53. *
  54. *
  55. * @return string
  56. */
  57. protected function fp_js_template_generallayout() {
  58. return $this->render_from_template('core/filemanager_modal_generallayout', []);
  59. }
  60. /**
  61. * Returns html for displaying one file manager
  62. *
  63. * @param form_filemanager $fm
  64. * @return string
  65. */
  66. protected function fm_print_generallayout($fm) {
  67. $context = [
  68. 'client_id' => $fm->options->client_id,
  69. 'helpicon' => $this->help_icon('setmainfile', 'repository'),
  70. 'restrictions' => $this->fm_print_restrictions($fm)
  71. ];
  72. return $this->render_from_template('core/filemanager_page_generallayout', $context);
  73. }
  74. /**
  75. * Returns HTML for default repository searchform to be passed to Filepicker
  76. *
  77. * This will be used as contents for search form defined in generallayout template
  78. * (form with id {TOOLSEARCHID}).
  79. * Default contents is one text input field with name="s"
  80. */
  81. public function repository_default_searchform() {
  82. return $this->render_from_template('core/filemanager_default_searchform', []);
  83. }
  84. /**
  85. * FilePicker JS template for 'Upload file' repository
  86. *
  87. * @return string
  88. */
  89. protected function fp_js_template_uploadform() {
  90. return $this->render_from_template('core/filemanager_uploadform', []);
  91. }
  92. /**
  93. * FilePicker JS template for repository login form including templates for each element type
  94. *
  95. * @return string
  96. */
  97. protected function fp_js_template_loginform() {
  98. return $this->render_from_template('core/filemanager_loginform', []);
  99. }
  100. /**
  101. * FilePicker JS template for window appearing to select a file.
  102. *
  103. * @return string
  104. */
  105. protected function fp_js_template_selectlayout() {
  106. return $this->render_from_template('core/filemanager_selectlayout', []);
  107. }
  108. /**
  109. * FilePicker JS template for popup dialogue window asking for action when file with the same name already exists
  110. * (multiple-file version).
  111. *
  112. * @return string
  113. */
  114. protected function fp_js_template_processexistingfilemultiple() {
  115. return $this->render_from_template('core/filemanager_processexistingfilemultiple', []);
  116. }
  117. /**
  118. * FilePicker JS template for popup dialogue window asking for action when file with the same name already exists.
  119. *
  120. * @return string
  121. */
  122. protected function fp_js_template_processexistingfile() {
  123. return $this->render_from_template('core/filemanager_processexistingfile', []);
  124. }
  125. }