<?php
use APP\Helpers\IP as IP;
use APP\Helpers\URL_Helper as URL;
use APP\Core\Session as Session;
?>
<div class="outer-w3-agile mt-3 col-md-12">
<h4 class="tittle-w3-agileits mb-4">Filter Data : <?= $data['filter_name'] ?></h4>
<div class="row">
<div class="col-md-4 col-lg-4">
<form class="form-inline" method="post" action="<?= URL::baseURL('admin/users/search/') ?>">
<div class="form-row">
<div class="form-group col-md-6">
<input class="form-control-sm mr-sm-2" type="search" name="query" placeholder="Search" aria-label="Search" required="">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<button class="btn btn-info btn-sm" type="submit">Search</button>
</div>
</div>
</form>
</div>
<div class="col-md-4 col-lg-4">
<form class="form-inline" method='post' action='<?= URL::baseURL('admin/usersFilter') ?>'>
<div class="form-row">
<div class="form-group col-md-6">
<select class="form-control-sm" name="filter">
<option value="1" <?php if($_POST['filter'] == 1){echo "selected";} ?>>I.D Ascending</option>
<option value="2" <?php if($_POST['filter'] == 2){echo "selected";} ?>>I.D Descending</option>
<option value="3" <?php if($_POST['filter'] == 3){echo "selected";} ?>>Email Ascending</option>
<option value="4" <?php if($_POST['filter'] == 4){echo "selected";} ?>>Email Descending</option>
<option value="5" <?php if($_POST['filter'] == 5){echo "selected";} ?>>Username Ascending</option>
<option value="6" <?php if($_POST['filter'] == 6){echo "selected";} ?>>Username Descending</option>
<option value="7" <?php if($_POST['filter'] == 7){echo "selected";} ?>>Active User</option>
<option value="8" <?php if($_POST['filter'] == 8){echo "selected";} ?>>In-Active User</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<button class="btn btn-info btn-sm" type="submit">Apply</button>
</div>
</div>
</form>
</div>
<div class="col-md-4 col-lg-4">
<button class="btn btn-success btn-sm" type="button">Export C.S.V</button>
<button class="btn btn-primary btn-sm" type="button">Export Excel</button>
</div>
</div>
<div class="clearfix">
<br />
</div>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Username</th>
<th scope="col">E-Mail</th>
<th scope="col">Avatar</th>
<th scope="col">Added On</th>
<th scope="col">I.P</th>
<th scope="col">Account Secret</th>
<th scope="col">Bio</th>
<th scope="col">Status</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<?php if (count($data['all_user_data']) > 0): ?>
<?php $counter = 1; ?>
<?php foreach ($data['all_user_data'] as $usrData): ?>
<tr>
<th scope="row"><?= $counter ?> (<?= $usrData->id ?>)</th>
<td><?= $usrData->username ?></td>
<td><?= $usrData->email ?></td>
<td><img class="img-thumbnail img-fluid" src="<?= $usrData->avatar ?>" alt="user_avatar" width="100dp" height="100dp" /></td>
<td><?= $usrData->added_on; ?>(<?= timeElapsedString($usrData->added_on) ?>)</td>
<!-- IP Lookup Modal -->
<div class="modal fade" id="IP_lookup_<?= $usrData->id ?>" tabindex="-1" role="dialog" aria-labelledby="ipLookupLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="ipLookupLabel">I.P Lookup</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p class="paragraph-agileits-w3layouts">
<?php $data['ip_data'] = IP::lookup($usrData->IP); ?>
<b>City : </b><?= $data['ip_data']->city ?>
<br />
<b>Continent : </b><?= $data['ip_data']->continent ?>
<br />
<b>Country : </b><?= $data['ip_data']->country ?>
<br />
<b>Country Code : </b><?= $data['ip_data']->countryCode ?>
<br />
<b>IP Name : </b><?= $data['ip_data']->ipName ?>
<br />
<b>IP Type : </b><?= $data['ip_data']->ipType ?>
<br />
<b>ISP : </b><?= $data['ip_data']->isp ?>
<br />
<b>Location : </b><?= $data['ip_data']->lat ?>,<?= $data['ip_data']->lon ?>
<div id="map">
<iframe src="https://www.google.com/maps/embed/v1/place?key=AIzaSyA2sAgPDTazz55bt5gc-bhSW60QiygAXRc&q=<?= $data['ip_data']->lat ?>%2C<?= $data['ip_data']->lon ?>&zoom=12" width="100%" height="400" frameborder="0" style="border:1px solid silver;" allowfullscreen=""></iframe>
</div>
<br />
<b>Organization : </b><?= $data['ip_data']->org ?>
<br />
<b>Query : </b><?= $data['ip_data']->query ?>
<br />
<b>Region : </b><?= $data['ip_data']->region ?>
</p>
</div>
</div>
</div>
</div>
<!-- //IP Lookup Modal -->
<td>
<?= $usrData->IP; ?>
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#IP_lookup_<?= $usrData->id ?>">Lookup?</button>
</td>
<td><?= $usrData->acc_key ?></td>
<!-- Read Bio Modal -->
<div class="modal fade" id="read_bio_<?= $usrData->id ?>" tabindex="-1" role="dialog" aria-labelledby="readBio" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="readBio">Read <?= $usrData->username ?> Bio.</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p class="paragraph-agileits-w3layouts"><?= $usrData->bio ?>
</p>
</div>
</div>
</div>
</div>
<!-- //Read Bio Modal -->
<td>
<button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#read_bio_<?= $usrData->id ?>">Read Bio</button>
</td>
<td>
<?php if ($usrData->status == 1): ?>
<span style="color:green"><b>Active</b></span>
<?php else: ?>
<span style="color:red"><b>In-Active</b></span>
<?php endif; ?>
</td>
<!-- Edit User Modal -->
<div class="modal fade" id="edit_user_<?= $usrData->id ?>" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit : <?= $usrData->username ?> Bio.</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Username</label>
<div class="col-sm-10">
<input type="text" name="username_<?= $usrData->id ?>" value="<?= $usrData->username ?>" class="form-control" placeholder="Username" required="">
</div>
<div class="admin_user_check"></div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="email" name="email_<?= $usrData->id ?>" value="<?= $usrData->email ?>" class="form-control" placeholder="Email" required="">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" name="password_<?= $usrData->id ?>" value="<?= decrypt($usrData->password) ?>" class="form-control" value="" placeholder="Password" required="">
</div>
</div>
<input type="hidden" name="id" value="<?= $usrData->id ?>" />
<div class="form-group row">
<div class="col-sm-10">
<button type="button" onclick="editUser(<?= $usrData->id ?>)" class="btn btn-primary">Edit <?= $usrData->username ?></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- //Edit User Modal -->
<td>
<?php if ($usrData->status == 1 && $usrData->id != Session::get('U_ID')): ?>
<button type="button" class="btn btn-primary btn-sm" onclick="markUserInactive(<?= $usrData->id ?>)">Mark In-Active</button>
<?php else: ?>
<?php if ($usrData->id != Session::get('U_ID')): ?>
<button type="button" class="btn btn-secondary btn-sm" onclick="markUserActive(<?= $usrData->id ?>)">Mark Active</button>
<?php endif; ?>
<?php endif; ?>
<?php if ($usrData->id != Session::get('U_ID')): ?>
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#edit_user_<?= $usrData->id ?>">Edit</button>
<?php else: ?>
<a href="<?= URL::baseURL('admin/users/editprofile') ?>" class="btn btn-success btn-sm">Edit Profile</a>
<?php endif; ?>
<?php if ($usrData->id != Session::get('U_ID')): ?>
<button type="button" class="btn btn-danger btn-sm" onclick="deleteUser(<?= $usrData->id ?>)">Delete</button>
<?php endif; ?>
</td>
</tr>
<?php $counter++; ?>
<?php endforeach; ?>
<?php else: ?>
<tr>
<th scope="row">1</th>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
|