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

Menerapkan template baru #488

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions donjo-app/Config/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@
$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https://' : 'http://') . $host . dirname($_SERVER['SCRIPT_NAME']);

defined('BASE_URL') || define('BASE_URL', $base_url);

define('SID_LOGO', '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><path fill="#333" d="M82.55 418.768c-3.516 0-5.977-1.231-7.383-3.692-1.407-2.461-2.11-5.098-2.11-7.911.352-5.977 1.758-9.317 4.219-10.02 2.461-.703 5.45-1.055 8.966-1.055 9.493 0 16.701-1.934 21.624-5.801 4.922-3.868 8.877-8.966 11.866-15.295.238-.504.475-1.009.712-1.515h30.487c-.686 3.39-1.065 6.269-1.137 8.635-.176 5.801 2.637 9.581 8.438 11.339 5.801 1.758 15.558 2.637 29.271 2.637 3.867 0 6.944.352 9.229 1.055 2.286.703 3.605 4.043 3.956 10.02 0 2.813-.791 5.45-2.373 7.911-1.583 2.461-3.956 3.692-7.12 3.692-11.251-.703-21.008-1.143-29.271-1.318-8.263-.176-17.668-.264-28.216-.264-7.032 0-12.921.088-17.668.264-4.747.175-9.581.351-14.503.527-4.923.176-11.252.44-18.987.791Zm138.179-281.631c3.516-8.439 4.219-14.855 2.11-19.25-2.11-4.395-5.626-7.56-10.548-9.494-4.923-1.933-10.373-3.428-16.35-4.483-5.274-1.055-8.79-2.021-10.548-2.9-1.758-.879-2.637-3.956-2.637-9.23 0-5.977 2.11-9.23 6.329-9.757 4.219-.527 9.142-.791 14.767-.791 14.416 0 26.722 1.406 36.918 4.219 10.197 2.813 18.987 8.175 26.37 16.086 7.384 7.911 14.24 19.778 20.569 35.6l60.62 149.385h-55.804l-52.282-133.036h-1.582L183.79 286.522h-26.207l63.146-149.385Zm163.494 236.802c2.813 6.329 6.592 11.515 11.339 15.559 4.747 4.043 10.812 6.241 18.196 6.592 3.867 0 6.944.352 9.229 1.055 2.285.703 3.604 4.043 3.956 10.02 0 2.813-.791 5.45-2.374 7.911-1.582 2.461-3.955 3.692-7.12 3.692-11.251-.703-21.095-1.143-29.534-1.318-8.439-.176-17.932-.264-28.48-.264-20.744 0-42.543.527-65.397 1.582-3.516 0-5.977-1.231-7.384-3.692-1.406-2.461-2.109-5.098-2.109-7.911.351-5.977 1.758-9.317 4.219-10.02 2.461-.703 5.45-1.055 8.966-1.055 17.228 0 26.633-3.164 28.215-9.493.821-3.284.767-7.657-.163-13.118h58.237c.068.153.136.307.204.46Zm-271.749-73.668c3.092 0 4.638 1.805 4.638 5.411v36.563c0 1.134-.387 2.319-1.159 3.556-.773 1.237-1.985 2.01-3.633 2.319h21.025c-1.649-.309-2.86-1.082-3.633-2.319-.773-1.237-1.159-2.422-1.159-3.556v-49.472l-16.079 7.498Zm72.623 45.606c-.747-1.184-1.121-2.396-1.121-3.633V325.78c0-3.247-.709-6.08-2.126-8.503-1.418-2.422-3.376-4.277-5.874-5.566-2.501-1.287-5.295-1.932-8.387-1.932-2.474 0-4.704.451-6.687 1.353-1.984.902-3.544 2.087-4.677 3.556-1.134 1.468-1.7 2.976-1.7 4.522 0 .773.154 1.52.463 2.241.36.98.979 1.778 1.856 2.397.875.618 1.855.927 2.937.927 1.391 0 2.576-.489 3.556-1.468.978-.979 1.468-2.191 1.468-3.633 0-1.443-.49-2.654-1.468-3.634-.98-.978-2.165-1.468-3.556-1.468-.928 0-1.766.206-2.512.618-.748.413-1.353.98-1.817 1.701.67-1.804 1.933-3.208 3.788-4.213 1.855-1.005 3.762-1.507 5.72-1.507 2.783 0 4.741.606 5.875 1.816 1.133 1.212 1.701 2.667 1.701 4.368 0 1.34-.464 2.512-1.391 3.517-.928 1.005-2.101 1.855-3.518 2.55-1.417.696-3.362 1.56-5.836 2.59-3.092 1.341-5.565 2.512-7.421 3.517-1.855 1.005-3.453 2.333-4.792 3.981-1.341 1.65-2.01 3.633-2.01 5.952 0 1.701.451 3.299 1.353 4.793.901 1.495 2.28 2.719 4.135 3.672 1.855.953 4.174 1.43 6.957 1.43 3.556 0 6.455-.658 8.697-1.971 2.241-1.314 3.619-2.847 4.135-4.6.412 1.65 1.237 2.951 2.474 3.904 1.236.954 2.885 1.43 4.947 1.43h8.503c-1.701-.309-2.926-1.056-3.672-2.242v-.001Zm-23.692-.308c-1.496-1.185-2.242-3.22-2.242-6.107 0-2.421.773-4.702 2.319-6.841 1.546-2.137 3.71-4.599 6.493-7.382 1.546-1.546 2.667-2.73 3.362-3.555.696-.824 1.095-1.547 1.198-2.165v20.639c0 1.443-.322 2.705-.966 3.787-.645 1.083-1.469 1.921-2.473 2.513-1.005.593-1.972.889-2.899.889-1.701 0-3.299-.592-4.793-1.778h.001Zm41.6 2.551h21.025c-1.649-.309-2.86-1.082-3.633-2.319-.773-1.237-1.159-2.422-1.159-3.556v-27.132c2.215-2.474 4.302-3.71 6.261-3.71 1.803 0 3.117.695 3.942 2.087.824 1.391 1.301 2.821 1.43 4.29.128 1.469.193 3.312.193 5.527v24.813h16.233c-1.649-.309-2.859-1.082-3.633-2.319-.773-1.237-1.159-2.422-1.159-3.556v-17.779c0-3.297-.67-6.041-2.01-8.232-1.34-2.19-3.053-3.813-5.14-4.87-2.087-1.056-4.24-1.585-6.455-1.585-3.66 0-6.88 1.573-9.662 4.715v-4.715l-16.079 7.498c3.092 0 4.638 1.805 4.638 5.411v19.557c0 1.134-.386 2.319-1.159 3.556s-1.985 2.01-3.633 2.319Zm71.039-11.711c2.576 1.108 5.359 1.661 8.348 1.661 3.247 0 6.235-.63 8.967-1.893 2.731-1.263 4.895-2.989 6.493-5.18 1.597-2.189 2.397-4.572 2.397-7.15 0-2.422-.748-4.689-2.242-6.802-1.495-2.113-3.505-3.788-6.029-5.025.154-1.906.785-3.156 1.893-3.749 1.108-.592 2.77-.837 4.986-.734l4.947-6.184c-4.071 0-7.086.941-9.044 2.821-1.959 1.882-3.041 4.42-3.246 7.614-2.835-1.339-5.875-2.009-9.122-2.009-3.196 0-6.159.631-8.889 1.893-2.732 1.264-4.897 2.976-6.493 5.141-1.598 2.164-2.397 4.51-2.397 7.034 0 2.783.928 5.334 2.783 7.653-1.443 1.237-2.628 2.809-3.556 4.715-.927 1.907-1.391 3.814-1.391 5.72 0 3.454.927 6.235 2.783 8.349 1.855 2.112 4.74 3.169 8.657 3.169 2.319 0 4.457-.245 6.416-.734 1.958-.491 4.174-1.173 6.648-2.049 2.885-1.031 4.921-1.546 6.106-1.546.567 0 1.018.18 1.353.541.335.361.503.824.503 1.392 0 1.237-.619 2.602-1.856 4.097-1.236 1.494-3.079 2.783-5.526 3.865-2.449 1.082-5.425 1.623-8.928 1.623 4.328 0 8.271-.618 11.826-1.855 3.556-1.237 6.351-2.926 8.387-5.063 2.036-2.139 3.054-4.472 3.054-6.996 0-2.783-.954-4.882-2.861-6.3-1.907-1.417-4.148-2.126-6.725-2.126-1.65 0-3.337.22-5.063.657-1.727.439-3.801 1.071-6.223 1.894-2.164.773-3.942 1.341-5.333 1.701-1.392.361-2.706.541-3.943.541-2.423 0-4.097-.605-5.024-1.816-.928-1.21-1.392-2.461-1.392-3.749 0-1.958.824-3.813 2.474-5.566 1.597 1.855 3.684 3.337 6.261 4.445h.001Zm2.164-12.639c0-2.987.309-5.5.927-7.536.619-2.035 1.404-3.543 2.358-4.522.953-.979 1.921-1.469 2.899-1.469s1.958.49 2.937 1.469c.979.979 1.778 2.487 2.397 4.522.618 2.036.927 4.547.927 7.536 0 2.99-.309 5.527-.927 7.615-.619 2.087-1.419 3.646-2.397 4.676-.979 1.032-1.958 1.546-2.937 1.546-.98 0-1.946-.514-2.899-1.546-.954-1.03-1.739-2.589-2.358-4.676-.618-2.088-.927-4.627-.927-7.615Zm44.543 22.031c-.773 1.237-1.984 2.009-3.633 2.319h21.026c-1.65-.31-2.86-1.083-3.633-2.319-.773-1.237-1.16-2.422-1.16-3.556v-32.466l-16.078 7.498c3.092 0 4.638 1.805 4.638 5.411v19.557c0 1.134-.386 2.319-1.159 3.556h-.001Zm5.644-40.428c1.803 0 3.362-.669 4.676-2.009 1.315-1.34 1.971-2.886 1.971-4.639 0-1.803-.656-3.362-1.971-4.676-1.314-1.315-2.872-1.971-4.676-1.971-1.805 0-3.363.656-4.677 1.971-1.314 1.314-1.971 2.872-1.971 4.676 0 1.805.657 3.363 1.971 4.677 1.314 1.314 2.873 1.971 4.677 1.971Zm40.198 5.643v-11.904l-16.079 7.498c2.834 0 4.354 1.469 4.561 4.406h-4.561v.464h4.639v24.504c0 2.732.476 4.961 1.429 6.686.954 1.728 2.848 3.067 5.682 4.02 2.834.954 6.931 1.43 12.291 1.43-2.423 0-4.355-1.133-5.797-3.401-1.444-2.267-2.165-5.179-2.165-8.735V311.48h7.962v-.464h-7.962Z" style="white-space:pre"/></svg>');
14 changes: 11 additions & 3 deletions donjo-app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use App\Controllers\Install;
use App\Controllers\Main;
use App\Controllers\Siteman\Dashboard;
use App\Controllers\Siteman\Login;
use CodeIgniter\Router\RouteCollection;

