Skip to content
Snippets Groups Projects
Commit f26c59f5 authored by Genvictus's avatar Genvictus
Browse files

add: getResources from PostManager

parent f384bd09
Branches
Tags
No related merge requests found
......@@ -4,10 +4,7 @@ require_once SRC_ROOT_PATH . "/app/baseclasses/BaseController.php";
require_once SRC_ROOT_PATH . "/app/core/FileAccess.php";
require_once SRC_ROOT_PATH . "/app/models/PostModel.php";
require_once SRC_ROOT_PATH . "/app/models/PostResourceModel.php";
require_once SRC_ROOT_PATH . "/app/modelmanagers/PostManager.php";
require_once SRC_ROOT_PATH . "/app/modelmanagers/PostResourceManager.php";
class PostController extends BaseController
{
......@@ -39,7 +36,7 @@ class PostController extends BaseController
$resources = [];
var_dump($_FILES);
// var_dump($_FILES);
if(!empty($_FILES['file_input']['tmp_name'])) {
$fileAccess = FileAccess::getInstance();
$newFileName = $fileAccess->saveFile($_FILES['file_input']['tmp_name'], FileAccess::POSTS_PATH, $_FILES['file_input']['type']);
......
......@@ -4,6 +4,8 @@ require_once SRC_ROOT_PATH . "/app/baseclasses/BaseManager.php";
require_once SRC_ROOT_PATH . "/app/models/PostModel.php";
require_once SRC_ROOT_PATH . "/app/modelmanagers/PostResourceManager.php";
class PostManager extends BaseManager
{
protected static $instance;
......@@ -95,6 +97,17 @@ class PostManager extends BaseManager
}
}
public function getResources($post_id, $post_owner_id)
{
$postResourceSrv = PostResourceManager::getInstance();
$where = [
"post_id" => ["=", $post_id, PostResourceModel::$PDOATTR["post_id"]],
"post_owner_id" => ["=", $post_owner_id, PostResourceModel::$PDOATTR["post_owner_id"]]
];
return $postResourceSrv->findAll();
}
public function getByUser($user_id)
{
$where = PostManager::getUserSelection($user_id);
......
......@@ -21,8 +21,4 @@ class PostResourceManager extends BaseManager
}
return self::$instance;
}
public function get($attribute) {
return $this->$attribute;
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@
<body>
<section id="overlay">
<img src="/public/assets/github_post_logo.jpg" alt="Github Logo" id="logo">
<img src="/public/assets/Logo.png" alt="Github Logo" id="logo">
<hr>
<h1>You have made a new post!</h1>
</section>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment