Browse code

Add Joblist skeletton for further development

Benjamin Roth authored on31/01/2023 08:55:26
Showing8 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of alox bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+use vossmedien\AloxBundle\Controller\Frontend\Module\JoblistModuleController;
14
+
15
+$GLOBALS['TL_DCA']['tl_module']['palettes'][JoblistModuleController::TYPE] = '{title_legend},name,type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
0 16
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of alox bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+use vossmedien\AloxBundle\Controller\Frontend\Module\JoblistModuleController;
14
+
15
+$GLOBALS['TL_LANG']['FMD'][JoblistModuleController::TYPE][0] = 'Alox Job Liste';
16
+$GLOBALS['TL_LANG']['FMD'][JoblistModuleController::TYPE][1] = 'Gibt eine Liste mit Jobs aus.';
0 17
new file mode 100644
... ...
@@ -3,11 +3,11 @@
3 3
 declare(strict_types=1);
4 4
 
5 5
 /*
6
- * This file is part of formilicious bundle for Contao.
6
+ * This file is part of alox bundle for Contao.
7 7
  *
8 8
  * (c) Benjamin Roth
9 9
  *
10
- * @license LGPL-3.0-or-later
10
+ * @license commercial
11 11
  */
12 12
 
13 13
 namespace vossmedien\AloxBundle\ContaoManager;
14 14
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of alox bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+namespace vossmedien\AloxBundle\Controller\Frontend\Module;
14
+
15
+use Contao\CoreBundle\Controller\FrontendModule\AbstractFrontendModuleController;
16
+use Contao\CoreBundle\ServiceAnnotation\FrontendModule;
17
+use Contao\ModuleModel;
18
+use Contao\System;
19
+use Contao\Template;
20
+use Symfony\Component\HttpClient\HttpClient;
21
+use Symfony\Component\HttpFoundation\Request;
22
+use Symfony\Component\HttpFoundation\Response;
23
+
24
+/**
25
+ * @FrontendModule(JoblistModuleController::TYPE, category="miscellaneous")
26
+ */
27
+class JoblistModuleController extends AbstractFrontendModuleController
28
+{
29
+    public const TYPE = 'alox_joblist';
30
+
31
+    protected function getResponse(Template $template, ModuleModel $model, Request $request): ?Response
32
+    {
33
+        $apiKey = System::getContainer()->getParameter('vossmedien_alox.zvoove.api_key');
34
+        $apiDomain = System::getContainer()->getParameter('vossmedien_alox.zvoove.api_domain');
35
+
36
+        $httpClient = HttpClient::create();
37
+
38
+        $header = [
39
+            'headers' => [
40
+                'X-ApiKey' => $apiKey
41
+            ]
42
+        ];
43
+
44
+        $response = $httpClient->request('GET',$apiDomain, $header);
45
+
46
+        dump($response->getContent());
47
+
48
+        return new Response();
49
+    }
50
+
51
+}
0 52
new file mode 100644
... ...
@@ -0,0 +1,42 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of alox bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license commercial
11
+ */
12
+
13
+namespace vossmedien\AloxBundle\DependencyInjection;
14
+
15
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
16
+use Symfony\Component\Config\Definition\ConfigurationInterface;
17
+
18
+class Configuration implements ConfigurationInterface
19
+{
20
+    public function getConfigTreeBuilder(): TreeBuilder
21
+    {
22
+        $treeBuilder = new TreeBuilder('vossmedien_alox');
23
+        $treeBuilder
24
+            ->getRootNode()
25
+            ->children()
26
+                ->arrayNode('zvoove')
27
+                    ->addDefaultsIfNotSet()
28
+                    ->children()
29
+                        ->scalarNode('api_key')
30
+                            ->info('Your zvoove API key.')
31
+                        ->end()
32
+                        ->scalarNode('api_domain')
33
+                            ->info('Your zvoove API domain.')
34
+                        ->end()
35
+                    ->end()
36
+                ->end()
37
+            ->end()
38
+        ;
39
+
40
+        return $treeBuilder;
41
+    }
42
+}
... ...
@@ -3,11 +3,11 @@
3 3
 declare(strict_types=1);
4 4
 
5 5
 /*
6
- * This file is part of formilicious bundle for Contao.
6
+ * This file is part of alox bundle for Contao.
7 7
  *
8 8
  * (c) Benjamin Roth
9 9
  *
10
- * @license LGPL-3.0-or-later
10
+ * @license commercial
11 11
  */
12 12
 
13 13
 namespace vossmedien\AloxBundle\DependencyInjection;
... ...
@@ -21,6 +21,13 @@ class VossmedienAloxExtension extends Extension
21 21
 {
22 22
     public function load(array $configs, ContainerBuilder $container): void
23 23
     {
24
+        $config = $this->processConfiguration(new Configuration(), $configs);
25
+
26
+        foreach($config['zvoove'] as $key=>$val)
27
+        {
28
+            $container->setParameter('vossmedien_alox.zvoove.'.$key,$val);
29
+        }
30
+
24 31
         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
25 32
         $loader->load('services.yml');
26 33
     }
... ...
@@ -3,11 +3,11 @@
3 3
 declare(strict_types=1);
4 4
 
5 5
 /*
6
- * This file is part of formilicious bundle for Contao.
6
+ * This file is part of alox bundle for Contao.
7 7
  *
8 8
  * (c) Benjamin Roth
9 9
  *
10
- * @license LGPL-3.0-or-later
10
+ * @license commercial
11 11
  */
12 12
 
13 13
 namespace vossmedien\AloxBundle;