Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

penambahan komponen komunitas #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RewriteRule ^valbum/page/([^/]*)$ index.php?mod=valbum&page=$1 [L]
RewriteRule ^video/([^/]*)$ index.php?mod=video&idv=$1 [L]
RewriteRule ^video/([^/]*)/page/([^/]*)$ index.php?mod=video&idv=$1&page=$2 [L]
RewriteRule ^contact$ index.php?mod=contact [L]
RewriteRule ^komunitas$ index.php?mod=komunitas [L]
RewriteRule ^search-result/$ index.php?mod=searchresult [L]
RewriteRule ^search-result/([^/]*)$ index.php?mod=searchresult&search=$1 [L]
RewriteRule ^search-result/([^/]*)/([^/]*)$ index.php?mod=searchresult&search=$1&page=$2 [L]
Expand Down
51 changes: 51 additions & 0 deletions komunitas.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
session_start();
include_once 'po-library/po-database.php';
include_once 'po-library/po-function.php';
$val = new Povalidasi;
if ($_GET[id]=="data"){
$komunitas=mysql_query("select * from komunitas where status='1'");
while ($kom=mysql_fetch_assoc($komunitas)) {
$k[nama]=$kom[nama];
$k[lat]=(Float)$kom[lat];
$k[lng]=(Float)$kom[lng];
$k[alamat]=$kom[alamat];
$k[email]=$kom[email];
$k[facebook]=$kom[facebook];
$k[twitter]=$kom[twitter];
$row[]=$k;
}
echo json_encode($row);
}elseif ($_GET[id]=="add"){
if(empty($_POST['lat']) || empty($_POST['lng']) || empty($_POST['nama']) || empty($_POST['alamat']) || empty($_POST['email']) || empty($_POST['facebook'])){
echo"error:Mohon Lengkapi Data Anda";
}else{
$lat = $val->validasi($_POST['lat'],'xss');
$lng = $val->validasi($_POST['lng'],'xss');
$nama = $val->validasi($_POST['nama'],'xss');
$alamat = $val->validasi($_POST['alamat'],'xss');
$email = $val->validasi($_POST['email'],'xss');
$facebook = $val->validasi($_POST['facebook'],'xss');
$twitter = $val->validasi($_POST['twitter'],'xss');
$skill = $val->validasi($_POST['skill'],'xss');
$lat = $val->validasi($_POST['lat'],'xss');
$lng = $val->validasi($_POST['lng'],'xss');
$status = $val->validasi($_POST['status'],'xss');
$message = "sukses:Terima Kasih Atas Partisipasi Anda.<br> Kami akan segera memeriksa data yang anda kirim untuk di setujui.";
$table = new PoTable('komunitas');
$table->save(array(
'nama' => $nama,
'alamat' => $alamat,
'email' => $email,
'facebook' => $facebook,
'twitter' => $twitter,
'skill' => $skill,
'lat' => $lat,
'lng' => $lng,
'status' => $status
));
unset($_POST);
echo "$message";
}
}
?>
1 change: 1 addition & 0 deletions phpindonesia.or.id-profile
Submodule phpindonesia.or.id-profile added at 2e5a71
816 changes: 391 additions & 425 deletions phpindonesia.sql

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions po-adminboard/po-component/po-komunitas/datatable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?php
session_start();
if (empty($_SESSION['namauser']) AND empty($_SESSION['passuser'])){
header('location:404.php');
}else{
include_once '../../../po-library/po-database.php';
include_once '../../../po-library/po-function.php';

$aColumns= array( "id_komunitas", "nama", "alamat", "email", "facebook", "twitter", "skill", "lat", "lng", "status", );

$sIndexColumn = "id_komunitas";

$sTable = "komunitas";

$gaSql['user'] = DATABASE_USER;
$gaSql['password'] = DATABASE_PASS;
$gaSql['db'] = DATABASE_NAME;
$gaSql['server'] = DATABASE_HOST;

$gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
die( 'Could not open connection to server' );

mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
die( 'Could not select database '. $gaSql['db'] );

$sLimit = "";
if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
{
$sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
mysql_real_escape_string( $_GET['iDisplayLength'] );
}

$sOrder = "";
if ( isset( $_GET['iSortCol_0'] ) )
{
$sOrder = "ORDER BY ";
for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
{
if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
{
$sOrder .= $aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."
".mysql_real_escape_string( $_GET['sSortDir_'.$i] ) .", ";
}
}

$sOrder = substr_replace( $sOrder, "", -2 );
if ( $sOrder == "ORDER BY" )
{
$sOrder = "";
}
}

$sWhere = "";
if ( isset($_GET['sSearch']) && $_GET['sSearch'] != "" )
{
$sWhere = "WHERE (";
for ( $i=0 ; $i<count($aColumns) ; $i++ )
{
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
}
$sWhere = substr_replace( $sWhere, "", -3 );
$sWhere .= ')';
}

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 '%".mysql_real_escape_string($_GET['sSearch_'.$i])."%' ";
}
}

