iextension.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Thomas Müller
  6. * @copyright 2014 Thomas Müller deepdiver@owncloud.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Public interface of ownCloud for apps to use.
  24. * Activity/IExtension interface
  25. */
  26. // use OCP namespace for all classes that are considered public.
  27. // This means that they should be used by apps instead of the internal ownCloud classes
  28. namespace OCP\Activity;
  29. interface IExtension {
  30. const PRIORITY_VERYLOW = 10;
  31. const PRIORITY_LOW = 20;
  32. const PRIORITY_MEDIUM = 30;
  33. const PRIORITY_HIGH = 40;
  34. const PRIORITY_VERYHIGH = 50;
  35. /**
  36. * The extension can return an array of additional notification types.
  37. * If no additional types are to be added false is to be returned
  38. *
  39. * @param string $languageCode
  40. * @return array|false
  41. */
  42. public function getNotificationTypes($languageCode);
  43. /**
  44. * The extension can filter the types based on the filter if required.
  45. * In case no filter is to be applied false is to be returned unchanged.
  46. *
  47. * @param array $types
  48. * @param string $filter
  49. * @return array|false
  50. */
  51. public function filterNotificationTypes($types, $filter);
  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. */
  59. public function getDefaultTypes($method);
  60. /**
  61. * The extension can translate a given message to the requested languages.
  62. * If no translation is available false is to be returned.
  63. *
  64. * @param string $app
  65. * @param string $text
  66. * @param array $params
  67. * @param boolean $stripPath
  68. * @param boolean $highlightParams
  69. * @param string $languageCode
  70. * @return string|false
  71. */
  72. public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
  73. /**
  74. * The extension can define the type of parameters for translation
  75. *
  76. * Currently known types are:
  77. * * file => will strip away the path of the file and add a tooltip with it
  78. * * username => will add the avatar of the user
  79. *
  80. * @param string $app
  81. * @param string $text
  82. * @return array|false
  83. */
  84. function getSpecialParameterList($app, $text);
  85. /**
  86. * A string naming the css class for the icon to be used can be returned.
  87. * If no icon is known for the given type false is to be returned.
  88. *
  89. * @param string $type
  90. * @return string|false
  91. */
  92. public function getTypeIcon($type);
  93. /**
  94. * The extension can define the parameter grouping by returning the index as integer.
  95. * In case no grouping is required false is to be returned.
  96. *
  97. * @param array $activity
  98. * @return integer|false
  99. */
  100. public function getGroupParameter($activity);
  101. /**
  102. * The extension can define additional navigation entries. The array returned has to contain two keys 'top'
  103. * and 'apps' which hold arrays with the relevant entries.
  104. * If no further entries are to be added false is no be returned.
  105. *
  106. * @return array|false
  107. */
  108. public function getNavigation();
  109. /**
  110. * The extension can check if a customer filter (given by a query string like filter=abc) is valid or not.
  111. *
  112. * @param string $filterValue
  113. * @return boolean
  114. */
  115. public function isFilterValid($filterValue);
  116. /**
  117. * For a given filter the extension can specify the sql query conditions including parameters for that query.
  118. * In case the extension does not know the filter false is to be returned.
  119. * The query condition and the parameters are to be returned as array with two elements.
  120. * E.g. return array('`app` = ? and `message` like ?', array('mail', 'ownCloud%'));
  121. *
  122. * @param string $filter
  123. * @return array|false
  124. */
  125. public function getQueryForFilter($filter);
  126. }