59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Mylib
|
|
{
|
|
|
|
/*fungsi membuat menampilkan halaman tertentu*/
|
|
function view($view, $data = array())
|
|
{
|
|
$ci = &get_instance();
|
|
if (!array_key_exists('title', $data)) {
|
|
$data['title'] = 'Pemetaan Daerah Rawan di Kecamatan Panyabungan Menggunakan Metode K-MEANS Clustering';
|
|
}
|
|
$ci->load->view('dist/_partials/header', $data);
|
|
$ci->load->view('dist/_partials/sidebar', $data);
|
|
if ($data) {
|
|
$ci->load->view($view, $data);
|
|
} else {
|
|
$ci->load->view($view);
|
|
}
|
|
|
|
}
|
|
|
|
/*fungsi membuat menampilkan halaman tertentu*/
|
|
function fview($view, $data = array())
|
|
{
|
|
$ci = &get_instance();
|
|
if (!array_key_exists('title', $data)) {
|
|
$data['title'] = 'PEMETAAN DAERAH RAWAN DI PANYABUNGAN MENGGUNAKAN METODE K-MEANS';
|
|
}
|
|
$ci->load->view('front/template/v_header', $data);
|
|
$ci->load->view('front/template/v_navbar', $data);
|
|
if ($data) {
|
|
$ci->load->view('front/' . $view, $data);
|
|
} else {
|
|
$ci->load->view('front/' . $view);
|
|
}
|
|
$ci->load->view('front/template/v_footer', $data);
|
|
}
|
|
|
|
function autoCode($field_code, $initial, $tabel)
|
|
{
|
|
$ci = &get_instance();
|
|
$ci->db->order_by($field_code, 'DESC');
|
|
$res = $ci->db->get($tabel);
|
|
$data = $res->row_array();
|
|
if ($data) {
|
|
$value = $data[$field_code];
|
|
$result = substr($value, 4, 8);
|
|
$result = (int) $result;
|
|
$result = $result + 1;
|
|
$coderesult = $initial . "-" . STR_PAD($result, 8, "0", STR_PAD_LEFT);
|
|
} else {
|
|
$coderesult = $initial . "-" . "00000001";
|
|
}
|
|
return $coderesult;
|
|
}
|
|
}
|