Browse code

Bug fix

Rafał Szklarczyk authored on 29/01/2020 22:00:10
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ abstract class ViewModel{
10 10
                     
11 11
     public function __construct($arg)
12 12
     {
13
-        if($arg instanceof Applicstion){
13
+        if($arg instanceof Application){
14 14
             $this->_L3 = $arg;
15 15
         }
16 16
         else{
Browse code

ViewModel bug fix

Rafał Szklarczyk authored on 08/10/2019 11:36:22
Showing 1 changed files
... ...
@@ -11,7 +11,7 @@ abstract class ViewModel{
11 11
     public function __construct($arg)
12 12
     {
13 13
         if($arg instanceof Applicstion){
14
-            $this->_L3 = $_L3;
14
+            $this->_L3 = $arg;
15 15
         }
16 16
         else{
17 17
             global $_L3;
Browse code

ViewModel fix

Rafał Szklarczyk authored on 12/06/2019 12:21:06
Showing 1 changed files
... ...
@@ -18,7 +18,7 @@ abstract class ViewModel{
18 18
             $this->_L3 = $_L3;
19 19
         }
20 20
 
21
-        $match = $_L3->findControllerInCallStack();
21
+        $match = $this->_L3->findControllerInCallStack();
22 22
 
23 23
         $this->controller = $match['controller'];
24 24
         $this->module = $match['module'];
Browse code

Serialization and ViewEngines basics

Rafał Szklarczyk authored on 06/06/2019 20:03:48
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,62 @@
1
+<?php
2
+
3
+namespace elanpl\L3;
4
+
5
+abstract class ViewModel{
6
+    private $module;
7
+    private $controller;
8
+    private $action;
9
+    public $_L3;
10
+                    
11
+    public function __construct($arg)
12
+    {
13
+        if($arg instanceof Applicstion){
14
+            $this->_L3 = $_L3;
15
+        }
16
+        else{
17
+            global $_L3;
18
+            $this->_L3 = $_L3;
19
+        }
20
+
21
+        $match = $_L3->findControllerInCallStack();
22
+
23
+        $this->controller = $match['controller'];
24
+        $this->module = $match['module'];
25
+        $this->action = $match['action'];
26
+    }
27
+
28
+    public function getController(){
29
+        if(!isset($this->controller)){
30
+            throw new \Exception("Controller not found in ViewModel \"".get_class($this)."! Use parent::__construct() in the class constructor or setController method.");
31
+        }
32
+        else
33
+            return $this->controller;
34
+    }
35
+
36
+    public function getAction(){
37
+        if(!isset($this->action)){
38
+            throw new \Exception("Action not found in ViewModel \"".get_class($this)."! Use parent::___construct() in the class constructor or setAction method.");
39
+        }
40
+        return $this->action;
41
+    }
42
+
43
+    public function getModule(){
44
+        return $this->module;
45
+    }
46
+
47
+    public function setController($controller){ 
48
+        return $this->controller = $controller;
49
+    }
50
+
51
+    public function setAction($action){ 
52
+        return $this->action = $action;
53
+    }
54
+
55
+    public function setModule($module){ 
56
+        return $this->module = $module;
57
+    }
58
+
59
+    public function getDTO(){
60
+        //function to be overriden
61
+    }
62
+}
0 63
\ No newline at end of file