Browse Source

Started implementation of events

master
OliverParoczai 4 years ago
parent
commit
0c96cdbe09
  1. 26
      API/request.php
  2. 2
      admin/dataupload.php
  3. 30
      admin/eventupload.php
  4. 12
      css/style.css
  5. 5
      header.php
  6. BIN
      images/eventcategory/default.png
  7. BIN
      images/eventcategory/gepeszet.png
  8. BIN
      images/nodata.png
  9. BIN
      images/nodata.png~
  10. 24
      schools.php

26
API/request.php

@ -41,7 +41,22 @@ if($type == null){
$conn->close();
break;
case "events":
echo json_encode(array('events' => "Linamar"));
$list = array();
if(isset($_GET["ownertype"]) && isset($_GET["ownerid"])){
$result = $conn->query("SELECT * FROM `events` WHERE `ownertype` = '".$conn->real_escape_string($_GET["ownertype"])."' AND `ownerid` = '".$conn->real_escape_string($_GET["ownerid"])."' ");
}else{
$result = $conn->query("SELECT * FROM `events`");
}
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 "image":
if(isset($_GET["subtype"])){
@ -77,6 +92,15 @@ if($type == null){
include "../images/defaultuser.png";
}
break;
case "eventcategory":
header('Content-Type: image/png');
$file = "../images/eventcategory/".$_GET["category"].".png";
if(file_exists($file)){
include $file;
}else{
include "../images/eventcategory/default.png";
}
break;
default:
echo json_encode(array('response' => "Invalid subtype specified"));
break;

2
admin/dataupload.php

@ -8,7 +8,7 @@
<section class="content">
<div class="container-fluid">
<div class="block-header">
<h2>ADATFELTÖLTÉS</h2>
<h2>ADATKEZELÉS</h2>
</div>
<!-- Input Group -->
<div class="row clearfix">

30
admin/eventupload.php

@ -0,0 +1,30 @@
<?php ini_set("allow_url_fopen", 1); $isadmin = true; include "../header.php"; ?>
<section class="content">
<div class="container-fluid">
<div class="block-header">
<h2>ESEMÉNYKEZELÉS</h2>
</div>
<div class="row clearfix">
<div class="container-fluid innercontainer">
<?php
if($type == 2){ $ownertype = 2; $ownerid = substr($_SESSION["selectedcompany"], 1); }else{ $ownertype = 1; $ownerid = substr($_SESSION["selectedschool"], 1); }
$json = json_decode(file_get_contents($url."/API/request.php?type=events&ownertype=".$ownertype."&ownerid=".$ownerid), true);
if(!isset($json["response"])){
echo "<div class='list-group'>";
for($i = 0; $i<count($json); $i++) {
if($json[$i]["title"] != ""){
echo '<a class="listitem list-group-item waves-effect"><img class="smallimg listitemimg squircle" src="'.$url.'/API/request.php?type=image&subtype=eventcategory&category='.$json[$i]["category"].'"><b>'.$json[$i]["title"].'</b><br>'.$json[$i]["description"].'</a>';
}
}
echo "</div>";
}else{
echo "<div class='text-center'><img src='".$curdir."images/nodata.png' width=80px height=80px class='center'><p style='font-size: x-large'>Még nincsennek események hozzáadva</p></div>";
}
?>
</div>
</div>
</div>
</section>
<?php include "../footer.php"; ?>

12
css/style.css

@ -18,6 +18,18 @@
text-overflow: ellipsis;
}
.smallimg{
height: 24px;
width: 24px;
}
.container-fluid .innercontainer {
padding-right: 24px;
padding-left: 24px;
margin-right: auto;
margin-left: auto;
}
/* Navbar ====================================== */
@import url(materialize.css);
.navbar {

5
header.php

@ -19,7 +19,8 @@ if(isset($isadmin) && $isadmin == true){
$isadmin = false;
}
$openpage = basename($_SERVER['PHP_SELF']);
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
//$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://".$_SERVER['HTTP_HOST']."/paredu";
include "creds.php";
@ -530,7 +531,7 @@ if(!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !=
<span>Adatkezelés</span>
</a>
</li>
<li>
<li <?php if($openpage == "eventupload.php"){ echo 'class="active"'; }?>>
<a href="eventupload.php">
<i class="material-icons">event</i>
<span>Eseménykezelés</span>

BIN
images/eventcategory/default.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

BIN
images/eventcategory/gepeszet.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

BIN
images/nodata.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
images/nodata.png~

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

24
schools.php

@ -20,28 +20,4 @@
</div>
</section>
<?php
for($i = 0; $i<count($json); $i++) { #data-toggle="modal" data-target="#schoolModal'.$i.'"
if($json[$i]["name"] == "223"){
echo '<div class="modal fade" id="schoolModal'.$i.'" tabindex="-1" role="dialog" style="display: none;">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="largeModalLabel">'.$json[$i]["name"].'</h4>
</div>
<div class="modal-body">
<div class="list-group">
<a class="list-group-item"><i class="material-icons" style="vertical-align: middle;">map</i>Elhelyezkedés</a>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link waves-effect">SAVE CHANGES</button>
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>';
}
} ?>
<?php include "footer.php"; ?>
Loading…
Cancel
Save