hajime/public/dropdowntest.php

154 lines
4.3 KiB
PHP
Raw Permalink Normal View History

2023-08-11 22:16:32 +00:00
<?php
// Require core components
require_once __DIR__ . '/../startup.php';
if(isset($_GET['gid']) && $flashii->getRankdata($_GET['gid']) && $_GET['gid'] != 0) {
$rank = $flashii->getRankdata($_GET['gid'])['gid'];
$name = $flashii->getRankdata($rank)['mname'];
$desc = $flashii->getRankdata($rank)['descr'];
$colour = $flashii->getRankdata($rank)['colour'];
} else {
$rank = null;
$name = 'All members';
$desc = 'The entire list of members of Flashii.';
$colour = null;
}
switch(@$_GET['view']) {
case 2:
$view = 2;
break;
case 1:
$view = 1;
break;
default:
$view = 0;
}
// Print header
print desHeader('Dropdown box testing', null, true);
if($flashii->loggedIn()) {
// Get data from URL and Database
$userQuery = $database->query("SELECT * FROM `flashii_users` ".($rank ? "WHERE `userrole` = '".$rank."'" : "WHERE `userrole` != '0'"));
$userArray = $userQuery->fetch_all(MYSQLI_ASSOC);
$groupQuery = $database->query("SELECT * FROM `flashii_groups` WHERE `gid` != '0'");
$groupArray = $groupQuery->fetch_all(MYSQLI_ASSOC);
print '<div class="membersPage">';
print '<h1 style="text-shadow: 0px 0px 5px #555; color: #'.$colour.';">'.$name.'</h1>';
print '<h3 style="padding: 0px 0px 10px;">'. $desc .'</h3>';
print '<div class="dropDown" style="margin: 0px auto; font-size: 1.5em; line-height: 1.5em; height: 30px;">';
print '<div class="dropDownInner" style="float: left; border-color: #'.$colour.';">';
print '<a class="dropDownDesc">Group:</a>';
//print '<a href="/members/"';
print '<a href="dropdowntest.php?view='. $view .'"';
print $rank == 0 ? ' class="dropDownSelected"' : null;
print '>';
print '<div id="am">';
print 'All members';
print '</div>';
print '</a>';
foreach($groupArray as $groupData) {
//print '<a href="/members/';
print '<a href="dropdowntest.php?gid=';
print $groupData['gid'];
print '&view='. $view .'"';
print $groupData['gid'] == $rank ? ' class="dropDownSelected"' : null;
print '>';
print '<div id="g';
print $groupData['gid'];
print '"';
print empty($groupData['colour']) ? null : ' style="color: #'. $groupData['colour'] .'"';
print '>';
print $groupData['mname'];
print '</div>';
print '</a>';
}
print '</div>';
print '<div class="dropDownInner" style="float: left;">';
print '<a class="dropDownDesc">View:</a>';
print '<a href="dropdowntest.php';
print ($rank != 0 ? '?gid='. $rank .'&' : '?');
print 'view=0"';
print $view == 0 ? ' class="dropDownSelected"' : '';
print '>';
print '<div id="squares">';
print 'Squares';
print '</div>';
print '</a>';
print '<a href="dropdowntest.php';
print ($rank != 0 ? '?gid='. $rank .'&' : '?');
print 'view=1"';
print $view == 1 ? ' class="dropDownSelected"' : '';
print '>';
print '<div id="boxes">';
print 'Boxes';
print '</div>';
print '</a>';
print '<a href="dropdowntest.php';
print ($rank != 0 ? '?gid='. $rank .'&' : '?');
print 'view=2"';
print $view == 2 ? ' class="dropDownSelected"' : '';
print '>';
print '<div id="list">';
print 'List';
print '</div>';
print '</a>';
print '</div>';
print '</div>';
print '<br />';
print '<div class="membersPageList view'. $view .'">';
foreach($userArray as $userData) {
$avatar = '/a/' . $userData['id'];
print '<a href="/u/';
print $userData['id'];
print '">';
print '<div class="userBox" id="u';
print $userData['id'];
print '">';
print '<img src="/assets/pixel.png" alt="';
print $userData['username'];
print '" style="background: url(\'';
print $avatar;
print '\') no-repeat center / contain;';
print '" />';
print '<span class="userBoxUserName">';
print $userData['username'];
print '</span>';
print '</div>';
print '</a>';
}
print '</div>';
print '</div>';
} else {
?>
<div class="content standalone" style="padding: 20px;">
<h1>Login to view this page!</h1>
If you actually are logged in something went wrong and you should report this to <a href="/u/2" target="_blank" class="default">Flashwave</a>.<br />
If you aren't logged in please log in or create an account if you don't have one.
</div>
<?php
}
// Print footer
print desFooter();