128 lines
8.5 KiB
PHP
128 lines
8.5 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class SeedVolunteerJobPostings extends Migration
|
|
{
|
|
private array $postings = [
|
|
[
|
|
'template_id' => 'f9df54cc-0173-4c5d-a3b6-d7ef64821e01',
|
|
'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e01',
|
|
'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e01',
|
|
'title' => 'Grade 6 Teacher Volunteer',
|
|
'description' => "Al Rahma Sunday School is looking for a dedicated Grade 6 Teacher Volunteer to teach and mentor students in a positive Islamic learning environment. The teacher will help students strengthen their understanding of Islamic studies, Quran, Arabic, manners, and character development.",
|
|
'responsibilities' => "- Teach Grade 6 Sunday school lessons based on the school curriculum\n- Prepare weekly lesson plans and classroom activities\n- Help students understand Islamic values and apply them in daily life\n- Manage classroom behavior in a respectful and positive way\n- Encourage student participation, discussion, and teamwork\n- Track attendance and student progress\n- Communicate with school administration and parents when needed\n- Support school events, exams, and activities when requested",
|
|
'requirements' => "- Strong commitment to Islamic education and community service\n- Comfortable teaching and guiding middle school students\n- Patient, responsible, organized, and dependable\n- Good communication skills\n- Prior teaching, tutoring, or youth mentoring experience preferred\n- Must be available during Sunday school hours",
|
|
],
|
|
[
|
|
'template_id' => 'f9df54cc-0173-4c5d-a3b6-d7ef64821e02',
|
|
'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e02',
|
|
'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e02',
|
|
'title' => 'Grade 8 Teacher Volunteer',
|
|
'description' => "Al Rahma Sunday School is seeking a Grade 8 Teacher Volunteer to support students as they continue developing their Islamic knowledge, personal responsibility, and connection to the Muslim community.\n\nThe Grade 8 teacher will lead classroom lessons, encourage meaningful discussion, and help students build confidence in their faith and character.",
|
|
'responsibilities' => "- Teach Grade 8 Sunday school curriculum\n- Prepare engaging lessons, discussions, and activities\n- Help students understand Islamic teachings in age-appropriate ways\n- Encourage respectful dialogue, critical thinking, and positive behavior\n- Support students with Quran, Islamic studies, Arabic, and character development\n- Maintain classroom order and a safe learning environment\n- Monitor attendance and student participation\n- Communicate with administration and parents as needed\n- Assist with school programs, projects, or events when requested",
|
|
'requirements' => "- Commitment to Islamic values and youth education\n- Ability to connect with middle school students\n- Responsible, patient, respectful, and organized\n- Strong communication and classroom management skills\n- Teaching, tutoring, halaqa, or mentoring experience preferred\n- Must be dependable and available on Sundays",
|
|
],
|
|
[
|
|
'template_id' => 'f9df54cc-0173-4c5d-a3b6-d7ef64821e03',
|
|
'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e03',
|
|
'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e03',
|
|
'title' => 'Youth Teacher / Mentor Volunteer',
|
|
'description' => "Al Rahma Sunday School is looking for a Youth Teacher / Mentor Volunteer to work with students ages 16-17. This role focuses on teaching, mentoring, and guiding older teens as they strengthen their Islamic identity, personal responsibility, leadership skills, and connection to the Muslim community.\n\nThe Youth Teacher will lead age-appropriate lessons and discussions that connect Islamic values to real-life topics students face at this stage of life.",
|
|
'responsibilities' => "- Teach and mentor students ages 16-17\n- Lead discussions on Islamic identity, character, Quran, Seerah, manners, leadership, and real-life challenges\n- Create a respectful classroom environment where students feel comfortable asking questions\n- Encourage critical thinking, responsibility, positive decision-making, and community involvement\n- Prepare weekly lessons, activities, or discussion topics\n- Support students in developing confidence in their faith and values\n- Maintain appropriate teacher-student boundaries and a safe learning environment\n- Track attendance and student participation\n- Communicate with Sunday school administration and parents when needed\n- Support youth projects, events, service activities, or school programs when requested",
|
|
'requirements' => "- Strong commitment to Islamic education and youth development\n- Ability to relate respectfully and effectively with older teens\n- Comfortable leading meaningful discussions with students ages 16-17\n- Patient, dependable, trustworthy, and organized\n- Good communication, leadership, and classroom management skills\n- Prior experience in teaching, mentoring, halaqas, youth programs, or community service preferred\n- Must be available during Sunday school hours",
|
|
],
|
|
];
|
|
|
|
public function up()
|
|
{
|
|
if (!$this->db->tableExists('job_templates') || !$this->db->tableExists('job_positions')) {
|
|
return;
|
|
}
|
|
|
|
$now = gmdate('Y-m-d H:i:s');
|
|
|
|
foreach ($this->postings as $posting) {
|
|
$shared = [
|
|
'title' => $posting['title'],
|
|
'description' => $posting['description'],
|
|
'department' => 'Sunday School',
|
|
'location' => 'Al Rahma Sunday School',
|
|
'employment_type' => 'Volunteer',
|
|
'responsibilities' => $posting['responsibilities'],
|
|
'requirements' => $posting['requirements'],
|
|
];
|
|
|
|
$template = $this->db->table('job_templates')
|
|
->where('template_id', $posting['template_id'])
|
|
->orWhere('title', $posting['title'])
|
|
->get()
|
|
->getRowArray();
|
|
|
|
$templateId = (string) ($template['template_id'] ?? $posting['template_id']);
|
|
|
|
if (!$template) {
|
|
$this->db->table('job_templates')->insert($shared + [
|
|
'template_id' => $templateId,
|
|
'version' => 1,
|
|
'is_active' => 1,
|
|
'created_by' => null,
|
|
'created_at' => $now,
|
|
'updated_at' => $now,
|
|
]);
|
|
}
|
|
|
|
if ($this->db->tableExists('job_template_versions')) {
|
|
$versionExists = $this->db->table('job_template_versions')
|
|
->where('version_id', $posting['version_id'])
|
|
->countAllResults() > 0;
|
|
|
|
if (!$versionExists) {
|
|
$this->db->table('job_template_versions')->insert($shared + [
|
|
'version_id' => $posting['version_id'],
|
|
'template_id' => $templateId,
|
|
'version' => 1,
|
|
'saved_by' => null,
|
|
'saved_at' => $now,
|
|
]);
|
|
}
|
|
}
|
|
|
|
$positionExists = $this->db->table('job_positions')
|
|
->where('position_id', $posting['position_id'])
|
|
->orWhere('title', $posting['title'])
|
|
->countAllResults() > 0;
|
|
|
|
if (!$positionExists) {
|
|
$this->db->table('job_positions')->insert($shared + [
|
|
'position_id' => $posting['position_id'],
|
|
'template_id' => $templateId,
|
|
'status' => 'draft',
|
|
'posted_by' => null,
|
|
'created_at' => $now,
|
|
'updated_at' => $now,
|
|
]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
foreach ($this->postings as $posting) {
|
|
if ($this->db->tableExists('job_positions')) {
|
|
$this->db->table('job_positions')->where('position_id', $posting['position_id'])->delete();
|
|
}
|
|
|
|
if ($this->db->tableExists('job_template_versions')) {
|
|
$this->db->table('job_template_versions')->where('version_id', $posting['version_id'])->delete();
|
|
}
|
|
|
|
if ($this->db->tableExists('job_templates')) {
|
|
$this->db->table('job_templates')->where('template_id', $posting['template_id'])->delete();
|
|
}
|
|
}
|
|
}
|
|
}
|