Skip to content

Commit

Permalink
3.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
osmangandon committed Sep 9, 2020
1 parent f1e569a commit bcf099a
Show file tree
Hide file tree
Showing 39 changed files with 6,118 additions and 1 deletion.
10 changes: 10 additions & 0 deletions egr/gr/i_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
</td>
<td>
<a href="papan_tulis.php?gmkd='.$gmkd.'" title="PAPAN TULIS" class="btn btn-primary">::PAPAN TULIS</a>
</td>
<td>
<a href="news.php?gmkd='.$gmkd.'" title="BERITA" class="btn btn-primary">::BERITA</a>
Expand Down
190 changes: 190 additions & 0 deletions egr/gr/i_papan_tulis.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
<?php
session_start();

//ambil nilai
require("../../inc/config.php");
require("../../inc/fungsi.php");
require("../../inc/koneksi.php");
require("../../inc/cek/janissari.php");
require("../../inc/cek/e_gr.php");



//ambil nilai
$gmkd = nosql($_REQUEST['gmkd']);

?>

<style>
body {
margin:0px;
-webkit-touch-callout: none;
-webkit-text-size-adjust: none;
-webkit-user-select: none;
}
</style>




<link href="https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/3.6.95/css/materialdesignicons.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="../../inc/class/jquery_drawr/web/jquery.drawr.combined.js?v=2"></script>







<div id="drawr-container" style="width:100vw;height:100vh;">
<canvas class="demo-canvas drawr-test1"></canvas>
</div>
<input type="file" id="file-picker" style="display:none;">




<script type="text/javascript">

//membuat document jquery
$(document).ready(function(){





$("#drawr-container .demo-canvas").drawr({
"enable_tranparency" : false
});

$(".demo-canvas").drawr("start");






//add custom save button.
var buttoncollection = $("#drawr-container .demo-canvas").drawr("button", {
"icon":"mdi mdi-folder-open mdi-24px"
}).on("touchstart mousedown",function(){
//alert("demo of a custom button with your own functionality!");
$("#file-picker").click();
});


var buttoncollection = $("#drawr-container .demo-canvas").drawr("button", {
"icon":"mdi mdi-content-save mdi-24px"
}).on("touchstart mousedown",function(){
var imagedata = $("#drawr-container .demo-canvas").drawr("export","image/png");
var element = document.createElement('a');


$.ajax({
url:"i_papan_tulis_simpan.php?gmkd=<?php echo $gmkd;?>",
// send the base64 post parameter
data:{
base64: imagedata
},
// important POST method !
type:"post",
complete:function(){
//console.log("Ready");
//alert("ready");
}
});


element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);



});






$("#file-picker")[0].onchange = function(){
var file = $("#file-picker")[0].files[0];
if (!file.type.startsWith('image/')){ return }
var reader = new FileReader();
reader.onload = function(e) {
$("#drawr-container .demo-canvas").drawr("load",e.target.result);
};
reader.readAsDataURL(file);
};











function moveItem() {

var imagedata = $("#drawr-container .demo-canvas").drawr("export","image/png");
var element = document.createElement('a');


$.ajax({
url:"i_papan_tulis_simpan.php?gmkd=<?php echo $gmkd;?>",
// send the base64 post parameter
data:{
base64: imagedata
},
// important POST method !
type:"post",
complete:function(){
//console.log("Ready");
//alert("ready");
}
});


element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);


}



setInterval(moveItem, 5000);










});

</script>


<hr>







44 changes: 44 additions & 0 deletions egr/gr/i_papan_tulis_simpan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
session_start();


//ambil nilai
require("../../inc/config.php");
require("../../inc/fungsi.php");
require("../../inc/koneksi.php");
require("../../inc/cek/janissari.php");
require("../../inc/cek/e_gr.php");


$baseFromJavascript = balikin($_POST['base64']);
$gmkd = balikin($_GET['gmkd']);



// We need to remove the "data:image/png;base64,"
$base_to_php = explode(',', $baseFromJavascript);

// the 2nd item in the base_to_php array contains the content of the image
$data = base64_decode($base_to_php[1]);


//777
$folderku = "../../filebox/materi/$gmkd";
chmod($folderku,0777);


// here you can detect if type is png or jpg if you want
$filepath = "../../filebox/materi/$gmkd/papantulis$gmkd.png"; // or image.jpg

// Save the image in a defined path
file_put_contents($filepath,$data);


//755
chmod($folderku,0755);
chmod($filepath,0755);



exit();
?>

0 comments on commit bcf099a

Please sign in to comment.