IWidgetConfig.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
  5. *
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Dashboard\Model;
  25. use OCP\Dashboard\IDashboardWidget;
  26. /**
  27. * Interface IWidgetConfig
  28. *
  29. * This object contains the configuration of a widget for a userId
  30. *
  31. * @see IDashboardWidget::loadWidget
  32. *
  33. * @since 15.0.0
  34. *
  35. * @package OCP\Dashboard\Model
  36. */
  37. interface IWidgetConfig {
  38. /**
  39. * Returns the userId
  40. *
  41. * @since 15.0.0
  42. *
  43. * @return string
  44. */
  45. public function getUserId(): string;
  46. /**
  47. * Returns the widgetId
  48. *
  49. * @since 15.0.0
  50. *
  51. * @return string
  52. */
  53. public function getWidgetId(): string;
  54. /**
  55. * Returns the current position and the current size of the widget as
  56. * displayed on the user's dashboard
  57. *
  58. * The returned value is an array:
  59. * [
  60. * 'x' => (int) position on the X axis,
  61. * 'y' => (int) position on the Y axis,
  62. * 'width' => (int) width of the widget,
  63. * 'height' => (int) height of the widget
  64. * ]
  65. *
  66. * @since 15.0.0
  67. *
  68. * @return array
  69. */
  70. public function getPosition(): array;
  71. /**
  72. * Returns an array with the settings defined by the user for the widget.
  73. * The returned value is an array, with setting used as keys:
  74. *
  75. * [
  76. * 'setting1' => 'any value',
  77. * 'setting2' => 'other value'
  78. * ]
  79. *
  80. * Each setting that can be edited by a user should be defined in a
  81. * WidgetSetting.
  82. *
  83. * @see WidgetSetting
  84. *
  85. * Those WidgetSetting are in the WidgetTemplate defined during the setup
  86. * of the widget in the IDashboardWidget.
  87. *
  88. * @see IDashboardWidget::getWidgetTemplate
  89. * @see WidgetTemplate
  90. *
  91. * When using this framework, the settings interface is generated by the
  92. * Dashboard app.
  93. *
  94. * @since 15.0.0
  95. *
  96. * @return array
  97. */
  98. public function getSettings(): array;
  99. /**
  100. * Returns if the widget is enabled/displayed in this user's dashboard.
  101. *
  102. * @since 15.0.0
  103. *
  104. * @return bool
  105. */
  106. public function isEnabled(): bool;
  107. }