nouveau module observers dans env
[mtweb] / mw / env / modules / mw_env_run.php
index d4b63ab..30d89cf 100644 (file)
               }
               if(($controller_validate = $controller->validate($this)) === true){
                 if(($controller_prepare_inputs = $controller->prepare_inputs($this)) === true){
+                  $etat_before = $this->etat;
+                  $this->call_observers("before_action");
                   $controller->$action_method($this);
+                  $etat_after = $this->etat;
+                  $this->etat = $etat_before;
+                  $this->call_observers("after_action");
+                  $this->etat = $etat_after;
                 }
                 else $this->erreur($controller_prepare_inputs);
               }
       else $this->erreur("Impossible d'effectuer cette action");
     }
 
-    function etat($name){
+    function is_running($etat){
+      if($etat = $this->valid_etat($etat)){
+        return
+            ($etat["mod"] == $this->etat("mod"))
+        &&  ($etat["controller"] == $this->etat("controller"))
+        &&  ($etat["action"] == $this->etat("action"));
+      }
+      return false;
+    }
+
+    function etat($name = null){
+      if(!isset($name)) return $this->etat;
       return $this->etat[$name];
     }