diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-03-01 16:02:48 +0300 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-03-01 16:02:48 +0300 |
commit | 6c808d3df0b43d73cfdc29b0059595fc1e2befd9 (patch) | |
tree | 74ce31cd88f483c6a6ad1438db21238192515c5b | |
parent | a7f4a4fd7357103d90c3cc1ba3e138bc210a43e0 (diff) |
Prepare application settingsv1.3.5
-rw-r--r-- | appinfo/info.xml | 5 | ||||
-rw-r--r-- | lib/Settings/Admin.php | 62 | ||||
-rw-r--r-- | lib/Settings/Section.php | 47 |
3 files changed, 114 insertions, 0 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml index a481c43..8bdf244 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -18,4 +18,9 @@ <bugs>https://github.com/nextcloud/weather/issues</bugs> <repository type="git">https://github.com/nextcloud/weather</repository> <ocsid>170605</ocsid> + <namespace>Weather</namespace> + <settings> + <admin>\OCA\Weather\Settings\Admin</admin> + <admin-section>\OCA\Weather\Settings\Section</admin-section> + </settings> </info> diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php new file mode 100644 index 0000000..e6c6381 --- /dev/null +++ b/lib/Settings/Admin.php @@ -0,0 +1,62 @@ +<?php +/** + * ownCloud - Weather + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Loic Blot <loic.blot@unix-experience.fr> + * @copyright Loic Blot 2017 + */ + +namespace OCA\Weather\Settings; + +use OCP\AppFramework\Http\TemplateResponse; +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\Settings\ISettings; + +class Admin implements ISettings { + /** @var IL10N */ + private $l10n; + + /** @var IURLGenerator */ + private $urlGenerator; + + /** + * @param IL10N $l10n + */ + public function __construct(IL10N $l10n, IURLGenerator $urlGenerator) { + $this->l10n = $l10n; + $this->urlGenerator = $urlGenerator; + } + + /** + * @return TemplateResponse + */ + public function getForm() { + $params = [ + ]; + + return new TemplateResponse('weather', 'admin', $params); + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'weather'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * keep the server setting at the top, right after "server settings" + */ + public function getPriority() { + return 0; + } +}; +?> diff --git a/lib/Settings/Section.php b/lib/Settings/Section.php new file mode 100644 index 0000000..67a1a46 --- /dev/null +++ b/lib/Settings/Section.php @@ -0,0 +1,47 @@ +<?php +/** + * ownCloud - Weather + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Loic Blot <loic.blot@unix-experience.fr> + * @copyright Loic Blot 2017 + */ + +namespace OCA\Weather\Settings; + +use OCP\IL10N; +use OCP\Settings\ISection; + +class Section implements ISection { + /** @var IL10N */ + private $l; + + public function __construct(IL10N $l) { + $this->l = $l; + } + + /** + * {@inheritdoc} + */ + public function getID() { + return 'saml'; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->l->t('Weather'); + } + + /** + * {@inheritdoc} + */ + public function getPriority() { + return 75; + } +} + +?> |