Add pedoman content and editor assets
This commit is contained in:
200
pedoman/adminmenu.php
Normal file
200
pedoman/adminmenu.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
// include('koneksi.php');
|
||||
include('authsession.php');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Pedoman Akademik Informatika</title>
|
||||
|
||||
<!-- Bootstrap CSS CDN -->
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<!-- Our Custom CSS -->
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="css/adminmenu.css">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<nav id="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h3 id="sidebar-title">Pedoman Akademik Informatika</h3>
|
||||
</div>
|
||||
<ul class="list-unstyled components" id="isimenu">
|
||||
|
||||
<li>
|
||||
<a href="admin.php">
|
||||
<i class="glyphicon glyphicon-th"></i>
|
||||
Edit Isi
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="index.php">
|
||||
<i class="glyphicon glyphicon-th"></i>
|
||||
Ebook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div id="content">
|
||||
<button type="button" id="sidebarCollapse" class="navbar-btn">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</button>
|
||||
<?php
|
||||
include('notif.php');
|
||||
if(isset($_GET['notif'])){
|
||||
if($_GET['tipe']=="konfirm"){
|
||||
notif($_GET['tipe'],$_GET['pesan'],$_GET['tujuan'],$_GET['asal']);
|
||||
}else{
|
||||
notif($_GET['tipe'],$_GET['pesan']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
$sql="SELECT * FROM menu";
|
||||
$query=mysqli_query($koneksi, $sql);
|
||||
|
||||
echo "<table border='1px'>
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td>Nama</td>
|
||||
<td>ID Parent</td>
|
||||
<td>Urutan</td>
|
||||
<td>Tipe</td>
|
||||
</tr>";
|
||||
while($data=mysqli_fetch_array($query)){
|
||||
echo "
|
||||
<tr>
|
||||
<td>".$data['id']."</td>
|
||||
<td>
|
||||
<input type='text' value='".$data['namamenu']."' id='namamenuinput".$data['id']."' class='namamenuinput'/>
|
||||
<button onclick='gantinama(".$data['id'].")'>Ganti</button>
|
||||
</td>
|
||||
<td>
|
||||
<input type='number' min='0' value='".$data['parentid']."' id='parentidinput".$data['id']."'/>
|
||||
<button onclick='gantiparentid(".$data['id'].")'>Ganti</button>
|
||||
</td>
|
||||
<td>
|
||||
<input type='number' min='0' value='".$data['urutan']."'/>
|
||||
<button onclick='gantiurutan(".$data['id'].")'>Ganti</button>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<select id='tipe".$data['id']."'>";
|
||||
|
||||
if($data['tipe']=='pdf'){
|
||||
echo " <option value='text'>Text</option>
|
||||
<option value='pdf' selected>PDF</option>
|
||||
<option value='profile' >Profile</option>";
|
||||
} else if($data['tipe']=='profile') {
|
||||
echo " <option value='text'>Text</option>
|
||||
<option value='pdf'>PDF</option>
|
||||
<option value='profile' selected>Profile</option>";
|
||||
|
||||
} else {
|
||||
echo " <option value='text' selected>Text</option>
|
||||
<option value='pdf'>PDF</option>
|
||||
<option value='profile'>Profile</option>";
|
||||
|
||||
}
|
||||
|
||||
echo " </select>
|
||||
<button onclick='gantitipe(".$data['id'].")'>Ganti</button>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
}
|
||||
echo "</table>";
|
||||
?>
|
||||
|
||||
<div id="menubaru">
|
||||
<form action ="tambahmenu.php" method="POST" >
|
||||
<label for="namamenu">Nama Menu :</label>
|
||||
<input type="text" id="namamenu" name="namamenu" placeholder="Nama menu" required/>
|
||||
<label for="parentid">Parent ID : </label>
|
||||
<input type="number" name="parentid" min=0 id="parentid" value="0" required/>
|
||||
<input type="submit" name="submit" value="+ Tambah menu" >
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- jQuery CDN -->
|
||||
<script src="js/jquery-1.12.0.min.js"></script>
|
||||
<!-- Bootstrap Js CDN -->
|
||||
<script src="js/bootstrap.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#sidebarCollapse').on('click', function () {
|
||||
$('#sidebar').toggleClass('active');
|
||||
$(this).toggleClass('active');
|
||||
});
|
||||
});
|
||||
|
||||
function gantinama(id){
|
||||
let namamenu = document.getElementById(`namamenuinput${id}`).value
|
||||
// console.log(id," : ",namamenu)
|
||||
kirim(`editmenu.php`,{
|
||||
id,
|
||||
edit:'namamenu',
|
||||
data:namamenu
|
||||
})
|
||||
}
|
||||
|
||||
function gantiparentid(id){
|
||||
let parentid = document.getElementById(`parentidinput${id}`).value
|
||||
// console.log(id," : ",parentid)
|
||||
kirim(`editmenu.php`,{
|
||||
id,
|
||||
edit:'parentid',
|
||||
data:parentid
|
||||
})
|
||||
}
|
||||
|
||||
function gantitipe(id){
|
||||
let tipe = document.getElementById(`tipe${id}`).value
|
||||
// console.log(id + " : " + tipe)
|
||||
kirim(`editmenu.php`,{
|
||||
id,
|
||||
edit:'tipe',
|
||||
data:tipe
|
||||
})
|
||||
}
|
||||
|
||||
function kirim(url,payload){
|
||||
|
||||
var form = document.createElement('form');
|
||||
form.style.visibility = 'hidden';
|
||||
form.method = 'POST';
|
||||
form.action = url;
|
||||
$.each(Object.keys(payload), function(index, key) {
|
||||
var input = document.createElement('input');
|
||||
input.name = key;
|
||||
input.value = payload[key];
|
||||
form.appendChild(input)
|
||||
});
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user