implemented testaction in MVCController
This commit is contained in:
parent
7eb0c18615
commit
ecb21237f6
@ -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
|
||||
|
||||
@ -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");
|
||||
}
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user