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:
Power BI Dev
2026-05-02 10:08:52 +07:00
parent 874dbbe8e8
commit efdb11db3f
221 changed files with 43273 additions and 0 deletions

View File

@@ -0,0 +1,146 @@
<?php
session_start();
$idprodi=$_SESSION['login-dosen']['prodi'];
$iddosen=$_SESSION['login-dosen']['id'];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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' AND tujuan IN ('A','D')";
}else{
$where2="WHERE tp.idProdi='$idprodi' AND tujuan IN ('A','D')";
}
/*
* SQL queries
* Get data to display
*/
$sQuery0 = "
SELECT *,
(SELECT count(id) FROM tmp_notif WHERE idkonten=tp.id AND iduser='".$iddosen."' AND idProdi='".$idprodi."') as new
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();
if($aRow['new']==0){
$badge=' - <span class="label label-warning"> Baru</span>';
}else{
$badge='';
}
$row[0]="<a href='?page=pengumuman&lihat=".$aRow['id']."'>".$aRow['judul']."</a>".$badge;
$row[1]=tanggalIndo($aRow['tgl'],'j F Y, H:i');
$output['aaData'][] = $row;
// print_r($row);
}
echo json_encode( $output );
?>

View File

@@ -0,0 +1,131 @@
<?php $db=new dB($dbsetting);
if(!isset($_GET['lihat'])){
?>
<div class="row">
<div class="col-sm-12">
<ol class="breadcrumb">
<li>
<i class="clip-home-3"></i>
<a href="<?php ECHO MHS_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 &amp; stats </small> --></h1>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<!-- start: DYNAMIC TABLE PANEL -->
<?php
//variabel untuk menampilkan jumlah notif ada di _header.php
if($db->dbRows($notif_pengumuman)>0){
if($jlh_notif_pengumuman>0){
?>
<div class="alert alert-warning">
<button data-dismiss="alert" class="close">
×
</button>
<i class="icon-exclamation-triangle"></i>
Terdapat <strong><?php echo $jlh_notif_pengumuman;?></strong> Pengumuman Terbaru.
</div>
<?php
}
}
?>
<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">Tanggal</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="dataTables_empty">Loading data from server</td>
</tr>
</tbody>
</table>
<!-- end: DYNAMIC TABLE PANEL -->
</div>
</div>
<?php
}else{
$idpengumuman=$_GET['lihat'];
?>
<div class="row">
<div class="col-sm-12">
<ol class="breadcrumb">
<li>
<i class="clip-home-3"></i>
<a href="<?php ECHO MHS_PAGE;?>">
Home
</a>
</li>
<li>
<a href="<?php ECHO MHS_PAGE;?>dashboard.php?page=pengumuman">
Daftar Pengumuman
</a>
</li>
<li class="active">
Lihat 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>Lihat Pengumuman<!-- <small>overview &amp; stats </small> --></h1>
</div>
</div>
</div>
<?php
if(ctype_digit($idpengumuman)){
$p="SELECT tp.*, (SELECT count(idkonten) FROM tmp_notif WHERE idkonten='$idpengumuman' AND iduser='".$_SESSION['login-dosen']['id']."' AND typeuser='D' AND jenis='P') as found FROM tbpengumuman tp WHERE tp.id='$idpengumuman' AND tp.idProdi='".$_SESSION['login-dosen']['prodi']."' AND tujuan IN ('A','D') LIMIT 1";
//echo $p;
$db->runQuery($p);
if($db->dbRows()>0){
$rp=$db->dbFetch();
if($rp['found']=='0'){
$in="INSERT INTO tmp_notif SET idkonten='".$idpengumuman."', idProdi='".$_SESSION['login-dosen']['prodi']."', iduser='".$_SESSION['login-dosen']['id']."', typeuser='D', `date`='".NOW."', jenis='P'";
$db->runQuery($in);
}
?>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<p class="lead">
<?php echo $rp['judul'];?>
</p>
<p>
<?php echo $rp['isi'];?>
</p>
<p>
<label class="label label-info">Diposting tanggal <?php echo tanggalIndo($rp['tgl'],'j F y, H:i');?> </label>
</p>
</div>
</div>
</div>
</div>
<a href="?page=pengumuman" class="btn btn-sm btn-info">
Kembali
</a>
<?php
}else{
echo "Not Found";
}
}else{
echo "Not Found";
}
}
?>