Browse Source

Finish event uploading, minor fixes

master
OliverParoczai 4 years ago
parent
commit
dff3fc7372
  1. 7
      API/request.php
  2. 46
      admin/eventupload.php
  3. 8
      css/style.css
  4. 9
      events.php
  5. 4
      footer.php
  6. 37
      header.php
  7. 10
      school.php
  8. 6
      setup.php

7
API/request.php

@ -53,7 +53,12 @@ if($type == null){
}
if (!empty($result) && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$list["name"] += $row["name"];
if($row["fullname"] != ""){
$list["name"] = $row["fullname"];
}else{
$list["name"] = $row["username"];
}
}
echo json_encode($list);
}else{

46
admin/eventupload.php

@ -1,4 +1,4 @@
<?php ini_set("allow_url_fopen", 1); $isadmin = true; include "../header.php"; ?>
<?php ini_set("allow_url_fopen", 1); $isadmin = true; $eventupload = true; include "../header.php"; ?>
<section class="content">
<div class="container-fluid">
@ -8,16 +8,23 @@
<div class="row clearfix">
<div class="container-fluid innercontainer">
<div>
<button type="button" data-toggle="modal" data-target="#addEvent" class="btn bg-teal waves-effect">ESEMÉNY HOZZÁADÁSA</button>
<button type="button" data-toggle="modal" data-target="#addEvent" class="btn bg-teal waves-effect" style="margin-bottom: 15px;">ESEMÉNY HOZZÁADÁSA</button>
</div>
<?php
if($type == 2){ $ownertype = 2; $ownerid = substr($_SESSION["selectedcompany"], 1); }else{ $ownertype = 1; $ownerid = substr($_SESSION["selectedschool"], 1); }
if($type == 2){
$ownertype = 2;
$ownerid = substr($_SESSION["selectedcompany"], 1);
$schjson = json_decode(file_get_contents($url."/API/request.php?type=companies&id=".$ownerid), true);
}else{
$ownertype = 1;
$ownerid = substr($_SESSION["selectedschool"], 1);
$schjson = json_decode(file_get_contents($url."/API/request.php?type=schools&id=".$ownerid), true);
}
$json = json_decode(file_get_contents($url."/API/request.php?type=events&ownertype=".$ownertype."&ownerid=".$ownerid), true);
$schjson = json_decode(file_get_contents($url."/API/request.php?type=schools&id=".$ownerid), true);
$userjson = json_decode(file_get_contents($url."/API/request.php?type=user&id=".$userid), true);
if(!isset($json["response"])){
echo "<div class='list-group'>";
for($i = 0; $i<count($json); $i++) {
for($i = count($json)-1; $i>=0; $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 '<a class="listitem list-group-item waves-effect" href="'.$curdir.'event.php?id='.$json[$i]["eventid"].'"><table><td><img class="smallimg listitemimg squircle" src="'.$url.'/API/request.php?type=image&subtype=eventcategory&category='.$json[$i]["category"].'"><td><td><b>'.$json[$i]["title"].'</b><br>'.$selschvals["name"].'<br>'.$json[$i]["description"].'</b><td></table></a>';
@ -27,14 +34,14 @@
<div class="media">
<div class="media-left">
<a href="#">';
if($json[$i]["uploadedas_userid"] != ""){ echo '<img src="'.$url.'/API/request.php?type=image&subtype=user&id='.$userid.'">';
}else{ echo '<img src="'.$url.'/API/request.php?type=image&subtype=school&id='.$ownerid.'">'; }
if($json[$i]["uploadedas_userid"] != ""){ echo '<img class="fixsizeimg42" src="'.$url.'/API/request.php?type=image&subtype=user&id='.$userid.'">';
}else{ echo '<img class="fixsizeimg42" src="'.$url.'/API/request.php?type=image&subtype=school&id='.$ownerid.'">'; }
echo'</a>
</div>
<div class="media-body">
<h4 class="media-heading">
<a href="#">';
if($json[$i]["uploadedas_userid"] != ""){ echo "stuff";
if($json[$i]["uploadedas_userid"] != ""){ echo $userjson["name"];
}else{ echo $schjson[0]["name"]; }
echo '</a>
</h4>
@ -88,16 +95,21 @@
<div class="modal-header">
<h4 class="modal-title" id="largeModalLabel">ESEMÉNY HOZZÁADÁSA</h4>
</div>
<div class="modal-body">
<div class="list-group">
<input type="text" placeholder="Cím">
<textarea id="eventdesceditor"></textarea>
<form method="POST" action="#">
<div class="modal-body">
<div class="input-group">
<span class="form-line">
<input type="text" class="form-control" placeholder="Cím" name="title" required>
</span>
<textarea id="eventdesceditor" name="description"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link waves-effect">MENTÉS</button>
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">MÉGSEM</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">MÉGSEM</button>
<button type="submit" name="submituser" class="btn btn-link waves-effect col-blue-grey">FELTÖLTÉS (FELHASZNÁLÓKÉNT)</button>
<button type="submit" name="submit" class="btn btn-link waves-effect">FELTÖLTÉS</button>
</div>
</form>
</div>
</div>
</div>

8
css/style.css

@ -42,7 +42,13 @@ section.fullscreencontent {
}
.ls-closed section.fullscreencontent {
margin-left: 15px; }
margin-left: 15px;
}
.fixsizeimg42 {
height: 42px;
width: 42px;
}
/* Navbar ====================================== */
@import url(materialize.css);

9
events.php

@ -10,7 +10,7 @@
<?php
$json = json_decode(file_get_contents($url."/API/request.php?type=events"), true);
if(!isset($json["response"])){
for($i = 0; $i<count($json); $i++) {
for($i = count($json)-1; $i>=0; $i--) {
if($json[$i]["title"] != ""){
if($json[$i]["ownertype"] == 2){
$viewsql = "SELECT * FROM `companies` WHERE `id` = ".$json[$i]["ownerid"];
@ -21,7 +21,12 @@
if ($result == TRUE) {
if (!empty($result) && $result->num_rows > 0) {
$vals = $result->fetch_assoc();
$ownername = $vals["name"];
if($json[$i]["uploadedas_userid"] != ""){
$userjson = json_decode(file_get_contents($url."/API/request.php?type=user&id=".$json[$i]["ownerid"]), true);
$ownername = $userjson["name"];
}else{
$ownername = $vals["name"];
}
}else{
$ownername = "Ismeretlen";
}

4
footer.php

@ -45,8 +45,10 @@
<script src="<?php echo $curdir; ?>plugins/jquery-inputmask/jquery.inputmask.bundle.js"></script>
<!-- Bootstrap Tags Input Plugin Js -->
<script src="<?php echo $curdir; ?>plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
<?php }elseif(isset($ischat)){ ?>
<?php }elseif($ischat){ ?>
<script src="chat_script.js"></script>
<?php }elseif(isset($load_school)){ ?>
<script src="<?php echo $curdir; ?>plugins/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
<?php } ?>
</body>

37
header.php

@ -120,6 +120,7 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !
copy($_FILES["formfile"]["tmp_name"], $filepath);
}
}
$conn->query($modsql);
if(isset($uploadProblem)){
header("Location: dataupload.php?imageuploaded=".$uploadProblem);
die();
@ -150,6 +151,29 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !
}
die();
}
}elseif(isset($eventupload)){
if(isset($_POST["submit"]) || isset($_POST["submituser"])){
if($type == 2){
$ownertype = 2;
$ownerid = substr($_SESSION["selectedcompany"], 1);
}else{
$ownertype = 1;
$ownerid = substr($_SESSION["selectedschool"], 1);
}
if(isset($_POST["submituser"])){
$submituser = $userid;
}else{
$submituser = "";
}
$modsql = "INSERT INTO `events` (`title`, `description`, `datetime`, `ownertype`, `ownerid`, `category`, `uploadedas_userid`) VALUES ('".$conn->real_escape_string($_POST['title'])."', '".$conn->real_escape_string($_POST['description'])."', '".date('Y-m-d H:i:s')."', '".$ownertype."', '".$ownerid."', 'none', '".$submituser."');";
if ($conn->query($modsql) === TRUE) {
header("Location: eventupload.php?eventadded=1");
} else {
header("Location: eventupload.php?eventadded=0");
}
die();
}
}
if($type == 2){
@ -276,6 +300,15 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !
</style>
<?php } ?>
<?php if(isset($load_school)){ ?>
<link href="<?php echo $curdir; ?>plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet">
<style>
span [data-role="remove"]{
display: none;
}
</style>
<?php } ?>
<style>
.row.display-flex {
display: flex;
@ -287,7 +320,7 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !
}
</style>
<?php if(isset($ischat)){ ?>
<?php if($ischat){ ?>
<link href="<?php echo $curdir; ?>css/chat.css" rel="stylesheet" />">
<?php } ?>
@ -483,7 +516,7 @@ if((!isset($liteload) && $loggedin == false && $isadmin && $type != 1 && $type !
<img src="<?php echo $curdir; ?>API/request.php?type=image&subtype=user&id=<?php echo $id; ?>" width="48" height="48" alt="User" />
</div>
<div class="info-container">
<div class="name" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php if(isset($fullname)){ echo $fullname; }else {echo $username; } ?></div>
<div class="name" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><?php if(isset($fullname) && $fullname != ""){ echo $fullname; }else {echo $username; } ?></div>
<div class="misc"><?php echo $fulltype."<br>".$ssname; ?></div>
<?php if($loggedin){ ?>
<div class="btn-group user-helper-dropdown">

10
school.php

@ -1,7 +1,7 @@
<?php
ini_set("allow_url_fopen", 1);
$load_leaflet = true;
if(!isset($borderless)){ include "header.php"; $inputid = $_GET["id"]; }
if(!isset($borderless)){ $load_school = true; include "header.php"; $inputid = $_GET["id"]; }
if(isset($iscompany)){
$mjson = json_decode(file_get_contents($url."/API/request.php?type=companies"), true);
@ -27,7 +27,7 @@ for($mid = 0; $mid<count($mjson); $mid++) {
<div class="card profile-card">
<div class="profile-header" style="background: url('<?php echo $url; ?>/API/request.php?type=image&subtype=<?php echo $ownerimgtype; ?>&id=<?php echo $mjson[$mid]["id"]; ?>') center center; width: 100%; height: <?php if(!isset($borderless)){ echo '200px'; }else{ echo '150px'; } ?>; background-repeat: no-repeat; background-size: cover;"></div>
<div class="profile-body">
<div style="text-align: left; padding-left: 15px;">
<div style="text-align: left; padding-left: 15px; padding-right: 15px;">
<?php if(!isset($borderless)){ echo "<h3>".$mjson[$mid]["name"]."</h3>"; }else{ echo "<h4>".$mjson[$mid]["name"]."</h4>"; }?>
<p><b><?php
for($i = 0; $i<count($mjsonlang); $i++) {
@ -58,6 +58,12 @@ for($mid = 0; $mid<count($mjson); $mid++) {
<?php if($mjson[$mid]["emailaddress"] != ""){ echo "<span><a href='mailto:".$mjson[$mid]["emailaddress"]."'><b>".$mjson[$mid]["emailaddress"]."</b></a> </span>"; }else{ echo "<span><b>Nincs megadva</b></span>"; }?>
<br>
</li>
<?php if(!isset($borderless)){ ?>
<span><i class="material-icons left" style="vertical-align: middle;">book</i>Oktatott szakok</span>
<div class="form-line">
<input type="text" class="form-control" data-role="tagsinput" value="<?php echo $mjson[$mid]["spec"]; ?>" readOnly disabled>
</div>
<?php } ?>
</ul>
</div>
</div>

6
setup.php

@ -9,15 +9,15 @@ if(!file_exists("images/company")){
$error = 1;
}
}
if(!file_exists("images/school")){
if(mkdir("images/school", 0777) && $error != 1){
if(!file_exists("images/user")){
if(mkdir("images/user", 0777) && $error != 1){
echo "Felhasználói fotó könyvtár létrehozva<br>";
}else{
$error = 1;
}
}
if(!file_exists("images/school")){
if(mkdir("images/user", 0777) && $error != 1){
if(mkdir("images/school", 0777) && $error != 1){
echo "Intézményi fotó könyvtár létrehozva<br>";
}else{
$error = 1;

Loading…
Cancel
Save