@@ -26,34 +26,34 @@ |
||
26 | 26 | |
27 | 27 | class AppManagement extends Action { |
28 | 28 | |
29 | - /** |
|
30 | - * @param string $appName |
|
31 | - */ |
|
32 | - public function enableApp(string $appName) { |
|
33 | - $this->log('App "%s" enabled', |
|
34 | - ['app' => $appName], |
|
35 | - ['app'] |
|
36 | - ); |
|
37 | - } |
|
29 | + /** |
|
30 | + * @param string $appName |
|
31 | + */ |
|
32 | + public function enableApp(string $appName) { |
|
33 | + $this->log('App "%s" enabled', |
|
34 | + ['app' => $appName], |
|
35 | + ['app'] |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $appName |
|
41 | - * @param string[] $groups |
|
42 | - */ |
|
43 | - public function enableAppForGroups(string $appName, array $groups) { |
|
44 | - $this->log('App "%1$s" enabled for groups: %2$s', |
|
45 | - ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
46 | - ['app', 'groups'] |
|
47 | - ); |
|
48 | - } |
|
39 | + /** |
|
40 | + * @param string $appName |
|
41 | + * @param string[] $groups |
|
42 | + */ |
|
43 | + public function enableAppForGroups(string $appName, array $groups) { |
|
44 | + $this->log('App "%1$s" enabled for groups: %2$s', |
|
45 | + ['app' => $appName, 'groups' => implode(', ', $groups)], |
|
46 | + ['app', 'groups'] |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $appName |
|
52 | - */ |
|
53 | - public function disableApp(string $appName) { |
|
54 | - $this->log('App "%s" disabled', |
|
55 | - ['app' => $appName], |
|
56 | - ['app'] |
|
57 | - ); |
|
58 | - } |
|
50 | + /** |
|
51 | + * @param string $appName |
|
52 | + */ |
|
53 | + public function disableApp(string $appName) { |
|
54 | + $this->log('App "%s" disabled', |
|
55 | + ['app' => $appName], |
|
56 | + ['app'] |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | } |
@@ -32,19 +32,19 @@ |
||
32 | 32 | */ |
33 | 33 | class ProviderAlreadyExistsException extends HintException { |
34 | 34 | |
35 | - /** |
|
36 | - * ProviderAlreadyExistsException constructor. |
|
37 | - * |
|
38 | - * @since 14.0.0 |
|
39 | - * |
|
40 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | - */ |
|
43 | - public function __construct($newProviderId, $existingProviderName) { |
|
44 | - $l = \OC::$server->getL10N('federation'); |
|
45 | - $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | - $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | - parent::__construct($message, $hint); |
|
48 | - } |
|
35 | + /** |
|
36 | + * ProviderAlreadyExistsException constructor. |
|
37 | + * |
|
38 | + * @since 14.0.0 |
|
39 | + * |
|
40 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
41 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
42 | + */ |
|
43 | + public function __construct($newProviderId, $existingProviderName) { |
|
44 | + $l = \OC::$server->getL10N('federation'); |
|
45 | + $message = 'ID "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
46 | + $hint = $l->t('ID "%1$s" already used by cloud federation provider "%2$s"', [$newProviderId, $existingProviderName]); |
|
47 | + parent::__construct($message, $hint); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -31,18 +31,18 @@ |
||
31 | 31 | */ |
32 | 32 | interface ITimeFactory { |
33 | 33 | |
34 | - /** |
|
35 | - * @return int the result of a call to time() |
|
36 | - * @since 8.0.0 |
|
37 | - */ |
|
38 | - public function getTime(): int; |
|
34 | + /** |
|
35 | + * @return int the result of a call to time() |
|
36 | + * @since 8.0.0 |
|
37 | + */ |
|
38 | + public function getTime(): int; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param string $time |
|
42 | - * @param \DateTimeZone $timezone |
|
43 | - * @return \DateTime |
|
44 | - * @since 15.0.0 |
|
45 | - */ |
|
46 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
40 | + /** |
|
41 | + * @param string $time |
|
42 | + * @param \DateTimeZone $timezone |
|
43 | + * @return \DateTime |
|
44 | + * @since 15.0.0 |
|
45 | + */ |
|
46 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime; |
|
47 | 47 | |
48 | 48 | } |
@@ -34,21 +34,21 @@ |
||
34 | 34 | class TimeFactory implements ITimeFactory { |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * @return int the result of a call to time() |
|
39 | - */ |
|
40 | - public function getTime(): int { |
|
41 | - return time(); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * @param string $time |
|
46 | - * @param \DateTimeZone $timezone |
|
47 | - * @return \DateTime |
|
48 | - * @since 15.0.0 |
|
49 | - */ |
|
50 | - public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | - return new \DateTime($time, $timezone); |
|
52 | - } |
|
37 | + /** |
|
38 | + * @return int the result of a call to time() |
|
39 | + */ |
|
40 | + public function getTime(): int { |
|
41 | + return time(); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * @param string $time |
|
46 | + * @param \DateTimeZone $timezone |
|
47 | + * @return \DateTime |
|
48 | + * @since 15.0.0 |
|
49 | + */ |
|
50 | + public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime { |
|
51 | + return new \DateTime($time, $timezone); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | } |
@@ -46,103 +46,103 @@ |
||
46 | 46 | class DashboardManager implements IDashboardManager { |
47 | 47 | |
48 | 48 | |
49 | - /** @var IWidgetsService */ |
|
50 | - private $widgetsService; |
|
51 | - |
|
52 | - /** @var IEventsService */ |
|
53 | - private $eventsService; |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @param IEventsService $eventsService |
|
58 | - */ |
|
59 | - public function registerEventsService(IEventsService $eventsService) { |
|
60 | - $this->eventsService = $eventsService; |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @param IWidgetsService $widgetsService |
|
66 | - */ |
|
67 | - public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | - $this->widgetsService = $widgetsService; |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * @param string $widgetId |
|
74 | - * @param string $userId |
|
75 | - * |
|
76 | - * @return IWidgetConfig |
|
77 | - * @throws DashboardAppNotAvailableException |
|
78 | - */ |
|
79 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | - return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * @param string $widgetId |
|
86 | - * @param array $users |
|
87 | - * @param array $payload |
|
88 | - * @param string $uniqueId |
|
89 | - * |
|
90 | - * @throws DashboardAppNotAvailableException |
|
91 | - */ |
|
92 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | - $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $widgetId |
|
99 | - * @param array $groups |
|
100 | - * @param array $payload |
|
101 | - * @param string $uniqueId |
|
102 | - * |
|
103 | - * @throws DashboardAppNotAvailableException |
|
104 | - */ |
|
105 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | - $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @param string $widgetId |
|
112 | - * @param array $payload |
|
113 | - * @param string $uniqueId |
|
114 | - * |
|
115 | - * @throws DashboardAppNotAvailableException |
|
116 | - */ |
|
117 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | - $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * @return IWidgetsService |
|
124 | - * @throws DashboardAppNotAvailableException |
|
125 | - */ |
|
126 | - private function getWidgetsService() { |
|
127 | - if ($this->widgetsService === null) { |
|
128 | - throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | - } |
|
130 | - |
|
131 | - return $this->widgetsService; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @return IEventsService |
|
137 | - * @throws DashboardAppNotAvailableException |
|
138 | - */ |
|
139 | - private function getEventsService() { |
|
140 | - if ($this->eventsService === null) { |
|
141 | - throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | - } |
|
143 | - |
|
144 | - return $this->eventsService; |
|
145 | - } |
|
49 | + /** @var IWidgetsService */ |
|
50 | + private $widgetsService; |
|
51 | + |
|
52 | + /** @var IEventsService */ |
|
53 | + private $eventsService; |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @param IEventsService $eventsService |
|
58 | + */ |
|
59 | + public function registerEventsService(IEventsService $eventsService) { |
|
60 | + $this->eventsService = $eventsService; |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @param IWidgetsService $widgetsService |
|
66 | + */ |
|
67 | + public function registerWidgetsService(IWidgetsService $widgetsService) { |
|
68 | + $this->widgetsService = $widgetsService; |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * @param string $widgetId |
|
74 | + * @param string $userId |
|
75 | + * |
|
76 | + * @return IWidgetConfig |
|
77 | + * @throws DashboardAppNotAvailableException |
|
78 | + */ |
|
79 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig { |
|
80 | + return $this->getWidgetsService()->getWidgetConfig($widgetId, $userId); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * @param string $widgetId |
|
86 | + * @param array $users |
|
87 | + * @param array $payload |
|
88 | + * @param string $uniqueId |
|
89 | + * |
|
90 | + * @throws DashboardAppNotAvailableException |
|
91 | + */ |
|
92 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '') { |
|
93 | + $this->getEventsService()->createUsersEvent($widgetId, $users, $payload, $uniqueId); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $widgetId |
|
99 | + * @param array $groups |
|
100 | + * @param array $payload |
|
101 | + * @param string $uniqueId |
|
102 | + * |
|
103 | + * @throws DashboardAppNotAvailableException |
|
104 | + */ |
|
105 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '') { |
|
106 | + $this->getEventsService()->createGroupsEvent($widgetId, $groups, $payload, $uniqueId); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @param string $widgetId |
|
112 | + * @param array $payload |
|
113 | + * @param string $uniqueId |
|
114 | + * |
|
115 | + * @throws DashboardAppNotAvailableException |
|
116 | + */ |
|
117 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '') { |
|
118 | + $this->getEventsService()->createGlobalEvent($widgetId, $payload, $uniqueId); |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * @return IWidgetsService |
|
124 | + * @throws DashboardAppNotAvailableException |
|
125 | + */ |
|
126 | + private function getWidgetsService() { |
|
127 | + if ($this->widgetsService === null) { |
|
128 | + throw new DashboardAppNotAvailableException('No IWidgetsService registered'); |
|
129 | + } |
|
130 | + |
|
131 | + return $this->widgetsService; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @return IEventsService |
|
137 | + * @throws DashboardAppNotAvailableException |
|
138 | + */ |
|
139 | + private function getEventsService() { |
|
140 | + if ($this->eventsService === null) { |
|
141 | + throw new DashboardAppNotAvailableException('No IEventsService registered'); |
|
142 | + } |
|
143 | + |
|
144 | + return $this->eventsService; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
148 | 148 |
@@ -54,94 +54,94 @@ |
||
54 | 54 | */ |
55 | 55 | interface IDashboardWidget { |
56 | 56 | |
57 | - /** |
|
58 | - * Should returns the (unique) Id of the widget. |
|
59 | - * |
|
60 | - * @since 15.0.0 |
|
61 | - * |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function getId(): string; |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Should returns the [display] name of the widget. |
|
69 | - * |
|
70 | - * @since 15.0.0 |
|
71 | - * |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - public function getName(): string; |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Should returns some text describing the widget. |
|
79 | - * This description is displayed in the listing of the available widgets. |
|
80 | - * |
|
81 | - * @since 15.0.0 |
|
82 | - * |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function getDescription(): string; |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Must generate and return a WidgetTemplate that define important stuff |
|
90 | - * about the Widget: icon, content, css or javascript. |
|
91 | - * |
|
92 | - * @see WidgetTemplate |
|
93 | - * |
|
94 | - * @since 15.0.0 |
|
95 | - * |
|
96 | - * @return WidgetTemplate |
|
97 | - */ |
|
98 | - public function getWidgetTemplate(): WidgetTemplate; |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * Must create and return a WidgetSetup containing the general setup of |
|
103 | - * the widget |
|
104 | - * |
|
105 | - * @see WidgetSetup |
|
106 | - * |
|
107 | - * @since 15.0.0 |
|
108 | - * |
|
109 | - * @return WidgetSetup |
|
110 | - */ |
|
111 | - public function getWidgetSetup(): WidgetSetup; |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * This method is called when a widget is loaded on the dashboard. |
|
116 | - * A widget is 'loaded on the dashboard' when one of these conditions |
|
117 | - * occurs: |
|
118 | - * |
|
119 | - * - the user is adding the widget on his dashboard, |
|
120 | - * - the user already added the widget on his dashboard and he is opening |
|
121 | - * the dashboard app. |
|
122 | - * |
|
123 | - * @see IWidgetConfig |
|
124 | - * |
|
125 | - * @since 15.0.0 |
|
126 | - * |
|
127 | - * @param IWidgetConfig $settings |
|
128 | - */ |
|
129 | - public function loadWidget(IWidgetConfig $settings); |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * This method s executed when the widget call the net.requestWidget() |
|
134 | - * from the Javascript API. |
|
135 | - * |
|
136 | - * This is used by the frontend to communicate with the backend. |
|
137 | - * |
|
138 | - * @see IWidgetRequest |
|
139 | - * |
|
140 | - * @since 15.0.0 |
|
141 | - * |
|
142 | - * @param IWidgetRequest $request |
|
143 | - */ |
|
144 | - public function requestWidget(IWidgetRequest $request); |
|
57 | + /** |
|
58 | + * Should returns the (unique) Id of the widget. |
|
59 | + * |
|
60 | + * @since 15.0.0 |
|
61 | + * |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function getId(): string; |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Should returns the [display] name of the widget. |
|
69 | + * |
|
70 | + * @since 15.0.0 |
|
71 | + * |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + public function getName(): string; |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Should returns some text describing the widget. |
|
79 | + * This description is displayed in the listing of the available widgets. |
|
80 | + * |
|
81 | + * @since 15.0.0 |
|
82 | + * |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function getDescription(): string; |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Must generate and return a WidgetTemplate that define important stuff |
|
90 | + * about the Widget: icon, content, css or javascript. |
|
91 | + * |
|
92 | + * @see WidgetTemplate |
|
93 | + * |
|
94 | + * @since 15.0.0 |
|
95 | + * |
|
96 | + * @return WidgetTemplate |
|
97 | + */ |
|
98 | + public function getWidgetTemplate(): WidgetTemplate; |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * Must create and return a WidgetSetup containing the general setup of |
|
103 | + * the widget |
|
104 | + * |
|
105 | + * @see WidgetSetup |
|
106 | + * |
|
107 | + * @since 15.0.0 |
|
108 | + * |
|
109 | + * @return WidgetSetup |
|
110 | + */ |
|
111 | + public function getWidgetSetup(): WidgetSetup; |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * This method is called when a widget is loaded on the dashboard. |
|
116 | + * A widget is 'loaded on the dashboard' when one of these conditions |
|
117 | + * occurs: |
|
118 | + * |
|
119 | + * - the user is adding the widget on his dashboard, |
|
120 | + * - the user already added the widget on his dashboard and he is opening |
|
121 | + * the dashboard app. |
|
122 | + * |
|
123 | + * @see IWidgetConfig |
|
124 | + * |
|
125 | + * @since 15.0.0 |
|
126 | + * |
|
127 | + * @param IWidgetConfig $settings |
|
128 | + */ |
|
129 | + public function loadWidget(IWidgetConfig $settings); |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * This method s executed when the widget call the net.requestWidget() |
|
134 | + * from the Javascript API. |
|
135 | + * |
|
136 | + * This is used by the frontend to communicate with the backend. |
|
137 | + * |
|
138 | + * @see IWidgetRequest |
|
139 | + * |
|
140 | + * @since 15.0.0 |
|
141 | + * |
|
142 | + * @param IWidgetRequest $request |
|
143 | + */ |
|
144 | + public function requestWidget(IWidgetRequest $request); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 |
@@ -48,90 +48,90 @@ |
||
48 | 48 | */ |
49 | 49 | interface IWidgetRequest { |
50 | 50 | |
51 | - /** |
|
52 | - * Get the widgetId. |
|
53 | - * |
|
54 | - * @since 15.0.0 |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getWidgetId(): string; |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * Get the WidgetClass. |
|
63 | - * |
|
64 | - * @since 15.0.0 |
|
65 | - * |
|
66 | - * @return IDashboardWidget |
|
67 | - */ |
|
68 | - public function getWidget(): IDashboardWidget; |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Get the 'request' string sent by the request from the front-end with |
|
73 | - * the format: |
|
74 | - * |
|
75 | - * net.requestWidget( |
|
76 | - * { |
|
77 | - * widget: widgetId, |
|
78 | - * request: request, |
|
79 | - * value: value |
|
80 | - * }, |
|
81 | - * callback); |
|
82 | - * |
|
83 | - * @since 15.0.0 |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getRequest(): string; |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * Get the 'value' string sent by the request from the front-end. |
|
92 | - * |
|
93 | - * @see getRequest |
|
94 | - * |
|
95 | - * @since 15.0.0 |
|
96 | - * |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function getValue(): string; |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Returns the result. |
|
104 | - * |
|
105 | - * @since 15.0.0 |
|
106 | - * |
|
107 | - * @return array |
|
108 | - */ |
|
109 | - public function getResult(): array; |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * add a result (as string) |
|
114 | - * |
|
115 | - * @since 15.0.0 |
|
116 | - * |
|
117 | - * @param string $key |
|
118 | - * @param string $result |
|
119 | - * |
|
120 | - * @return $this |
|
121 | - */ |
|
122 | - public function addResult(string $key, string $result): IWidgetRequest; |
|
123 | - |
|
124 | - /** |
|
125 | - * add a result (as array) |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * |
|
129 | - * @param string $key |
|
130 | - * @param array $result |
|
131 | - * |
|
132 | - * @return $this |
|
133 | - */ |
|
134 | - public function addResultArray(string $key, array $result): IWidgetRequest; |
|
51 | + /** |
|
52 | + * Get the widgetId. |
|
53 | + * |
|
54 | + * @since 15.0.0 |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getWidgetId(): string; |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * Get the WidgetClass. |
|
63 | + * |
|
64 | + * @since 15.0.0 |
|
65 | + * |
|
66 | + * @return IDashboardWidget |
|
67 | + */ |
|
68 | + public function getWidget(): IDashboardWidget; |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Get the 'request' string sent by the request from the front-end with |
|
73 | + * the format: |
|
74 | + * |
|
75 | + * net.requestWidget( |
|
76 | + * { |
|
77 | + * widget: widgetId, |
|
78 | + * request: request, |
|
79 | + * value: value |
|
80 | + * }, |
|
81 | + * callback); |
|
82 | + * |
|
83 | + * @since 15.0.0 |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getRequest(): string; |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * Get the 'value' string sent by the request from the front-end. |
|
92 | + * |
|
93 | + * @see getRequest |
|
94 | + * |
|
95 | + * @since 15.0.0 |
|
96 | + * |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function getValue(): string; |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Returns the result. |
|
104 | + * |
|
105 | + * @since 15.0.0 |
|
106 | + * |
|
107 | + * @return array |
|
108 | + */ |
|
109 | + public function getResult(): array; |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * add a result (as string) |
|
114 | + * |
|
115 | + * @since 15.0.0 |
|
116 | + * |
|
117 | + * @param string $key |
|
118 | + * @param string $result |
|
119 | + * |
|
120 | + * @return $this |
|
121 | + */ |
|
122 | + public function addResult(string $key, string $result): IWidgetRequest; |
|
123 | + |
|
124 | + /** |
|
125 | + * add a result (as array) |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * |
|
129 | + * @param string $key |
|
130 | + * @param array $result |
|
131 | + * |
|
132 | + * @return $this |
|
133 | + */ |
|
134 | + public function addResultArray(string $key, array $result): IWidgetRequest; |
|
135 | 135 | |
136 | 136 | } |
137 | 137 |
@@ -48,271 +48,271 @@ |
||
48 | 48 | final class WidgetTemplate implements JsonSerializable { |
49 | 49 | |
50 | 50 | |
51 | - /** @var string */ |
|
52 | - private $icon = ''; |
|
53 | - |
|
54 | - /** @var array */ |
|
55 | - private $css = []; |
|
56 | - |
|
57 | - /** @var array */ |
|
58 | - private $js = []; |
|
59 | - |
|
60 | - /** @var string */ |
|
61 | - private $content = ''; |
|
62 | - |
|
63 | - /** @var string */ |
|
64 | - private $function = ''; |
|
65 | - |
|
66 | - /** @var WidgetSetting[] */ |
|
67 | - private $settings = []; |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Get the icon class of the widget. |
|
72 | - * |
|
73 | - * @since 15.0.0 |
|
74 | - * |
|
75 | - * @return string |
|
76 | - */ |
|
77 | - public function getIcon(): string { |
|
78 | - return $this->icon; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Set the icon class of the widget. |
|
83 | - * This class must be defined in one of the CSS file used by the widget. |
|
84 | - * |
|
85 | - * @see addCss |
|
86 | - * |
|
87 | - * @since 15.0.0 |
|
88 | - * |
|
89 | - * @param string $icon |
|
90 | - * |
|
91 | - * @return WidgetTemplate |
|
92 | - */ |
|
93 | - public function setIcon(string $icon): WidgetTemplate { |
|
94 | - $this->icon = $icon; |
|
95 | - |
|
96 | - return $this; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Get CSS files to be included when displaying a widget |
|
101 | - * |
|
102 | - * @since 15.0.0 |
|
103 | - * |
|
104 | - * @return array |
|
105 | - */ |
|
106 | - public function getCss(): array { |
|
107 | - return $this->css; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * path and name of CSS files |
|
112 | - * |
|
113 | - * @since 15.0.0 |
|
114 | - * |
|
115 | - * @param array $css |
|
116 | - * |
|
117 | - * @return WidgetTemplate |
|
118 | - */ |
|
119 | - public function setCss(array $css): WidgetTemplate { |
|
120 | - $this->css = $css; |
|
121 | - |
|
122 | - return $this; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Add a CSS file to be included when displaying a widget. |
|
127 | - * |
|
128 | - * @since 15.0.0 |
|
129 | - * |
|
130 | - * @param string $css |
|
131 | - * |
|
132 | - * @return WidgetTemplate |
|
133 | - */ |
|
134 | - public function addCss(string $css): WidgetTemplate { |
|
135 | - $this->css[] = $css; |
|
136 | - |
|
137 | - return $this; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Get JS files to be included when loading a widget |
|
142 | - * |
|
143 | - * @since 15.0.0 |
|
144 | - * |
|
145 | - * @return array |
|
146 | - */ |
|
147 | - public function getJs(): array { |
|
148 | - return $this->js; |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Set an array of JS files to be included when loading a widget. |
|
153 | - * |
|
154 | - * @since 15.0.0 |
|
155 | - * |
|
156 | - * @param array $js |
|
157 | - * |
|
158 | - * @return WidgetTemplate |
|
159 | - */ |
|
160 | - public function setJs(array $js): WidgetTemplate { |
|
161 | - $this->js = $js; |
|
162 | - |
|
163 | - return $this; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Add a JS file to be included when loading a widget. |
|
168 | - * |
|
169 | - * @since 15.0.0 |
|
170 | - * |
|
171 | - * @param string $js |
|
172 | - * |
|
173 | - * @return WidgetTemplate |
|
174 | - */ |
|
175 | - public function addJs(string $js): WidgetTemplate { |
|
176 | - $this->js[] = $js; |
|
177 | - |
|
178 | - return $this; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * Get the HTML file that contains the content of the widget. |
|
183 | - * |
|
184 | - * @since 15.0.0 |
|
185 | - * |
|
186 | - * @return string |
|
187 | - */ |
|
188 | - public function getContent(): string { |
|
189 | - return $this->content; |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * Set the HTML file that contains the content of the widget. |
|
194 | - * |
|
195 | - * @since 15.0.0 |
|
196 | - * |
|
197 | - * @param string $content |
|
198 | - * |
|
199 | - * @return WidgetTemplate |
|
200 | - */ |
|
201 | - public function setContent(string $content): WidgetTemplate { |
|
202 | - $this->content = $content; |
|
203 | - |
|
204 | - return $this; |
|
205 | - } |
|
206 | - |
|
207 | - /** |
|
208 | - * Get the JS function to be called when loading the widget. |
|
209 | - * |
|
210 | - * @since 15.0.0 |
|
211 | - * |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public function getInitFunction(): string { |
|
215 | - return $this->function; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * JavaScript function to be called when loading the widget on the |
|
220 | - * dashboard |
|
221 | - * |
|
222 | - * @since 15.0.0 |
|
223 | - * |
|
224 | - * @param string $function |
|
225 | - * |
|
226 | - * @return WidgetTemplate |
|
227 | - */ |
|
228 | - public function setInitFunction(string $function): WidgetTemplate { |
|
229 | - $this->function = $function; |
|
230 | - |
|
231 | - return $this; |
|
232 | - } |
|
233 | - |
|
234 | - /** |
|
235 | - * Get all WidgetSetting defined for the widget. |
|
236 | - * |
|
237 | - * @see WidgetSetting |
|
238 | - * |
|
239 | - * @since 15.0.0 |
|
240 | - * |
|
241 | - * @return WidgetSetting[] |
|
242 | - */ |
|
243 | - public function getSettings(): array { |
|
244 | - return $this->settings; |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Define all WidgetSetting for the widget. |
|
249 | - * |
|
250 | - * @since 15.0.0 |
|
251 | - * |
|
252 | - * @see WidgetSetting |
|
253 | - * |
|
254 | - * @param WidgetSetting[] $settings |
|
255 | - * |
|
256 | - * @return WidgetTemplate |
|
257 | - */ |
|
258 | - public function setSettings(array $settings): WidgetTemplate { |
|
259 | - $this->settings = $settings; |
|
260 | - |
|
261 | - return $this; |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * Add a WidgetSetting. |
|
266 | - * |
|
267 | - * @see WidgetSetting |
|
268 | - * |
|
269 | - * @since 15.0.0 |
|
270 | - * |
|
271 | - * @param WidgetSetting $setting |
|
272 | - * |
|
273 | - * @return WidgetTemplate |
|
274 | - */ |
|
275 | - public function addSetting(WidgetSetting $setting): WidgetTemplate { |
|
276 | - $this->settings[] = $setting; |
|
277 | - |
|
278 | - return $this; |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Get a WidgetSetting by its name |
|
283 | - * |
|
284 | - * @see WidgetSetting::setName |
|
285 | - * |
|
286 | - * @since 15.0.0 |
|
287 | - * |
|
288 | - * @param string $key |
|
289 | - * |
|
290 | - * @return WidgetSetting |
|
291 | - */ |
|
292 | - public function getSetting(string $key): WidgetSetting { |
|
293 | - if (!array_key_exists($key, $this->settings)) { |
|
294 | - return null; |
|
295 | - } |
|
296 | - |
|
297 | - return $this->settings[$key]; |
|
298 | - } |
|
299 | - |
|
300 | - |
|
301 | - /** |
|
302 | - * @since 15.0.0 |
|
303 | - * |
|
304 | - * @return array |
|
305 | - */ |
|
306 | - public function jsonSerialize() { |
|
307 | - return [ |
|
308 | - 'icon' => $this->getIcon(), |
|
309 | - 'css' => $this->getCss(), |
|
310 | - 'js' => $this->getJs(), |
|
311 | - 'content' => $this->getContent(), |
|
312 | - 'function' => $this->getInitFunction(), |
|
313 | - 'settings' => $this->getSettings() |
|
314 | - ]; |
|
315 | - } |
|
51 | + /** @var string */ |
|
52 | + private $icon = ''; |
|
53 | + |
|
54 | + /** @var array */ |
|
55 | + private $css = []; |
|
56 | + |
|
57 | + /** @var array */ |
|
58 | + private $js = []; |
|
59 | + |
|
60 | + /** @var string */ |
|
61 | + private $content = ''; |
|
62 | + |
|
63 | + /** @var string */ |
|
64 | + private $function = ''; |
|
65 | + |
|
66 | + /** @var WidgetSetting[] */ |
|
67 | + private $settings = []; |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Get the icon class of the widget. |
|
72 | + * |
|
73 | + * @since 15.0.0 |
|
74 | + * |
|
75 | + * @return string |
|
76 | + */ |
|
77 | + public function getIcon(): string { |
|
78 | + return $this->icon; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Set the icon class of the widget. |
|
83 | + * This class must be defined in one of the CSS file used by the widget. |
|
84 | + * |
|
85 | + * @see addCss |
|
86 | + * |
|
87 | + * @since 15.0.0 |
|
88 | + * |
|
89 | + * @param string $icon |
|
90 | + * |
|
91 | + * @return WidgetTemplate |
|
92 | + */ |
|
93 | + public function setIcon(string $icon): WidgetTemplate { |
|
94 | + $this->icon = $icon; |
|
95 | + |
|
96 | + return $this; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Get CSS files to be included when displaying a widget |
|
101 | + * |
|
102 | + * @since 15.0.0 |
|
103 | + * |
|
104 | + * @return array |
|
105 | + */ |
|
106 | + public function getCss(): array { |
|
107 | + return $this->css; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * path and name of CSS files |
|
112 | + * |
|
113 | + * @since 15.0.0 |
|
114 | + * |
|
115 | + * @param array $css |
|
116 | + * |
|
117 | + * @return WidgetTemplate |
|
118 | + */ |
|
119 | + public function setCss(array $css): WidgetTemplate { |
|
120 | + $this->css = $css; |
|
121 | + |
|
122 | + return $this; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Add a CSS file to be included when displaying a widget. |
|
127 | + * |
|
128 | + * @since 15.0.0 |
|
129 | + * |
|
130 | + * @param string $css |
|
131 | + * |
|
132 | + * @return WidgetTemplate |
|
133 | + */ |
|
134 | + public function addCss(string $css): WidgetTemplate { |
|
135 | + $this->css[] = $css; |
|
136 | + |
|
137 | + return $this; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Get JS files to be included when loading a widget |
|
142 | + * |
|
143 | + * @since 15.0.0 |
|
144 | + * |
|
145 | + * @return array |
|
146 | + */ |
|
147 | + public function getJs(): array { |
|
148 | + return $this->js; |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Set an array of JS files to be included when loading a widget. |
|
153 | + * |
|
154 | + * @since 15.0.0 |
|
155 | + * |
|
156 | + * @param array $js |
|
157 | + * |
|
158 | + * @return WidgetTemplate |
|
159 | + */ |
|
160 | + public function setJs(array $js): WidgetTemplate { |
|
161 | + $this->js = $js; |
|
162 | + |
|
163 | + return $this; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Add a JS file to be included when loading a widget. |
|
168 | + * |
|
169 | + * @since 15.0.0 |
|
170 | + * |
|
171 | + * @param string $js |
|
172 | + * |
|
173 | + * @return WidgetTemplate |
|
174 | + */ |
|
175 | + public function addJs(string $js): WidgetTemplate { |
|
176 | + $this->js[] = $js; |
|
177 | + |
|
178 | + return $this; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * Get the HTML file that contains the content of the widget. |
|
183 | + * |
|
184 | + * @since 15.0.0 |
|
185 | + * |
|
186 | + * @return string |
|
187 | + */ |
|
188 | + public function getContent(): string { |
|
189 | + return $this->content; |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * Set the HTML file that contains the content of the widget. |
|
194 | + * |
|
195 | + * @since 15.0.0 |
|
196 | + * |
|
197 | + * @param string $content |
|
198 | + * |
|
199 | + * @return WidgetTemplate |
|
200 | + */ |
|
201 | + public function setContent(string $content): WidgetTemplate { |
|
202 | + $this->content = $content; |
|
203 | + |
|
204 | + return $this; |
|
205 | + } |
|
206 | + |
|
207 | + /** |
|
208 | + * Get the JS function to be called when loading the widget. |
|
209 | + * |
|
210 | + * @since 15.0.0 |
|
211 | + * |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public function getInitFunction(): string { |
|
215 | + return $this->function; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * JavaScript function to be called when loading the widget on the |
|
220 | + * dashboard |
|
221 | + * |
|
222 | + * @since 15.0.0 |
|
223 | + * |
|
224 | + * @param string $function |
|
225 | + * |
|
226 | + * @return WidgetTemplate |
|
227 | + */ |
|
228 | + public function setInitFunction(string $function): WidgetTemplate { |
|
229 | + $this->function = $function; |
|
230 | + |
|
231 | + return $this; |
|
232 | + } |
|
233 | + |
|
234 | + /** |
|
235 | + * Get all WidgetSetting defined for the widget. |
|
236 | + * |
|
237 | + * @see WidgetSetting |
|
238 | + * |
|
239 | + * @since 15.0.0 |
|
240 | + * |
|
241 | + * @return WidgetSetting[] |
|
242 | + */ |
|
243 | + public function getSettings(): array { |
|
244 | + return $this->settings; |
|
245 | + } |
|
246 | + |
|
247 | + /** |
|
248 | + * Define all WidgetSetting for the widget. |
|
249 | + * |
|
250 | + * @since 15.0.0 |
|
251 | + * |
|
252 | + * @see WidgetSetting |
|
253 | + * |
|
254 | + * @param WidgetSetting[] $settings |
|
255 | + * |
|
256 | + * @return WidgetTemplate |
|
257 | + */ |
|
258 | + public function setSettings(array $settings): WidgetTemplate { |
|
259 | + $this->settings = $settings; |
|
260 | + |
|
261 | + return $this; |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * Add a WidgetSetting. |
|
266 | + * |
|
267 | + * @see WidgetSetting |
|
268 | + * |
|
269 | + * @since 15.0.0 |
|
270 | + * |
|
271 | + * @param WidgetSetting $setting |
|
272 | + * |
|
273 | + * @return WidgetTemplate |
|
274 | + */ |
|
275 | + public function addSetting(WidgetSetting $setting): WidgetTemplate { |
|
276 | + $this->settings[] = $setting; |
|
277 | + |
|
278 | + return $this; |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * Get a WidgetSetting by its name |
|
283 | + * |
|
284 | + * @see WidgetSetting::setName |
|
285 | + * |
|
286 | + * @since 15.0.0 |
|
287 | + * |
|
288 | + * @param string $key |
|
289 | + * |
|
290 | + * @return WidgetSetting |
|
291 | + */ |
|
292 | + public function getSetting(string $key): WidgetSetting { |
|
293 | + if (!array_key_exists($key, $this->settings)) { |
|
294 | + return null; |
|
295 | + } |
|
296 | + |
|
297 | + return $this->settings[$key]; |
|
298 | + } |
|
299 | + |
|
300 | + |
|
301 | + /** |
|
302 | + * @since 15.0.0 |
|
303 | + * |
|
304 | + * @return array |
|
305 | + */ |
|
306 | + public function jsonSerialize() { |
|
307 | + return [ |
|
308 | + 'icon' => $this->getIcon(), |
|
309 | + 'css' => $this->getCss(), |
|
310 | + 'js' => $this->getJs(), |
|
311 | + 'content' => $this->getContent(), |
|
312 | + 'function' => $this->getInitFunction(), |
|
313 | + 'settings' => $this->getSettings() |
|
314 | + ]; |
|
315 | + } |
|
316 | 316 | |
317 | 317 | |
318 | 318 | } |
@@ -49,89 +49,89 @@ |
||
49 | 49 | interface IDashboardManager { |
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Register a IWidgetsService. |
|
54 | - * |
|
55 | - * @since 15.0.0 |
|
56 | - * |
|
57 | - * @param IWidgetsService $widgetsService |
|
58 | - */ |
|
59 | - public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Register a IEventsService. |
|
64 | - * |
|
65 | - * @since 15.0.0 |
|
66 | - * |
|
67 | - * @param IEventsService $eventsService |
|
68 | - */ |
|
69 | - public function registerEventsService(IEventsService $eventsService); |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | - * |
|
75 | - * @see IWidgetConfig |
|
76 | - * |
|
77 | - * @since 15.0.0 |
|
78 | - * |
|
79 | - * @param string $widgetId |
|
80 | - * @param string $userId |
|
81 | - * |
|
82 | - * @throws DashboardAppNotAvailableException |
|
83 | - * @return IWidgetConfig |
|
84 | - */ |
|
85 | - public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Create push notifications for users. |
|
90 | - * $payload is an array that will be send to the Javascript method |
|
91 | - * called on push. |
|
92 | - * $uniqueId needs to be used if you send the push to multiples users |
|
93 | - * and multiples groups so that one user does not have duplicate |
|
94 | - * notifications. |
|
95 | - * |
|
96 | - * Push notifications are created in database and broadcast to user |
|
97 | - * that are running dashboard. |
|
98 | - * |
|
99 | - * @since 15.0.0 |
|
100 | - * |
|
101 | - * @param string $widgetId |
|
102 | - * @param array $users |
|
103 | - * @param array $payload |
|
104 | - * @param string $uniqueId |
|
105 | - * @throws DashboardAppNotAvailableException |
|
106 | - */ |
|
107 | - public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | - * |
|
113 | - * @since 15.0.0 |
|
114 | - * |
|
115 | - * @param string $widgetId |
|
116 | - * @param array $groups |
|
117 | - * @param array $payload |
|
118 | - * @param string $uniqueId |
|
119 | - * @throws DashboardAppNotAvailableException |
|
120 | - */ |
|
121 | - public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * |
|
129 | - * @param string $widgetId |
|
130 | - * @param array $payload |
|
131 | - * @param string $uniqueId |
|
132 | - * @throws DashboardAppNotAvailableException |
|
133 | - */ |
|
134 | - public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
52 | + /** |
|
53 | + * Register a IWidgetsService. |
|
54 | + * |
|
55 | + * @since 15.0.0 |
|
56 | + * |
|
57 | + * @param IWidgetsService $widgetsService |
|
58 | + */ |
|
59 | + public function registerWidgetsService(IWidgetsService $widgetsService); |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Register a IEventsService. |
|
64 | + * |
|
65 | + * @since 15.0.0 |
|
66 | + * |
|
67 | + * @param IEventsService $eventsService |
|
68 | + */ |
|
69 | + public function registerEventsService(IEventsService $eventsService); |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId. |
|
74 | + * |
|
75 | + * @see IWidgetConfig |
|
76 | + * |
|
77 | + * @since 15.0.0 |
|
78 | + * |
|
79 | + * @param string $widgetId |
|
80 | + * @param string $userId |
|
81 | + * |
|
82 | + * @throws DashboardAppNotAvailableException |
|
83 | + * @return IWidgetConfig |
|
84 | + */ |
|
85 | + public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig; |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Create push notifications for users. |
|
90 | + * $payload is an array that will be send to the Javascript method |
|
91 | + * called on push. |
|
92 | + * $uniqueId needs to be used if you send the push to multiples users |
|
93 | + * and multiples groups so that one user does not have duplicate |
|
94 | + * notifications. |
|
95 | + * |
|
96 | + * Push notifications are created in database and broadcast to user |
|
97 | + * that are running dashboard. |
|
98 | + * |
|
99 | + * @since 15.0.0 |
|
100 | + * |
|
101 | + * @param string $widgetId |
|
102 | + * @param array $users |
|
103 | + * @param array $payload |
|
104 | + * @param string $uniqueId |
|
105 | + * @throws DashboardAppNotAvailableException |
|
106 | + */ |
|
107 | + public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = ''); |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Create push notifications for groups. (ie. createUsersEvent()) |
|
112 | + * |
|
113 | + * @since 15.0.0 |
|
114 | + * |
|
115 | + * @param string $widgetId |
|
116 | + * @param array $groups |
|
117 | + * @param array $payload |
|
118 | + * @param string $uniqueId |
|
119 | + * @throws DashboardAppNotAvailableException |
|
120 | + */ |
|
121 | + public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = ''); |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * Create push notifications for everyone. (ie. createUsersEvent()) |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * |
|
129 | + * @param string $widgetId |
|
130 | + * @param array $payload |
|
131 | + * @param string $uniqueId |
|
132 | + * @throws DashboardAppNotAvailableException |
|
133 | + */ |
|
134 | + public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = ''); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 |