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

Update Dashboard #541

Merged
merged 8 commits into from
Nov 20, 2023
Merged
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
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');
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
2 changes: 1 addition & 1 deletion donjo-app/Controllers/Siteman/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function submit()
return redirect()->to('hom_desa')->with('success', 'Halo, selamat datang kembali');
}

session()->setFlashdata('error', 'Silakan coba kembali.');
session()->setFlashdata('error', 'Kredensial tidak valid, silakan coba lagi.');

return $this->index();
}
Expand Down
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