IDashboardWidget.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. * @author Maxence Lange <maxence@artificial-owl.com>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license GNU AGPL version 3 or any later version
  11. *
  12. * This program is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. *
  25. */
  26. namespace OCP\Dashboard;
  27. use OCP\Dashboard\Model\IWidgetConfig;
  28. use OCP\Dashboard\Model\IWidgetRequest;
  29. use OCP\Dashboard\Model\WidgetSetup;
  30. use OCP\Dashboard\Model\WidgetTemplate;
  31. /**
  32. * Interface IDashboardWidget
  33. *
  34. * This interface is used to create a widget: the widget must implement this
  35. * interface and be defined in appinfo/info.xml:
  36. *
  37. * <dashboard>
  38. * <widget>OCA\YourApp\YourWidget</widget>
  39. * </dashboard>
  40. *
  41. * Multiple widget can be defined in the same appinfo/info.xml.
  42. *
  43. * @since 15.0.0
  44. * @deprecated 20.0.0
  45. *
  46. */
  47. interface IDashboardWidget {
  48. /**
  49. * Should returns the (unique) Id of the widget.
  50. *
  51. * @since 15.0.0
  52. * @deprecated 20.0.0
  53. *
  54. * @return string
  55. */
  56. public function getId(): string;
  57. /**
  58. * Should returns the [display] name of the widget.
  59. *
  60. * @since 15.0.0
  61. * @deprecated 20.0.0
  62. *
  63. * @return string
  64. */
  65. public function getName(): string;
  66. /**
  67. * Should returns some text describing the widget.
  68. * This description is displayed in the listing of the available widgets.
  69. *
  70. * @since 15.0.0
  71. * @deprecated 20.0.0
  72. *
  73. * @return string
  74. */
  75. public function getDescription(): string;
  76. /**
  77. * Must generate and return a WidgetTemplate that define important stuff
  78. * about the Widget: icon, content, css or javascript.
  79. *
  80. * @see WidgetTemplate
  81. *
  82. * @since 15.0.0
  83. * @deprecated 20.0.0
  84. *
  85. * @return WidgetTemplate
  86. */
  87. public function getWidgetTemplate(): WidgetTemplate;
  88. /**
  89. * Must create and return a WidgetSetup containing the general setup of
  90. * the widget
  91. *
  92. * @see WidgetSetup
  93. *
  94. * @since 15.0.0
  95. * @deprecated 20.0.0
  96. *
  97. * @return WidgetSetup
  98. */
  99. public function getWidgetSetup(): WidgetSetup;
  100. /**
  101. * This method is called when a widget is loaded on the dashboard.
  102. * A widget is 'loaded on the dashboard' when one of these conditions
  103. * occurs:
  104. *
  105. * - the user is adding the widget on his dashboard,
  106. * - the user already added the widget on his dashboard and he is opening
  107. * the dashboard app.
  108. *
  109. * @see IWidgetConfig
  110. *
  111. * @since 15.0.0
  112. * @deprecated 20.0.0
  113. *
  114. * @param IWidgetConfig $settings
  115. */
  116. public function loadWidget(IWidgetConfig $settings);
  117. /**
  118. * This method s executed when the widget call the net.requestWidget()
  119. * from the Javascript API.
  120. *
  121. * This is used by the frontend to communicate with the backend.
  122. *
  123. * @see IWidgetRequest
  124. *
  125. * @since 15.0.0
  126. * @deprecated 20.0.0
  127. *
  128. * @param IWidgetRequest $request
  129. */
  130. public function requestWidget(IWidgetRequest $request);
  131. }