iextension.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. interface IExtension {
  32. const PRIORITY_VERYLOW = 10;
  33. const PRIORITY_LOW = 20;
  34. const PRIORITY_MEDIUM = 30;
  35. const PRIORITY_HIGH = 40;
  36. const PRIORITY_VERYHIGH = 50;
  37. /**
  38. * The extension can return an array of additional notification types.
  39. * If no additional types are to be added false is to be returned
  40. *
  41. * @param string $languageCode
  42. * @return array|false
  43. */
  44. public function getNotificationTypes($languageCode);
  45. /**
  46. * For a given method additional types to be displayed in the settings can be returned.
  47. * In case no additional types are to be added false is to be returned.
  48. *
  49. * @param string $method
  50. * @return array|false
  51. */
  52. public function getDefaultTypes($method);
  53. /**
  54. * A string naming the css class for the icon to be used can be returned.
  55. * If no icon is known for the given type false is to be returned.
  56. *
  57. * @param string $type
  58. * @return string|false
  59. */
  60. public function getTypeIcon($type);
  61. /**
  62. * The extension can translate a given message to the requested languages.
  63. * If no translation is available false is to be returned.
  64. *
  65. * @param string $app
  66. * @param string $text
  67. * @param array $params
  68. * @param boolean $stripPath
  69. * @param boolean $highlightParams
  70. * @param string $languageCode
  71. * @return string|false
  72. */
  73. public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
  74. /**
  75. * The extension can define the type of parameters for translation
  76. *
  77. * Currently known types are:
  78. * * file => will strip away the path of the file and add a tooltip with it
  79. * * username => will add the avatar of the user
  80. *
  81. * @param string $app
  82. * @param string $text
  83. * @return array|false
  84. */
  85. public function getSpecialParameterList($app, $text);
  86. /**
  87. * The extension can define the parameter grouping by returning the index as integer.
  88. * In case no grouping is required false is to be returned.
  89. *
  90. * @param array $activity
  91. * @return integer|false
  92. */
  93. public function getGroupParameter($activity);
  94. /**
  95. * The extension can define additional navigation entries. The array returned has to contain two keys 'top'
  96. * and 'apps' which hold arrays with the relevant entries.
  97. * If no further entries are to be added false is no be returned.
  98. *
  99. * @return array|false
  100. */
  101. public function getNavigation();
  102. /**
  103. * The extension can check if a customer filter (given by a query string like filter=abc) is valid or not.
  104. *
  105. * @param string $filterValue
  106. * @return boolean
  107. */
  108. public function isFilterValid($filterValue);
  109. /**
  110. * The extension can filter the types based on the filter if required.
  111. * In case no filter is to be applied false is to be returned unchanged.
  112. *
  113. * @param array $types
  114. * @param string $filter
  115. * @return array|false
  116. */
  117. public function filterNotificationTypes($types, $filter);
  118. /**
  119. * For a given filter the extension can specify the sql query conditions including parameters for that query.
  120. * In case the extension does not know the filter false is to be returned.
  121. * The query condition and the parameters are to be returned as array with two elements.
  122. * E.g. return array('`app` = ? and `message` like ?', array('mail', 'ownCloud%'));
  123. *
  124. * @param string $filter
  125. * @return array|false
  126. */
  127. public function getQueryForFilter($filter);
  128. }