Expand All @@ -17,7 +18,14 @@
});

// siteman
$routes->group('siteman', ['filter' => 'isLogin'], static function ($routes) {
$routes->get('/', [Login::class, 'index'], ['as' => 'login.view']);
$routes->post('/', [Login::class, 'submit'], ['as' => 'login.submit']);
$routes->group('siteman', static function ($routes) {
// login
$routes->get('/', [Login::class, 'index'], ['as' => 'login.view', 'filter' => 'isLogin']);
$routes->post('/', [Login::class, 'submit'], ['as' => 'login.submit', 'filter' => 'isLogin']);

// dashboard
$routes->get('dashboard', [Dashboard::class, 'index'], ['as' => 'siteman.dashboard.view']);
});

// redirect halaman yang lama
$routes->addRedirect('hom_desa', 'siteman.dashboard.view');
10 changes: 5 additions & 5 deletions donjo-app/Config/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
use CodeIgniter\Session\Handlers\DatabaseHandler;

class Session extends BaseConfig
{
Expand All @@ -21,7 +21,7 @@ class Session extends BaseConfig
*
* @phpstan-var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
public string $driver = DatabaseHandler::class;

/**
* --------------------------------------------------------------------------
Expand All @@ -30,7 +30,7 @@ class Session extends BaseConfig
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
public string $cookieName = 'sid_session';

/**
* --------------------------------------------------------------------------
Expand All @@ -57,7 +57,7 @@ class Session extends BaseConfig
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = WRITEPATH . 'session';
public string $savePath = 'sessions';

/**
* --------------------------------------------------------------------------
Expand All @@ -69,7 +69,7 @@ class Session extends BaseConfig
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = false;
public bool $matchIP = true;

/**
* --------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
<?php

namespace App\Controllers;
namespace App\Controllers\Siteman;

use Kenjis\CI3Compatible\Core\CI_Controller;

class Hom_desa extends CI_Controller
class Dashboard extends CI_Controller
{
public function __construct()
{
parent::__construct();

$this->load->model('user_model');
$grup = $this->user_model->sesi_grup($_SESSION['sesi']);
if ($grup !== '1' && $grup !== '2') {
return redirect()->to('siteman');
}
$this->load->model('header_model');
$this->load->model('config_model');
}
// public function __construct()
// {
// parent::__construct();

// $this->load->model('user_model');
// $grup = $this->user_model->sesi_grup($_SESSION['sesi']);
// if ($grup !== '1' && $grup !== '2') {
// return redirect()->to('siteman');
// }
// $this->load->model('header_model');
// $this->load->model('config_model');
// }

public function index()
{
$_SESSION['delik'] = 0;
$nav['act'] = 0;
$header = $this->header_model->get_data();
$data['main'] = $this->config_model->get_data();
echo view('header', $header);
echo view('home/nav', $nav);
echo view('home/konfigurasi_form', $data);
echo view('footer');
return view('siteman/dashboard');
}

public function about()
Expand Down
26 changes: 10 additions & 16 deletions donjo-app/Controllers/Siteman/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@

namespace App\Controllers\Siteman;

use App\Controllers\BaseController;
use App\Models\Config;
use App\Models\User;
use CodeIgniter\HTTP\RedirectResponse;
use Kenjis\CI3Compatible\Core\CI_Controller;

class Login extends CI_Controller
class Login extends BaseController
{
public function __construct()
{
parent::__construct();

$this->load->model('config_model');
}

/**
* Menampilkan halaman login
*/
public function index(): string
{
$configModel = new Config();

$data = [
'title' => 'Masuk',
'desa' => $this->config_model->get_data(),
'desa' => $configModel->first(),
];

return view('siteman/login', $data);
Expand All @@ -35,16 +31,12 @@ public function index(): string
*/
public function submit()
{
if (! $this->request->is('post')) {
return $this->index();
}

$rules = [
'username' => ['label' => 'Username', 'rules' => 'required'],
'password' => ['label' => 'Password', 'rules' => 'required'],
];

if (! $this->validate($rules)) {
if (! $this->request->is('post') || ! $this->validate($rules)) {
return $this->index();
}

Expand Down Expand Up @@ -75,6 +67,8 @@ public function submit()
return redirect()->to('hom_desa')->with('success', 'Halo, selamat datang kembali');
}

return redirect('login.view')->withInput()->with('error', 'Silakan coba kembali.');
session()->setFlashdata('error', 'Kredensial tidak valid, silakan coba lagi.');

return $this->index();
}
}
3 changes: 3 additions & 0 deletions donjo-app/Database/Migrations/2023-10-02-145306_Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class Init extends Migration
{
/**
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up()
{
$this->forge->addField([
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class CreateCiSessionsTable extends Migration
{
protected $DBGroup = 'default';

/**
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up()
{
$this->forge->addField([
'id' => ['type' => 'VARCHAR', 'constraint' => 128, 'null' => false],
'ip_address' => ['type' => 'VARCHAR', 'constraint' => 45, 'null' => false],
'timestamp timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL',
'data' => ['type' => 'BLOB', 'null' => false],
]);
$this->forge->addKey(['id', 'ip_address'], true);
$this->forge->addKey('timestamp');
$this->forge->createTable('sessions', true);
}

public function down()
{
$this->forge->dropTable('sessions', true);
}
}
28 changes: 20 additions & 8 deletions donjo-app/Models/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@

namespace App\Models;

use Kenjis\CI3Compatible\Core\CI_Model as Model;
use CodeIgniter\Model;

class Config extends Model
{
protected $table = 'config';

public function __construct()
{
$this->load->database('default');
}

protected $table = 'config';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'nama_desa', 'kode_desa', 'nama_kepala_desa',
'nip_kepala_desa', 'kode_pos', 'nama_kecamatan',
'kode_kecamatan', 'nama_kepala_camat',
'nip_kepala_camat', 'nama_kabupaten',
'kode_kabupaten', 'nama_propinsi', 'kode_propinsi',
'logo', 'lat', 'lng', 'zoom', 'map_tipe', 'path',
'alamat_kantor', 'g_analytic', 'regid', 'macid',
'email_desa', 'gapi_key',
];

/*
public function insert($data)
{
$outp = $this->db->insert($this->table, $data);
Expand Down Expand Up @@ -45,4 +56,5 @@ public function get_data(bool $return_array = false)

return $query->row_array();
}
*/
}
25 changes: 25 additions & 0 deletions donjo-app/Models/SettingModul.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Models;

use CodeIgniter\Model;

class SettingModul extends Model
{
protected $table = 'setting_modul';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'id',
'modul',
'url',
'aktif',
'ikon',
'urut',
'level',
'hidden',
];
}
Loading
Loading