From e922d0f267c84dec7f0f1096e6c946d2998ad089 Mon Sep 17 00:00:00 2001 From: OliverParoczai Date: Wed, 31 Mar 2021 01:18:18 +0200 Subject: [PATCH] Implementation of event viewing (no handling yet) and prettifying admin panel --- API/request.php | 45 ++++++++++++++++++++- admin/eventupload.php | 54 ++++++++++++++++++++++++- css/style.css | 7 ++-- event.php | 93 +++++++++++++++++++++++++++++++++++++++++++ events.php | 53 ++++++++++++------------ header.php | 10 ++++- school.php | 55 +++++++++++++++---------- schools.php | 8 +++- 8 files changed, 267 insertions(+), 58 deletions(-) create mode 100644 event.php diff --git a/API/request.php b/API/request.php index 3a1aa3b..1c0bcc7 100644 --- a/API/request.php +++ b/API/request.php @@ -31,11 +31,54 @@ if($type == null){ switch($type){ case "schools": $list = array(); - if ($result = $conn->query("SELECT * FROM `schools`")) { + if(isset($_GET["id"])){ + $result = $conn->query("SELECT * FROM `schools` WHERE `id` = '".$conn->real_escape_string($_GET["id"])."'"); + }else{ + $result = $conn->query("SELECT * FROM `schools`"); + } + if (!empty($result) && $result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $list[] = $row; + } + echo json_encode($list); + }else{ + echo json_encode(array('response' => "No events connected to specified owner")); + } + $result->close(); + $conn->close(); + break; + case "user": + $list = array(); + if(isset($_GET["id"])){ + $result = $conn->query("SELECT * FROM `auth` WHERE `id` = '".$conn->real_escape_string($_GET["id"])."'"); + }else{ + $result = $conn->query("SELECT * FROM `auth`"); + } + if (!empty($result) && $result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + $list["name"] += $row["name"]; + } + echo json_encode($list); + }else{ + echo json_encode(array('response' => "No events connected to specified owner")); + } + $result->close(); + $conn->close(); + break; + case "companies": + $list = array(); + if(isset($_GET["id"])){ + $result = $conn->query("SELECT * FROM `companies` WHERE `id` = '".$conn->real_escape_string($_GET["id"])."'"); + }else{ + $result = $conn->query("SELECT * FROM `companies`"); + } + if (!empty($result) && $result->num_rows > 0) { while($row = $result->fetch_assoc()) { $list[] = $row; } echo json_encode($list); + }else{ + echo json_encode(array('response' => "No events connected to specified owner")); } $result->close(); $conn->close(); diff --git a/admin/eventupload.php b/admin/eventupload.php index 77ff551..fe16382 100644 --- a/admin/eventupload.php +++ b/admin/eventupload.php @@ -10,11 +10,63 @@ "; for($i = 0; $i'.$json[$i]["title"].'
'.$json[$i]["description"].''; + #echo ''.$json[$i]["title"].'
'.$json[$i]["description"].'
'; + //echo '
'.$json[$i]["title"].'
'.$selschvals["name"].'
'.$json[$i]["description"].'
'; + echo ' +
+ +
+
+
+

'.$json[$i]["title"].'


+

'.$json[$i]["description"].'

+
+
+
+
+
+ +
+ '; } } echo ""; diff --git a/css/style.css b/css/style.css index 878bc82..733cc4d 100644 --- a/css/style.css +++ b/css/style.css @@ -1,14 +1,12 @@ /* Custom ParEdu mods ====================================== */ .squircle { - border-radius: 4% !important; + border-radius: 6% !important; } .listitemimg { - float:left; - display:inline-block; height: 45px; width: 45px; - margin-right: 10px; + margin-right: 15px; } .listitem{ @@ -30,6 +28,7 @@ margin-left: auto; } + /* Navbar ====================================== */ @import url(materialize.css); .navbar { diff --git a/event.php b/event.php new file mode 100644 index 0000000..35b05d3 --- /dev/null +++ b/event.php @@ -0,0 +1,93 @@ +query($viewsql); +if ($result == TRUE) { + if (!empty($result) && $result->num_rows > 0) { + $ownervals = $result->fetch_assoc(); + $ownername = $ownervals["name"]; + }else{ + $ownername = "Ismeretlen"; + } +} +?> + +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/events.php b/events.php index ae67645..84d2e49 100644 --- a/events.php +++ b/events.php @@ -1,4 +1,4 @@ - +
@@ -9,9 +9,30 @@
'.$json[$i]["name"].'
'.$json[$i]["location"].'
Second line'; + if(!isset($json["response"])){ + for($i = 0; $iquery($viewsql); + if ($result == TRUE) { + if (!empty($result) && $result->num_rows > 0) { + $vals = $result->fetch_assoc(); + $ownername = $vals["name"]; + }else{ + $ownername = "Ismeretlen"; + } + } + echo ' + +
+ '.$json[$i]["title"].'
'.$ownername.'
'.$json[$i]["description"].'
+
+
'; + } } } ?> @@ -20,28 +41,4 @@
- - - '; - } -} ?> - \ No newline at end of file diff --git a/header.php b/header.php index 1a2e340..450c515 100644 --- a/header.php +++ b/header.php @@ -35,8 +35,12 @@ if ($conn->connect_error) { } if(isset($_POST["selectedcompany"]) && $loggedin){ $_SESSION["selectedcompany"] = $_POST["selectedcompany"]; + header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); + die(); }elseif(isset($_POST["selectedschool"]) && $loggedin){ $_SESSION["selectedschool"] = $_POST["selectedschool"]; + header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); + die(); } if(!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type != 2 && $type != 3){ @@ -51,7 +55,11 @@ if(!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type != if (!empty($result) && $result->num_rows > 0) { $sqlvals = $result->fetch_assoc(); $username = $sqlvals["username"]; + $userid = $sqlvals["id"]; $type = $sqlvals["type"]; + if(isset($sqlvals["fullname"])){ + $fullname = $sqlvals["fullname"]; + } if($type == 2){ $connctdcmps = explode(",", $sqlvals["connectedcompanyids"]); }elseif($type == 1){ @@ -462,7 +470,7 @@ if(!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type != User
- +
".$ssname; ?>
diff --git a/school.php b/school.php index 4435520..16bfdad 100644 --- a/school.php +++ b/school.php @@ -1,63 +1,74 @@ +
+
-
') center center; width: 100%; height: 200px; background-repeat: no-repeat; background-size: cover;">
+
') center center; width: 100%; height: ; background-repeat: no-repeat; background-size: cover;">
-

+ ".$mjson[$mid]["name"].""; }else{ echo "

".$mjson[$mid]["name"]."

"; }?>

+
@@ -67,14 +78,14 @@ $json[$schoolid]["type"] integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""> - \ No newline at end of file + \ No newline at end of file diff --git a/schools.php b/schools.php index 646f402..14ef281 100644 --- a/schools.php +++ b/schools.php @@ -11,7 +11,13 @@ $json = json_decode(file_get_contents($url."/API/request.php?type=schools"), true); for($i = 0; $i'.$json[$i]["name"].'
'.$json[$i]["location"].'
Second line'; + echo ' + + + + +
'.$json[$i]["name"].'
'.$json[$i]["location"].'
Second line
+
'; } } ?>