iextension.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Thomas Müller <thomas.mueller@tmit.eu>
  7. *
  8. * @copyright Copyright (c) 2015, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  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, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. /**
  25. * Public interface of ownCloud for apps to use.
  26. * Activity/IExtension interface
  27. */
  28. // use OCP namespace for all classes that are considered public.
  29. // This means that they should be used by apps instead of the internal ownCloud classes
  30. namespace OCP\Activity;
  31. /**
  32. * Interface IExtension
  33. *
  34. * @package OCP\Activity
  35. * @since 8.0.0
  36. */
  37. interface IExtension {
  38. const PRIORITY_VERYLOW = 10;
  39. const PRIORITY_LOW = 20;
  40. const PRIORITY_MEDIUM = 30;
  41. const PRIORITY_HIGH = 40;
  42. const PRIORITY_VERYHIGH = 50;
  43. /**
  44. * The extension can return an array of additional notification types.
  45. * If no additional types are to be added false is to be returned
  46. *
  47. * @param string $languageCode
  48. * @return array|false
  49. * @since 8.0.0
  50. */
  51. public function getNotificationTypes($languageCode);
  52. /**
  53. * For a given method additional types to be displayed in the settings can be returned.
  54. * In case no additional types are to be added false is to be returned.
  55. *
  56. * @param string $method
  57. * @return array|false
  58. * @since 8.0.0
  59. */
  60. public function getDefaultTypes($method);
  61. /**
  62. * A string naming the css class for the icon to be used can be returned.
  63. * If no icon is known for the given type false is to be returned.
  64. *
  65. * @param string $type
  66. * @return string|false
  67. * @since 8.0.0
  68. */
  69. public function getTypeIcon($type);
  70. /**
  71. * The extension can translate a given message to the requested languages.
  72. * If no translation is available false is to be returned.
  73. *
  74. * @param string $app
  75. * @param string $text
  76. * @param array $params
  77. * @param boolean $stripPath
  78. * @param boolean $highlightParams
  79. * @param string $languageCode
  80. * @return string|false
  81. * @since 8.0.0
  82. */
  83. public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
  84. /**
  85. * The extension can define the type of parameters for translation
  86. *
  87. * Currently known types are:
  88. * * file => will strip away the path of the file and add a tooltip with it
  89. * * username => will add the avatar of the user
  90. *
  91. * @param string $app
  92. * @param string $text
  93. * @return array|false
  94. * @since 8.0.0
  95. */
  96. public function getSpecialParameterList($app, $text);
  97. /**
  98. * The extension can define the parameter grouping by returning the index as integer.
  99. * In case no grouping is required false is to be returned.
  100. *
  101. * @param array $activity
  102. * @return integer|false
  103. * @since 8.0.0
  104. */
  105. public function getGroupParameter($activity);
  106. /**
  107. * The extension can define additional navigation entries. The array returned has to contain two keys 'top'
  108. * and 'apps' which hold arrays with the relevant entries.
  109. * If no further entries are to be added false is no be returned.
  110. *
  111. * @return array|false
  112. * @since 8.0.0
  113. */
  114. public function getNavigation();
  115. /**
  116. * The extension can check if a customer filter (given by a query string like filter=abc) is valid or not.
  117. *
  118. * @param string $filterValue
  119. * @return boolean
  120. * @since 8.0.0
  121. */
  122. public function isFilterValid($filterValue);
  123. /**
  124. * The extension can filter the types based on the filter if required.
  125. * In case no filter is to be applied false is to be returned unchanged.
  126. *
  127. * @param array $types
  128. * @param string $filter
  129. * @return array|false
  130. * @since 8.0.0
  131. */
  132. public function filterNotificationTypes($types, $filter);
  133. /**
  134. * For a given filter the extension can specify the sql query conditions including parameters for that query.
  135. * In case the extension does not know the filter false is to be returned.
  136. * The query condition and the parameters are to be returned as array with two elements.
  137. * E.g. return array('`app` = ? and `message` like ?', array('mail', 'ownCloud%'));
  138. *
  139. * @param string $filter
  140. * @return array|false
  141. * @since 8.0.0
  142. */
  143. public function getQueryForFilter($filter);
  144. }