$sQuery = "
SELECT SQL_CALC_FOUND_ROWS ".str_replace(" , ", " ", implode(", ", $aColumns))."
FROM $sTable
$sWhere
$sOrder
$sLimit
";
$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());

$sQuery = "
SELECT FOUND_ROWS()
";
$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
$iFilteredTotal = $aResultFilterTotal[0];

$sQuery = "
SELECT COUNT(".$sIndexColumn.")
FROM $sTable
";
$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
$aResultTotal = mysql_fetch_array($rResultTotal);
$iTotal = $aResultTotal[0];

$output = array(
"sEcho" => intval($_GET['sEcho']),
"iTotalRecords" => $iTotal,
"iTotalDisplayRecords" => $iFilteredTotal,
"aaData" => array()
);

$no = 1;
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=1 ; $i<count($aColumns) ; $i++ )
{
$str = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$strlink = preg_replace("/\/po-adminboard\/po-component\/po-komunitas\/(datatable\.php$)/","",$str);
$tbldelete = "<a class='btn btn-xs btn-danger alertdel' id='$aRow[id_komunitas]'><i class='fa fa-times'></i></a>";
$tbl_setuju = "<a class='btn btn-xs btn-default setuju' id='$aRow[id_komunitas]'><i class='fa fa-check'></i></a>";
$checkdata = "<div class='text-center'><input type='checkbox' id='titleCheckdel' /><input type='hidden' class='deldata' name='item[$no][deldata]' value='$aRow[id_komunitas]' disabled></div>";
$row[] = $checkdata;
$row[] = $aRow['nama'];
$row[] = "Alamat : ".$aRow['alamat']."<br> Email : ".$aRow['email']."<br> Facebook : ".$aRow['facebook']."<br> Twitter : ".$aRow['twitter'];
$row[] = $aRow['skill'];
$row[] = $aRow['status'];
$row[] = "<div class='text-center'><div class='btn-group btn-group-xs'>
<a href='admin.php?mod=komunitas&act=edit&id=$aRow[id_komunitas]' class='btn btn-xs btn-default' id='$aRow[id_komunitas]'><i class='fa fa-pencil'></i></a>
$tbl_setuju
$tbldelete
</div></div>";
}
$output['aaData'][] = $row;
$no++;
}

echo json_encode( $output );
}
?>
73 changes: 73 additions & 0 deletions po-adminboard/po-component/po-komunitas/javascript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
oTable = $('.dTableAjax').dataTable({
"sAjaxSource": "po-component/po-komunitas/datatable.php",
"sDom": "<'row'<'col-sm-6 col-xs-5'l><'col-sm-6 col-xs-7'f>r>t<'row'<'col-sm-5 hidden-xs'i><'col-sm-7 col-xs-12 clearfix'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_",
"sSearch": '<div class="input-group">_INPUT_<span class="input-group-addon"><i class="fa fa-search"></i></span></div>',
"sInfo": "<strong>_START_</strong>-<strong>_END_</strong> of <strong>_TOTAL_</strong>",
"oPaginate": {
"sPrevious": "",
"sNext": ""
}
},
"bJQueryUI": false,
"bAutoWidth": false,
"aaSorting": [[2, "desc"]],
"bStateSave": true,
"bServerSide": true,
"iDisplayLength": 10,
"aLengthMenu": [
[10, 30, 50, -1],
[10, 30, 50, "All"]
],
"fnDrawCallback": function( oSettings ) {
$("#titleCheck").click(function() {
var checkedStatus = this.checked;
$("table tbody tr td div:first-child input[type=checkbox]").each(function() {
this.checked = checkedStatus;
if (checkedStatus == this.checked) {
$(this).closest('table tbody tr').removeClass('danger');
$(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked);
$('#totaldata').val($('form input[type=checkbox]:checked').size());
}
if (this.checked) {
$(this).closest('table tbody tr').addClass('danger');
$(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked);
$('#totaldata').val($('form input[type=checkbox]:checked').size());
}
});
});
$('table tbody tr td div:first-child input[type=checkbox]').on('click', function () {
var checkedStatus = this.checked;
this.checked = checkedStatus;
if (checkedStatus == this.checked) {
$(this).closest('table tbody tr').removeClass('danger');
$(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked);
$('#totaldata').val($('form input[type=checkbox]:checked').size());
}
if (this.checked) {
$(this).closest('table tbody tr').addClass('danger');
$(this).closest('table tbody tr').find('input:hidden').attr('disabled', !this.checked);
$('#totaldata').val($('form input[type=checkbox]:checked').size());
}
});
$('table tbody tr td div:first-child input[type=checkbox]').change(function() {
$(this).closest('tr').toggleClass("danger", this.checked);
});
$(".alertdel").click(function(){
var id = $(this).attr("id");
$('#alertdel').modal('show');
$('#delid').val(id);
});
$(".setuju").click(function(){
var id = $(this).attr("id");
//alert(id);
$('#setuju').modal('show');
$('#setujuid').val(id);
});
}
});

$(".masked_date").mask("9999-99-99");
$(".masked_date_time").mask("9999-99-99 99:99:99");
Loading