Skip to content

Instantly share code, notes, and snippets.

View virbo's full-sized avatar
💭
I may be slow to respond.

Yusuf Ayuba virbo

💭
I may be slow to respond.
View GitHub Profile
@virbo
virbo / index.html
Created April 13, 2016 14:52 — forked from k4ml/index.html
PHP SSE Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<script>
var source = new EventSource('updates.php');
source.onmessage = function(e) {
var updates;
@virbo
virbo / Tabel modul_alumni
Last active April 18, 2016 04:25
Tabel modul_alumni
CREATE TABLE `modul_alumni` (
`id_alumni` int(11) NOT NULL,
`nm_alumni` varchar(50) NOT NULL,
`id_wil` char(10) NOT NULL,
`tgl_input` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@virbo
virbo / Alumni_model.php
Last active April 18, 2016 04:18
models/Alumni_models.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Alumni_model extends CI_Model
{
/**
* @author Yusuf Ayuba
* @since 2016
*/
public function __construct()
@virbo
virbo / Welcome.php
Last active April 18, 2016 05:49
Application/Welcome.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* @author Yusuf Ayuba
* @since 2016
*/
@virbo
virbo / maps_view.php
Created April 18, 2016 03:51
Views/maps_view.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Peta Sebaran Alumni</title>
<link href="<?php echo base_url('assets/css/bootstrap.min.css');?>" rel="stylesheet">
<?php echo $map['js']; ?>
</head>
@virbo
virbo / form_add.php
Created April 18, 2016 03:54
Views/form_add.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Input Data</title>
<link href="<?php echo base_url('assets/css/bootstrap.min.css');?>" rel="stylesheet">
<link href="<?php echo base_url('assets/css/select2.min.css');?>" rel="stylesheet">
<link href="<?php echo base_url('assets/css/select2-bootstrap.css');?>" rel="stylesheet">
</head>
@virbo
virbo / .htaccess
Created April 18, 2016 04:09
File .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
@virbo
virbo / part_alumni_model.php
Created April 19, 2016 14:08
Fungsi tambahan untuk file Alumni_model.php
public function get_location_by_id($id)
{
$this->db->select('al.nm_alumni,CONCAT(rd.name, \', \', rp.name) AS lokasi')
->from('modul_alumni AS al')
->join('villages AS rd','al.id_wil=rd.id')
->join('districts AS rk','rd.district_id=rk.id')
->join('regencies AS rb','rk.regency_id=rb.id')
->join('provinces AS rp','rb.province_id=rp.id')
->where('al.id_wil',$id);
return $this->db->get();
@virbo
virbo / part__welcome.php
Last active April 19, 2016 14:23
Fungsi tambahan untuk file Welcome.php
public function modal($id)
{
$this->load->model('alumni_model','alumni');
$temp_result = $this->alumni->get_location_by_id($id)->result();
$temp_place = $this->alumni->get_location_by_id($id)->row();
$temp_jml = count($temp_result);
echo "<div class=\"panel panel-primary\">
<div class=\"panel-heading\">
<div class=\"row\">
<div class=\"col-xs-3\">
@virbo
virbo / part__welcome_.php
Created April 19, 2016 14:11
Modifikasi fungsi maps yang ada di file controllers Welcome.php
public function maps()
{
$this->load->model('alumni_model','alumni');
$config = array();
$config['center'] = 'jakarta';
$config['zoom'] = 'auto';
$this->googlemaps->initialize($config);
$temp_result = $this->alumni->get_location()->result();
$marker = array();