From ecb21237f6411a2fae431f9cfadde2be932f0ea7 Mon Sep 17 00:00:00 2001 From: Andreas Date: Tue, 17 Sep 2019 15:43:01 +0200 Subject: [PATCH] implemented testaction in MVCController --- dev_mvc/controller/MVCController.php | 22 ++++++++++++++++++++-- dev_mvc/index.php | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dev_mvc/controller/MVCController.php b/dev_mvc/controller/MVCController.php index 5243a97..d21c76d 100644 --- a/dev_mvc/controller/MVCController.php +++ b/dev_mvc/controller/MVCController.php @@ -1,6 +1,7 @@ model = "./model/actions/model_empty.php"; - } + } + + + if(isset($_POST['testaction'])){ + $this->testaction = "./model/testactions/model_".$_POST['testaction'].".php"; + } + + } static function getMVCController():MVCController { @@ -51,7 +59,17 @@ class MVCController{ else{ //debug message echo("caught call on non-existant model file."); - } + } + + + //TESTACTION LAYER + + + //check if testaction is valid + if(file_exists($this->testaction)){ + //execute testaction + include_once($this->testaction); + } } function executeViewmodel():void diff --git a/dev_mvc/index.php b/dev_mvc/index.php index 7e2bfee..c40b3ed 100644 --- a/dev_mvc/index.php +++ b/dev_mvc/index.php @@ -10,7 +10,7 @@ require_once('./controller/UserSession.php'); session_start(); $mvcController = new MVCController(); $mvcController->executeModel(); -if(!isset($_POST['admin'])){ +if(!isset($_POST['testaction'])){ include_once("./view/content_pagetemplate.php"); } ?> \ No newline at end of file