iextension.php 5.0 KB

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