Add SPOTA core PHP application
Add the main admin, dosen, mahasiswa, API, and service code needed to run the core legacy application with configurable upload storage.
This commit is contained in:
66
admin/page/pengumuman/act.pengumuman.php
Normal file
66
admin/page/pengumuman/act.pengumuman.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
session_start();
|
||||
if($_SESSION['login-admin']){
|
||||
if($_POST){
|
||||
include ("../../../inc/helper.php");
|
||||
include ("../../../inc/konfigurasi.php");
|
||||
include ("../../../inc/db.pdo.class.php");
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
|
||||
switch($_POST['act']){
|
||||
case 'insert':
|
||||
$publish='Y';
|
||||
if($_POST['draft']=='yes'){
|
||||
$publish='N';
|
||||
}
|
||||
$in=$db->runQuery("INSERT INTO tbpengumuman SET idProdi='{$_SESSION['login-admin']['prodi']}',judul='{$_POST['judul']}',isi='{$_POST['isi_pengumuman']}', tujuan='{$_POST['tujuan']}', tgl='".NOW."', author='{$_SESSION['login-admin']['id']}',publish='".$publish."' ");
|
||||
if($in){
|
||||
echo json_encode(array("result"=>true,"msg"=>"Pengumuman Berhasil Ditambahkan."));
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Aksi Gagal"));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$idpengumuman=$_POST['pengumuman'];
|
||||
if(ctype_digit($idpengumuman)){
|
||||
$sql="UPDATE tbpengumuman SET judul='{$_POST['judul']}',isi='{$_POST['isi_pengumuman']}', tujuan='{$_POST['tujuan']}', publish='".$publish."' WHERE id='$idpengumuman'";
|
||||
if($db->runQuery($sql)){
|
||||
echo json_encode(array("result"=>true,"msg"=>"Pengumuman Berhasil Update."));
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Aksi Gagal"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Invalid ID"));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'hapuspengumuman':
|
||||
$idpengumuman=$_POST['pengumuman'];
|
||||
if(ctype_digit($idpengumuman)){
|
||||
if($db->runQuery("DELETE FROM tbpengumuman WHERE id='$idpengumuman'")){
|
||||
echo json_encode(array("result"=>true,"msg"=>"Pengumuman Berhasil Dihapus."));
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Aksi Gagal"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Invalid ID"));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'publish':
|
||||
if(ctype_digit($_POST['idpengumuman'])){
|
||||
if($db->runQuery("UPDATE tbpengumuman SET publish='Y' WHERE id='{$_POST['idpengumuman']}'")){
|
||||
echo json_encode(array("result"=>true,"msg"=>"Pengumuman Berhasil Diterbitkan."));
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Aksi Gagal"));
|
||||
}
|
||||
}else{
|
||||
echo json_encode(array("result"=>false,"msg"=>"Invalid ID"));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
67
admin/page/pengumuman/buat-pengumuman.php
Normal file
67
admin/page/pengumuman/buat-pengumuman.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php $db=new dB($dbsetting); ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="clip-home-3"></i>
|
||||
<a href="<?php ECHO ADMIN_PAGE;?>">
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php ECHO ADMIN_PAGE;?>dashboard.php?page=pengumuman&menu=daftar-pengumuman">
|
||||
Daftar Pengumuman
|
||||
</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
Buat Pengumuman Baru
|
||||
</li>
|
||||
<li class="search-box">
|
||||
<label><?php echo tanggalIndo(date('Y-m-d H:i:s'),'j F Y, H:i');?></label>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="page-header">
|
||||
<h1>Buat Pengumuman Baru<!-- <small>overview & stats </small> --></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="tulis_pengumuman" method="POST" action="page/pengumuman/act.pengumuman.php">
|
||||
<input type="hidden" name="act" value="insert" />
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"></div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<input type="text" name="judul" placeholder="JUDUL PENGUMUMAN" class="required form-control" Title="Silakan masukkan judul pengumuman."/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea name="isi_pengumuman" id="isi_pengumuman" class="ckeditor form-control"></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-5">
|
||||
<label for="file-pengumuman">
|
||||
Tujuan
|
||||
</label>
|
||||
<select class="form-control required" id="tujuan" name="tujuan" id="tujuan" title="Silakan Pilih Tujuan Pengumuan">
|
||||
<option value="">- Pilih -</option>
|
||||
<option value="A">Semua</option>
|
||||
<option value="D">Dosen</option>
|
||||
<option value="M">Mahasiswa</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="draft" value="yes" class="grey">
|
||||
Simpan Sebagai <em>draft</em>
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary" id="btnTerbitkan"><i class="clip-earth-2"></i> Terbitkan</button>
|
||||
<span id="loading" style="display:none"><i class="clip-spin-alt icon-spin"></i><em> Loading..</em></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
44
admin/page/pengumuman/daftar-pengumuman.php
Normal file
44
admin/page/pengumuman/daftar-pengumuman.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php $db=new dB($dbsetting); ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="clip-home-3"></i>
|
||||
<a href="<?php ECHO ADMIN_PAGE;?>">
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
Daftar Pengumuman
|
||||
</li>
|
||||
<li class="search-box">
|
||||
<label><?php echo tanggalIndo(date('Y-m-d H:i:s'),'j F Y, H:i');?></label>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="page-header">
|
||||
<h1>Daftar Pengumuman<!-- <small>overview & stats </small> --></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<!-- start: DYNAMIC TABLE PANEL -->
|
||||
<table class="table table-striped table-bordered table-hover table-full-width" id="list-pengumuman">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:50%;text-align:center">Pengumuman</th>
|
||||
<th style="width:20%;text-align:center">Kepada</th>
|
||||
<th style="width:20%;text-align:center">Tanggal</th>
|
||||
<th style="width:10%;text-align:center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="4" class="dataTables_empty">Loading data from server</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- end: DYNAMIC TABLE PANEL -->
|
||||
</div>
|
||||
</div>
|
||||
84
admin/page/pengumuman/edit-pengumuman.php
Normal file
84
admin/page/pengumuman/edit-pengumuman.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php $db=new dB($dbsetting); ?>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<i class="clip-home-3"></i>
|
||||
<a href="<?php ECHO ADMIN_PAGE;?>">
|
||||
Home
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php ECHO ADMIN_PAGE;?>dashboard.php?page=pengumuman&menu=daftar-pengumuman">
|
||||
Daftar Pengumuman
|
||||
</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
Edit Pengumuman
|
||||
</li>
|
||||
<li class="search-box">
|
||||
<label><?php echo tanggalIndo(date('Y-m-d H:i:s'),'j F Y, H:i');?></label>
|
||||
</li>
|
||||
</ol>
|
||||
<div class="page-header">
|
||||
<h1>Edit Pengumuman</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$idpengumuman=$_GET['pengumuman'];
|
||||
if(ctype_digit($idpengumuman)){
|
||||
$query="SELECT * FROM tbpengumuman WHERE id = '$idpengumuman' LIMIT 1";
|
||||
$db->runQuery($query);
|
||||
if($db->dbRows()>0){
|
||||
$b=$db->dbFetch();
|
||||
?>
|
||||
<form id="tulis_pengumuman" method="POST" action="page/pengumuman/act.pengumuman.php">
|
||||
<input type="hidden" name="act" value="update" />
|
||||
<input type="hidden" name="pengumuman" value="<?php echo $b['id']; ?>" />
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"></div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<input type="text" name="judul" placeholder="Judul Pengimiman" class="required form-control" title="Silakan masukkan judul pengumuman" value="<?php echo $b['judul'];?>"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea name="isi_pengumuman" id="isi_pengumuman" class="ckeditor form-control"><?php echo $b['isi'];?></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-5">
|
||||
<label for="file-pengumuman">
|
||||
Tujuan
|
||||
</label>
|
||||
<select class="form-control" id="tujuan" name="tujuan" id="tujuan">
|
||||
<option value="">- Pilih -</option>
|
||||
<option <?php echo ($b['tujuan']=='A')?"selected":"";?> value="A">Semua</option>
|
||||
<option <?php echo ($b['tujuan']=='D')?"selected":"";?> value="D">Dosen</option>
|
||||
<option <?php echo ($b['tujuan']=='M')?"selected":"";?> value="M">Mahasiswa</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="draft" <?php echo($b['publish']=="N")?"checked":"";?> value="yes" class="grey">
|
||||
Simpan Sebagai <em>draft</em>
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary" id="btnTerbitkan">Update Pengumuman</button>
|
||||
<span id="loading" style="display:none"><i class="clip-spin-alt icon-spin"></i><em> Loading..</em></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}else{
|
||||
|
||||
}
|
||||
}else{
|
||||
|
||||
}
|
||||
?>
|
||||
191
admin/page/pengumuman/list.daftar-pengumuman.php
Normal file
191
admin/page/pengumuman/list.daftar-pengumuman.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
session_start();
|
||||
$idprodi=$_SESSION['login-admin']['prodi'];
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Easy set variables
|
||||
*/
|
||||
|
||||
/* Array of database columns which should be read and sent back to DataTables. Use a space where
|
||||
* you want to insert a non-database field (for example a counter or static image)
|
||||
*/
|
||||
$aColumns = array('tp.judul');
|
||||
|
||||
/* Indexed column (used for fast and accurate table cardinality) */
|
||||
$sIndexColumn = "tp.id";
|
||||
|
||||
/* DB table to use */
|
||||
$sTable = "tbpengumuman tp";
|
||||
|
||||
/* Database connection information */
|
||||
include ("../../../inc/helper.php");
|
||||
include ("../../../inc/konfigurasi.php");
|
||||
include ("../../../inc/db.pdo.class.php");
|
||||
|
||||
$db=new dB($dbsetting);
|
||||
|
||||
/*
|
||||
* Paging
|
||||
*/
|
||||
$sLimit = "";
|
||||
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
|
||||
{
|
||||
$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
|
||||
intval( $_GET['iDisplayLength'] );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ordering
|
||||
*/
|
||||
$sOrder = "ORDER BY tp.tgl DESC, tp.judul ASC";
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
*/
|
||||
$sWhere = "";
|
||||
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
|
||||
{
|
||||
$sWhere = "WHERE (";
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" )
|
||||
{
|
||||
$sWhere .= "".$aColumns[$i]." LIKE '%".$_GET['sSearch']."%' OR ";
|
||||
}
|
||||
}
|
||||
$sWhere = substr_replace( $sWhere, "", -3 );
|
||||
$sWhere .= ')';
|
||||
}
|
||||
|
||||
/* Individual column filtering */
|
||||
for ( $i=0 ; $i<count($aColumns) ; $i++ )
|
||||
{
|
||||
if ( isset($_GET['bSearchable_'.$i]) && $_GET['bSearchable_'.$i] == "true" && $_GET['sSearch_'.$i] != '' )
|
||||
{
|
||||
if ( $sWhere == "" )
|
||||
{
|
||||
$sWhere = "WHERE ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sWhere .= " AND ";
|
||||
}
|
||||
$sWhere .= "".$aColumns[$i]." LIKE '%".$_GET['sSearch_'.$i]."%' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$where2="";
|
||||
if($sWhere!=''){
|
||||
$where2="AND tp.idProdi='$idprodi'";
|
||||
}else{
|
||||
$where2="WHERE tp.idProdi='$idprodi'";
|
||||
}
|
||||
/*
|
||||
* SQL queries
|
||||
* Get data to display
|
||||
*/
|
||||
$sQuery0 = "
|
||||
SELECT * FROM $sTable
|
||||
$sWhere
|
||||
$where2
|
||||
$sOrder
|
||||
";
|
||||
//echo $sQuery0;
|
||||
$db->runQuery($sQuery0);
|
||||
$iFilteredTotal = $db->dbRows();
|
||||
|
||||
$result=$db->runQuery($sQuery0.$sLimit);
|
||||
|
||||
/* Total data set length */
|
||||
$sQuery2 = "
|
||||
SELECT COUNT(tp.id) as total FROM $sTable $where2
|
||||
";
|
||||
$db->runQuery($sQuery2);
|
||||
$aResultTotal = $db->dbFetch();
|
||||
$iTotal = $aResultTotal['total'];
|
||||
|
||||
/*$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or fatal_error( 'MySQL Error: ' . mysql_errno() );
|
||||
$aResultTotal = mysql_fetch_array($rResultTotal);
|
||||
$iTotal = $aResultTotal[0];*/
|
||||
|
||||
|
||||
/*
|
||||
* Output
|
||||
*/
|
||||
|
||||
$output = array(
|
||||
"sEcho" => intval($_GET['sEcho']),
|
||||
"iTotalRecords" => $iTotal,
|
||||
"iTotalDisplayRecords" => $iFilteredTotal,
|
||||
"aaData" => array()
|
||||
);
|
||||
|
||||
while ( $aRow = $db->dbFetch($result) )
|
||||
{
|
||||
//print_r($aRow);
|
||||
$row = array();
|
||||
$tujuan="";
|
||||
if($aRow['publish']=="N"){
|
||||
$publish=" <code> -draft </code>";
|
||||
$terbit='<li role="presentation">
|
||||
<a role="menuitem" tabindex="-1" href="#" onClick="PublishPengumuman('.$aRow['id'].')">
|
||||
<i class="clip-earth-2"></i> Terbitkan
|
||||
</a>
|
||||
</li>';
|
||||
$tombol="btn-warning";
|
||||
}else{
|
||||
|
||||
if($aRow['slide']=='Y'){
|
||||
$publish=' - <span class="label label-success"> Slider </span>';
|
||||
}else{
|
||||
$publish="";
|
||||
}
|
||||
|
||||
$terbit="";
|
||||
$tombol="btn-primary";
|
||||
}
|
||||
switch($aRow['tujuan']){
|
||||
case 'A':
|
||||
$tujuan="Semua";
|
||||
break;
|
||||
case 'D':
|
||||
$tujuan="Dosen";
|
||||
break;
|
||||
case 'M':
|
||||
$tujuan="Mahasiswa";
|
||||
break;
|
||||
}
|
||||
|
||||
$row[0]=$aRow['judul'].$publish;
|
||||
$row[1]=$tujuan;
|
||||
$row[2]=tanggalIndo($aRow['tgl'],'j F Y, H:i');
|
||||
$tombolaksi='<div class="btn-group">
|
||||
<a class="btn '.$tombol.' dropdown-toggle btn-sm" data-toggle="dropdown" href="#">
|
||||
<i class="icon-cog"></i> <span class="caret"></span>
|
||||
</a>
|
||||
<ul role="menu" class="dropdown-menu pull-right">
|
||||
'.$terbit.'
|
||||
<li role="presentation">
|
||||
<a role="menuitem" tabindex="-1" href="#" onClick="EditPengumuman('.$aRow['id'].')">
|
||||
<i class="icon-edit"></i> Edit
|
||||
</a>
|
||||
</li>
|
||||
<li role="presentation">
|
||||
<a role="menuitem" tabindex="-1" href="#" onClick="HapusPengumuman('.$aRow['id'].')">
|
||||
<i class="icon-remove"></i> Hapus
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>';
|
||||
|
||||
$row[3]=$tombolaksi;
|
||||
|
||||
$output['aaData'][] = $row;
|
||||
// print_r($row);
|
||||
|
||||
}
|
||||
|
||||
echo json_encode( $output );
|
||||
?>
|
||||
19
admin/page/pengumuman/pengumuman.php
Normal file
19
admin/page/pengumuman/pengumuman.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
switch ($_GET['menu']) {
|
||||
case 'daftar-pengumuman':
|
||||
include "daftar-pengumuman.php";
|
||||
break;
|
||||
|
||||
case 'buat-pengumuman':
|
||||
include "buat-pengumuman.php";
|
||||
break;
|
||||
|
||||
case 'edit-pengumuman':
|
||||
include "edit-pengumuman.php";
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "<script>location.href='".ADMIN_PAGE."dashboard.php?page=pengumuman&menu=daftar-pengumuman'</script>";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user