Browse Source

Adding more administrative stuff

tags/v1.3^2
Teknikode 6 years ago
parent
commit
3e9136f6dc
3 changed files with 117 additions and 48 deletions
  1. 0
    0
      admin/New Text Document.txt
  2. 70
    48
      admin/main.php
  3. 47
    0
      templates/default/js/admin.js

+ 0
- 0
admin/New Text Document.txt View File


+ 70
- 48
admin/main.php View File

@@ -1,60 +1,82 @@
<div class="container">
<div class="row">
<div class="col-sm-12">
<?php
if ($user->group == "Founder" || $user->group == "Admin" || $user->group == "Moderator")
{
$support_msgs = $db->select('support', "1=? ORDER BY date_added DESC", array("1"));
$support_msg_list = array();
foreach ($support_msgs as $support_msg)
{
if (!is_array($support_msg))
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#support" role="tab" data-toggle="tab">Support</a></li>
<li><a href="#management" role="tab" data-toggle="tab">User Management</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="support">
<?php
if ($user->group == "Founder" || $user->group == "Admin" || $user->group == "Moderator")
{
$support_msg_list = array($support_msgs);
break;
$support_msgs = $db->select('support', "1=? ORDER BY date_added DESC", array("1"));
$support_msg_list = array();
foreach ($support_msgs as $support_msg)
{
if (!is_array($support_msg))
{
$support_msg_list = array($support_msgs);
break;
}
array_push($support_msg_list, $support_msg);
}
?>
<h2 class="text-center"><strong>Support Messages</strong></h2>
<hr>
<div class="row">
<div class="col-sm-2">
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Sender</strong></h4>
</div>
<div class="col-sm-3">
<h4><strong>Subject</strong></h4>
</div>
<div class="col-sm-5">
<h4><strong>Message</strong></h4>
</div>
</div>
<?php
foreach ($support_msgs as $msg)
{
?>
<div class="row">
<div class="col-sm-2">
<p><?php echo $msg['date_added']; ?></p>
</div>
<div class="col-sm-2">
<p><a href="mailto:<?php echo $msg['email']; ?>"><?php echo $msg['name']; ?></a></p>
</div>
<div class="col-sm-3">
<p><?php echo $msg['subject']; ?></p>
</div>
<div class="col-sm-5">
<p><?php echo $msg['message']; ?></p>
</div>
</div>
<?php
}
}
array_push($support_msg_list, $support_msg);
}
?>
<h2 class="text-center"><strong>Support Messages</strong></h2>
<hr>
<div class="row">
<div class="col-sm-2">
<h4><strong>Date</strong></h4>
</div>
<div class="col-sm-2">
<h4><strong>Sender</strong></h4>
</div>
<div class="col-sm-3">
<h4><strong>Subject</strong></h4>
</div>
<div class="col-sm-5">
<h4><strong>Message</strong></h4>
</div>
?>
</div>
<?php
foreach ($support_msgs as $msg)
{
?>
<div class="tab-pane" id="management">
<div class="row">
<div class="col-sm-2">
<p><?php echo $msg['date_added']; ?></p>
</div>
<div class="col-sm-2">
<p><a href="mailto:<?php echo $msg['email']; ?>"><?php echo $msg['name']; ?></a></p>
</div>
<div class="col-sm-3">
<p><?php echo $msg['subject']; ?></p>
</div>
<div class="col-sm-5">
<p><?php echo $msg['message']; ?></p>
<div class="col-sm-12">
<div class="form-group">
<label for="userSearch" class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="userSearch" placeholder="Username" maxlength="40" onkeyup="update_user_list(this.value);" />
</div>
</div>
</div>
</div>
<?php
}
}
?>
<div class="user_list"></div>
</div>
</div>
</div>
</div>
</div>

+ 47
- 0
templates/default/js/admin.js View File

@@ -0,0 +1,47 @@
function update_user_list(search)
{
blog_id=encodeURIComponent($(".blog-main").attr("id"));
$.ajax({
type: "POST",
url: "../../../get_user.php",
data: "query="+search,
success: function(html)
{
if(html)
{
$(".user_list").append(obj.result);
linkUserUpdate('.user_update');
}
}
});
}

function linkUserUpdate(selector)
{
$(selector).click(function() {
var object = $(this);
post_id=encodeURIComponent(object.attr("id"));
bootbox.confirm("Are you sure you want to delete your post?", function(result) {
if (result)
{
$.ajax({
type: "POST",
url: "../../../delete_blog.php",
data: "id="+post_id,
success: function(html)
{
if(html=='true')
{
window.location.reload();
}
else
{
$("#top_msg").css('display', 'inline', 'important');
$("#top_msg").html('<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+html+'</div>');
}
}
});
}
});
});
}

Loading…
Cancel
Save