implemented testaction in MVCController

This commit is contained in:
Andreas 2019-09-17 15:43:01 +02:00
parent 7eb0c18615
commit ecb21237f6
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,7 @@
<?php
class MVCController{
private $model;
private $testaction;
private $viewmodel;
private $view;
private $viewOverridden = false;
@ -28,7 +29,14 @@ class MVCController{
}
else{
$this->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

View File

@ -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");
}
?>