summaryrefslogtreecommitdiffstats
path: root/lib/Settings
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2017-05-13 21:31:25 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2017-05-13 21:35:17 +0200
commit53822bb4bc21cadc135d70d3d099c5fd117424b0 (patch)
tree0fe2e35c648cf5441fb3be7f7412aa11d8cfedc1 /lib/Settings
parent86c39a75f04a42be50b7f685f84dae46e54fc137 (diff)
add new apis
Diffstat (limited to 'lib/Settings')
-rw-r--r--lib/Settings/Admin.php38
-rw-r--r--lib/Settings/Section.php33
2 files changed, 71 insertions, 0 deletions
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php
new file mode 100644
index 000000000..a256999f0
--- /dev/null
+++ b/lib/Settings/Admin.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace OCA\News\Settings;
+
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Settings\ISettings;
+
+use OCA\News\Config\Config;
+
+class Admin implements ISettings {
+ private $config;
+
+ public function __construct(Config $config) {
+ $this->config = $config;
+ }
+
+ public function getForm() {
+ $data = [
+ 'autoPurgeMinimumInterval' =>
+ $this->config->getAutoPurgeMinimumInterval(),
+ 'autoPurgeCount' => $this->config->getAutoPurgeCount(),
+ 'maxRedirects' => $this->config->getMaxRedirects(),
+ 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(),
+ 'useCronUpdates' => $this->config->getUseCronUpdates(),
+ 'maxSize' => $this->config->getMaxSize(),
+ 'exploreUrl' => $this->config->getExploreUrl(),
+ ];
+ return new TemplateResponse('news', 'admin', $data, '');
+ }
+
+ public function getSection() {
+ return 'news';
+ }
+
+ public function getPriority() {
+ return 40;
+ }
+}
diff --git a/lib/Settings/Section.php b/lib/Settings/Section.php
new file mode 100644
index 000000000..5e1e47476
--- /dev/null
+++ b/lib/Settings/Section.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace OCA\News\Settings;
+
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use OCP\Settings\ISection;
+
+class Section implements ISection {
+ private $l;
+ private $url;
+
+ public function __construct(IURLGenerator $url, IL10N $l) {
+ $this->url = $url;
+ $this->l = $l;
+ }
+
+ public function getID() {
+ return 'news';
+ }
+
+ public function getName() {
+ return $this->l->t('News');
+ }
+
+ public function getPriority() {
+ return 10;
+ }
+
+ public function getIcon() {
+ return $this->url->imagePath('news', 'app.svg');
+ }
+} \ No newline at end of file