1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-06-25 16:04:37 -05:00

CSS Reshuffle, Added Page Renderer

Reorganized the CSS structure to there is some seperation between front
facing style and the backend den.

Also add the Render class so auth status is included in every template
rendering event so login status and select member data is available if
needed. will expand if needed.
This commit is contained in:
Ro
2023-01-08 14:28:25 -08:00
parent 26f3cbe994
commit 735117fcda
31 changed files with 11403 additions and 199 deletions

View File

@ -81,10 +81,14 @@ class HandleLocations
* @param Request $request object containing posted data
* @return JSON
*/
public function addLocation($request, $memberId)
public function modifyLocation($request, $memberId, $action, $uuid = 0)
{
$errorMessage = null;
$location = new Location();
if ($action == "add") {
$location = new Location();
} else {
$location = $this->entityManager->getRepository(Location::class)->findOneBy(["uuid" => $uuid]);
}
//submitted values
$name = $request->request->get("loc_name");
@ -109,13 +113,17 @@ class HandleLocations
}
//set defaults
$location->setUuid(Uuid::v4());
$location->setActive(false);
$location->setCreatedAt(new \DateTimeImmutable());
$location->setUpdatedAt(new \DateTimeImmutable());
$location->setAddedBy($memberId);
$this->entityManager->persist($location);
if ($action == "add") {
$location->setUuid(Uuid::v4());
$location->setActive(false);
$location->setCreatedAt(new \DateTimeImmutable());
$location->setAddedBy($memberId);
$this->entityManager->persist($location);
} else {
$active = ($request->request->get("rating") == "true" ? true : false);
$location->setActive($active);
}
try {
$this->entityManager->flush();
@ -132,9 +140,15 @@ class HandleLocations
}
// return result status
if ($errorMessage == null) {
$message = "";
if ($action == "add") {
$message = "New location added. Woohoo!";
} else {
$message = "Location Updated! Water break!";
}
return $response = [
"status" => true,
"message" => "New member added. Woohoo!",
"message" => $message,
];
} else {
return $response = ["status" => false, "message" => $errorMessage];
@ -185,10 +199,10 @@ class HandleLocations
$location->setRating($ratings);
//grab images, move them to dir and set image array
foreach ($imgs as $img) {
foreach ($imgs as $key => $img) {
$imageName = uniqid() . ".jpg";
$path = "../public/assets/images/examples/" . $imageName;
array_push($examples, $imageName);
array_push($examples, ["image_index" => $key, "path" => urlencode($imageName)]);
file_put_contents($path, file_get_contents(trim($img)));
}
$location->setImages($examples);