implemented testaction in MVCController
This commit is contained in:
parent
7eb0c18615
commit
ecb21237f6
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
class MVCController{
|
class MVCController{
|
||||||
private $model;
|
private $model;
|
||||||
|
private $testaction;
|
||||||
private $viewmodel;
|
private $viewmodel;
|
||||||
private $view;
|
private $view;
|
||||||
private $viewOverridden = false;
|
private $viewOverridden = false;
|
||||||
@ -29,6 +30,13 @@ class MVCController{
|
|||||||
else{
|
else{
|
||||||
$this->model = "./model/actions/model_empty.php";
|
$this->model = "./model/actions/model_empty.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($_POST['testaction'])){
|
||||||
|
$this->testaction = "./model/testactions/model_".$_POST['testaction'].".php";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
static function getMVCController():MVCController
|
static function getMVCController():MVCController
|
||||||
{
|
{
|
||||||
@ -53,6 +61,16 @@ class MVCController{
|
|||||||
echo("caught call on non-existant model file.");
|
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
|
function executeViewmodel():void
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,7 +10,7 @@ require_once('./controller/UserSession.php');
|
|||||||
session_start();
|
session_start();
|
||||||
$mvcController = new MVCController();
|
$mvcController = new MVCController();
|
||||||
$mvcController->executeModel();
|
$mvcController->executeModel();
|
||||||
if(!isset($_POST['admin'])){
|
if(!isset($_POST['testaction'])){
|
||||||
include_once("./view/content_pagetemplate.php");
|
include_once("./view/content_pagetemplate.php");
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user