Refactored code to use namespaces

This commit is contained in:
2019-09-30 14:17:21 +02:00
parent 28e378fbe2
commit 929a848b23
37 changed files with 135 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ require_once("index.php");
<?php
include_once(ROOT_DIR."/view/webcontent/content_header.php");
?>
</header>
<div class="main">
<?php

View File

@@ -1,6 +1,5 @@
<?php
require_once ROOT_DIR.'/model/forum/Thread.php';
require_once ROOT_DIR.'/model/forum/User.php';
use controller\MVCController;
foreach (MVCController::$viewData['boards'] as $board){
include ROOT_DIR.'/view/webcontent/modules/modules_boards/module_boardtable.php';
}

View File

@@ -1,3 +1,6 @@
<?php
use controller\MVCController;
?>
<form action="./?p=showthread&thread=<?=MVCController::$viewData['threadid'];?>" method="post">
<textarea placeholder="post content" name="content"></textarea><br>
<input type="submit" value="Create Reply">

View File

@@ -1,5 +1,5 @@
<?php
require_once(ROOT_DIR.'/controller/UserSession.php');
use controller\UserSession;
if(UserSession::isUserSignedIn()){
include(ROOT_DIR.'/view/webcontent/header/header_signedin.php');
}

View File

@@ -1,7 +1,8 @@
<?php
require_once ROOT_DIR.'/model/forum/Thread.php';
require_once ROOT_DIR.'/model/forum/Reply.php';
require_once ROOT_DIR.'/model/forum/User.php';
use controller\MVCController;
use model\forum\Thread;
use model\forum\Reply;
use model\forum\User;
//$thread = new Thread();
$thread = MVCController::$viewData['thread'];
$replies = $thread->getReplies();

View File

@@ -1,7 +1,7 @@
<div class="logo">
hF
</div>
<nav>
<a href="./">Home</a>
<a href="?action=signout">Sign out</a>
</nav>
<div class="logo">
hF
</div>
<nav>
<a href="./">Home</a>
<a href="?action=signout">Sign out</a>
</nav>

View File

@@ -1,8 +1,8 @@
<div class="logo">
hF
</div>
<nav>
<a href="./">Home</a>
<a href="?p=register">Register</a>
<a href="?p=signin">Sign in</a>
</nav>
<div class="logo">
hF
</div>
<nav>
<a href="./">Home</a>
<a href="?p=register">Register</a>
<a href="?p=signin">Sign in</a>
</nav>

View File

@@ -1,3 +1,6 @@
<?php
use controller\MVCController;
?>
<h2><?=$board->name?></h2>
<a href="?p=createthread&board=<?=$board->id?>">Create Thread</a>
<table>
@@ -6,7 +9,7 @@
<th width=10%>Started by</th>
<th width=15%>Last reply</th>
</tr>
<?php
<?php
foreach (MVCController::$viewData['threads'] as $thread){
if($thread->getBoardID() == $board->id){
$currentRow = [];
@@ -28,7 +31,7 @@ foreach (MVCController::$viewData['threads'] as $thread){
}
}
}
?>
?>
<tr>
<td>
<a href="?p=showthread&thread=<?=$currentRow['threadID']?>"><?=$currentRow['threadTitle']?></a>
@@ -39,9 +42,10 @@ foreach (MVCController::$viewData['threads'] as $thread){
</td>
<td>
<?=$currentRow['lastUpdated']?>
</td>
</tr>
<?php
<?php
}
}
?>