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

[BREAKING_CHANGE] School config #113

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ app.baseURL = 'http://localhost/absensi-sekolah-qr-code/'
# app.forceGlobalSecureRequests = true
# app.CSPEnabled = false

#--------------------------------------------------------------------
# SCHOOL
#--------------------------------------------------------------------

school.name = 'SMK 1 Indonesia'
school.schoolYear = '2024/2025'

# Tentukan apakah akan memakai logo di qr code atau tidak
# true|false
QR_LOGO=false
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,17 @@ Aplikasi Web Sistem Absensi Sekolah Berbasis QR Code adalah sebuah proyek yang b
>
> - Konfigurasi file `.env` untuk mengatur base url(terutama jika melakukan hosting), koneksi database dan pengaturan lainnya sesuai dengan lingkungan pengembangan Anda.
>
> - Untuk mengubah konfigurasi nama sekolah, tahun ajaran dll, buka file konfigurasi `app/Config/AbsensiSekolah.php` dan ubah pada:
> - Untuk mengubah konfigurasi nama sekolah, tahun ajaran dll, buka file `.env` dan ubah pada:
>
> ```php
> // NAMA SEKOLAH
> const SCHOOL_NAME = 'SMK 1 Indonesia';
>
> // TAHUN AJARAN
> const SCHOOL_YEAR = '2024/2025';
>
> // ...
> ```sh
> #------------
> # SCHOOL
> #------------
>
> school.name = 'SMK 1 Indonesia'
> school.schoolYear = '2024/2025'
> # ...
> # TAMBAHKAN JIKA TIDAK ADA / SALIN DARI FILE `.env.example`
> ```
>
> - Ganti/replace logo sekolah di `public/assets/img/logo_sekolah.jpg`.
Expand Down
6 changes: 3 additions & 3 deletions app/Config/AbsensiSekolah.php → app/Config/School.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use CodeIgniter\Config\BaseConfig;

class AbsensiSekolah extends BaseConfig
class School extends BaseConfig
{
/**
* --------------------------------------------------------------------------
Expand All @@ -13,7 +13,7 @@ class AbsensiSekolah extends BaseConfig
*
* Pengaturan untuk nama sekolah
*/
const SCHOOL_NAME = 'SMK 1 Indonesia';
public string $name = 'SMK 1 Indonesia';

/**
* --------------------------------------------------------------------------
Expand All @@ -22,5 +22,5 @@ class AbsensiSekolah extends BaseConfig
*
* Pengaturan untuk tahun ajaran
*/
const SCHOOL_YEAR = '2024/2025';
public string $schoolYear = '2024/2025';
}
3 changes: 1 addition & 2 deletions app/Controllers/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use App\Models\PresensiGuruModel;
use App\Models\PresensiSiswaModel;
use CodeIgniter\I18n\Time;
use Config\AbsensiSekolah as ConfigAbsensiSekolah;

class Dashboard extends BaseController
{
Expand All @@ -35,7 +34,7 @@ public function __construct()
$this->presensiSiswaModel = new PresensiSiswaModel();
$this->presensiGuruModel = new PresensiGuruModel();
$this->petugasModel = new PetugasModel();
$this->namaSekolah = ConfigAbsensiSekolah::SCHOOL_NAME;
$this->namaSekolah = config('School')->name;
}

public function index()
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/Admin/GenerateLaporan.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use App\Models\PresensiGuruModel;
use App\Models\SiswaModel;
use App\Models\PresensiSiswaModel;
use Config\AbsensiSekolah as ConfigAbsensiSekolah;

class GenerateLaporan extends BaseController
{
Expand All @@ -38,8 +37,9 @@ public function __construct()
$this->presensiSiswaModel = new PresensiSiswaModel();
$this->presensiGuruModel = new PresensiGuruModel();

$this->namaSekolah = ConfigAbsensiSekolah::SCHOOL_NAME;
$this->tahunAjaran = ConfigAbsensiSekolah::SCHOOL_YEAR;
$schoolConfig = config('School');
$this->namaSekolah = $schoolConfig->name;
$this->tahunAjaran = $schoolConfig->schoolYear;
}

public function index()
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/data/data-guru.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="row">
<div class="col">
<h4 class="card-title"><b>Daftar Guru</b></h4>
<p class="card-category">Angkatan <?= \Config\AbsensiSekolah::SCHOOL_YEAR ?></p>
<p class="card-category">Angkatan <?= config('School')->schoolYear ?></p>
</div>
<div class="col-auto">
<div class="nav-tabs-wrapper">
Expand Down
2 changes: 1 addition & 1 deletion app/Views/admin/data/data-siswa.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="row">
<div class="col-md-2">
<h4 class="card-title"><b>Daftar Siswa</b></h4>
<p class="card-category">Angkatan <?= \Config\AbsensiSekolah::SCHOOL_YEAR ?></p>
<p class="card-category">Angkatan <?= config('School')->schoolYear ?></p>
</div>
<div class="col-md-4">
<div class="nav-tabs-wrapper">
Expand Down
4 changes: 2 additions & 2 deletions app/Views/admin/kelas/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<div class="row">
<div class="col">
<h4 class="card-title"><b>Daftar Kelas</b></h4>
<p class="card-category">Angkatan <?= \Config\AbsensiSekolah::SCHOOL_YEAR ?></p>
<p class="card-category">Angkatan <?= config('School')->schoolYear ?></p>
</div>
<div class="col-auto">
<div class="nav-tabs-wrapper">
Expand Down Expand Up @@ -57,7 +57,7 @@
<div class="row">
<div class="col">
<h4 class="card-title"><b>Daftar Jurusan</b></h4>
<p class="card-category">Angkatan <?= \Config\AbsensiSekolah::SCHOOL_YEAR ?></p>
<p class="card-category">Angkatan <?= config('School')->schoolYear ?></p>
</div>
<div class="col-auto">
<div class="nav-tabs-wrapper">
Expand Down