Skip to content

Commit

Permalink
Merge pull request #84 from janglapuk/master
Browse files Browse the repository at this point in the history
Update pengaturan nama sekolah dan override Myth:Auth auth config
  • Loading branch information
ikhsan3adi authored Jul 3, 2024
2 parents ee6f5b9 + fefd130 commit 6fe160f
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 48 deletions.
52 changes: 10 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,48 +112,6 @@ Aplikasi Web Sistem Absensi Sekolah Berbasis QR Code adalah sebuah proyek yang b
> php spark migrate --all
> ```
- Buka file `vendor/myth/auth/src/Config/Auth.php`. Lalu ubah kedua baris berikut:
```php
public $requireActivation = 'Myth\Auth\Authentication\Activators\EmailActivator';
public $activeResetter = 'Myth\Auth\Authentication\Resetters\EmailResetter';
```
- ubah value menjadi `null`:

```php
public $requireActivation = null;

public $activeResetter = null;
```

- (Opsional) Masih di file yang sama, ubah baris berikut:

```php
public $views = [
'login' => 'Myth\Auth\Views\login', // baris ini
'register' => 'Myth\Auth\Views\register',
'forgot' => 'Myth\Auth\Views\forgot',
'reset' => 'Myth\Auth\Views\reset',
'emailForgot' => 'Myth\Auth\Views\emails\forgot',
'emailActivation' => 'Myth\Auth\Views\emails\activation',
];
```

menjadi:

```php
public $views = [
'login' => '\App\Views\admin\login', // menggunakan tampilan login custom
'register' => 'Myth\Auth\Views\register',
'forgot' => 'Myth\Auth\Views\forgot',
'reset' => 'Myth\Auth\Views\reset',
'emailForgot' => 'Myth\Auth\Views\emails\forgot',
'emailActivation' => 'Myth\Auth\Views\emails\activation',
];
```

> [!IMPORTANT]
>
> - Jalankan web server (contoh Apache, XAMPP, etc)
Expand All @@ -179,6 +137,16 @@ public $views = [
- Izinkan akses kamera.
### Konfigurasi
**Nama Sekolah**
Untuk mengubah identitas nama sekolah, buka file konfigurasi `app/Config/AbsensiSekolah.php` dan ubah pada:
```php
public string $namaSekolah = 'SMK 12369 HONGKONG';
```
## Kesimpulan

Dengan aplikasi web sistem absensi sekolah berbasis QR code ini, diharapkan proses absensi di sekolah menjadi lebih efisien dan terotomatisasi. Proyek ini dapat diadaptasi dan dikembangkan lebih lanjut sesuai dengan kebutuhan dan persyaratan sekolah Anda.
Expand Down
17 changes: 17 additions & 0 deletions app/Config/AbsensiSekolah.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class AbsensiSekolah extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Nama Sekolah
* --------------------------------------------------------------------------
*
* Pengaturan untuk nama sekolah
*/
public string $namaSekolah = 'SMK 1 Indonesia';
}
51 changes: 51 additions & 0 deletions app/Config/Auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace Config;

use Myth\Auth\Config\Auth as MythAuthConfig;

class Auth extends MythAuthConfig
{
/**
* --------------------------------------------------------------------
* Require Confirmation Registration via Email
* --------------------------------------------------------------------
*
* When enabled, every registered user will receive an email message
* with an activation link to confirm the account.
*
* @var string|null Name of the ActivatorInterface class
*/
public $requireActivation = null;
// public $requireActivation = 'Myth\Auth\Authentication\Activators\EmailActivator';

/**
* --------------------------------------------------------------------
* Allow Password Reset via Email
* --------------------------------------------------------------------
*
* When enabled, users will have the option to reset their password
* via the specified Resetter. Default setting is email.
*
* @var string|null Name of the ResetterInterface class
*/
public $activeResetter = null;
// public $activeResetter = 'Myth\Auth\Authentication\Resetters\EmailResetter';

/**
* --------------------------------------------------------------------
* Views used by Auth Controllers
* --------------------------------------------------------------------
*
* @var array
*/
public $views = [
'login' => '\App\Views\admin\login',
// 'login' => 'Myth\Auth\Views\login',
'register' => 'Myth\Auth\Views\register',
'forgot' => 'Myth\Auth\Views\forgot',
'reset' => 'Myth\Auth\Views\reset',
'emailForgot' => 'Myth\Auth\Views\emails\forgot',
'emailActivation' => 'Myth\Auth\Views\emails\activation',
];
}
8 changes: 7 additions & 1 deletion app/Controllers/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Models\PresensiGuruModel;
use App\Models\PresensiSiswaModel;
use CodeIgniter\I18n\Time;
use Config\AbsensiSekolah as ConfigAbsensiSekolah;

class Dashboard extends BaseController
{
Expand All @@ -24,6 +25,8 @@ class Dashboard extends BaseController

protected PetugasModel $petugasModel;

protected string $namaSekolah;

public function __construct()
{
$this->siswaModel = new SiswaModel();
Expand All @@ -32,6 +35,7 @@ public function __construct()
$this->presensiSiswaModel = new PresensiSiswaModel();
$this->presensiGuruModel = new PresensiGuruModel();
$this->petugasModel = new PetugasModel();
$this->namaSekolah = (new ConfigAbsensiSekolah)->namaSekolah;
}

public function index()
Expand Down Expand Up @@ -96,7 +100,9 @@ public function index()
'alfa' => count($this->presensiGuruModel->getPresensiByKehadiran('4', $today))
],

'petugas' => $this->petugasModel->getAllPetugas()
'petugas' => $this->petugasModel->getAllPetugas(),

'namaSekolah' => $this->namaSekolah,
];

return view('admin/dashboard', $data);
Expand Down
11 changes: 9 additions & 2 deletions app/Controllers/Admin/GenerateLaporan.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use App\Models\PresensiGuruModel;
use App\Models\SiswaModel;
use App\Models\PresensiSiswaModel;
use Config\AbsensiSekolah as ConfigAbsensiSekolah;

class GenerateLaporan extends BaseController
{
Expand All @@ -24,6 +25,8 @@ class GenerateLaporan extends BaseController
protected PresensiSiswaModel $presensiSiswaModel;
protected PresensiGuruModel $presensiGuruModel;

protected string $namaSekolah;

public function __construct()
{
$this->siswaModel = new SiswaModel();
Expand All @@ -33,6 +36,8 @@ public function __construct()

$this->presensiSiswaModel = new PresensiSiswaModel();
$this->presensiGuruModel = new PresensiGuruModel();

$this->namaSekolah = (new ConfigAbsensiSekolah)->namaSekolah;
}

public function index()
Expand Down Expand Up @@ -120,7 +125,8 @@ public function generateLaporanSiswa()
'perempuan' => count($siswa) - $laki
],
'kelas' => $kelas,
'grup' => "kelas " . $kelas['kelas'] . " " . $kelas['jurusan']
'grup' => "kelas " . $kelas['kelas'] . " " . $kelas['jurusan'],
'namaSekolah' => $this->namaSekolah
];


Expand Down Expand Up @@ -193,7 +199,8 @@ public function generateLaporanGuru()
'laki' => $laki,
'perempuan' => count($guru) - $laki
],
'grup' => 'guru'
'grup' => 'guru',
'namaSekolah' => $this->namaSekolah
];

if ($type == 'doc') {
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class="card-footer">
<div class="stats">
<i class="material-icons">home</i>
SMK 12369 HONGKONG
<?= $namaSekolah; ?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/generate-laporan/laporan-guru.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<td><img src="<?= base_url('public/assets/img/logo_sekolah.jpg'); ?>" width="100px" height="100px"></img></td>
<td width="100%">
<h2 align="center">DAFTAR HADIR GURU</h2>
<h4 align="center">SMK 12369 HONGKONG</h4>
<h4 align="center"><?= $namaSekolah; ?></h4>
<h4 align="center">TAHUN PELAJARAN 2022/2023</h4>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/generate-laporan/laporan-siswa.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<td><img src="<?= base_url('public/assets/img/logo_sekolah.jpg'); ?>" width="100px" height="100px"></img></td>
<td width="100%">
<h2 align="center">DAFTAR HADIR SISWA</h2>
<h4 align="center">SMK 12369 HONGKONG</h4>
<h4 align="center"><?= $namaSekolah; ?></h4>
<h4 align="center">TAHUN PELAJARAN 2022/2023</h4>
</td>
<td>
Expand Down

0 comments on commit 6fe160f

Please sign in to comment.