fix logs issues
This commit is contained in:
@@ -182,7 +182,7 @@ class ExamDraftController extends BaseController
|
||||
}
|
||||
|
||||
$classSectionId = (int) ($this->request->getPost('class_section_id') ?? session()->get('class_section_id') ?? 0);
|
||||
$examType = trim((string) $this->request->getPost('exam_type'));
|
||||
$examType = $this->normalizeExamType($this->request->getPost('exam_type'));
|
||||
$authorComment = trim((string) $this->request->getPost('author_comment'));
|
||||
|
||||
if ($classSectionId <= 0) {
|
||||
@@ -226,7 +226,11 @@ class ExamDraftController extends BaseController
|
||||
->orderBy('version', 'DESC')
|
||||
->first();
|
||||
|
||||
$title = $examType ?: 'Exam Draft';
|
||||
if ($examType === '') {
|
||||
return redirect()->back()->withInput()->with('error', 'Select an exam type before submitting.');
|
||||
}
|
||||
|
||||
$title = $examType;
|
||||
|
||||
if ($saveAsDraft) {
|
||||
if ($teacherFile === null && (empty($existingDraft) || empty($this->draftTeacherFile($existingDraft)))) {
|
||||
@@ -235,7 +239,7 @@ class ExamDraftController extends BaseController
|
||||
if (!empty($existingDraft) && strtolower((string) ($existingDraft['status'] ?? '')) === 'draft') {
|
||||
$draftRowId = (int) ($existingDraft['id'] ?? 0);
|
||||
$updateDraft = [
|
||||
'exam_type' => $examType ?: null,
|
||||
'exam_type' => $examType,
|
||||
'draft_title' => $title,
|
||||
'author_comment' => $authorComment === '' ? null : $authorComment,
|
||||
'status' => 'draft',
|
||||
@@ -263,7 +267,7 @@ class ExamDraftController extends BaseController
|
||||
'class_section_id' => $classSectionId,
|
||||
'semester' => $this->semester,
|
||||
'school_year' => $this->schoolYear,
|
||||
'exam_type' => $examType ?: null,
|
||||
'exam_type' => $examType,
|
||||
'draft_title' => $title,
|
||||
'author_comment' => $authorComment === '' ? null : $authorComment,
|
||||
'status' => 'draft',
|
||||
@@ -280,9 +284,6 @@ class ExamDraftController extends BaseController
|
||||
}
|
||||
|
||||
$existingStatus = strtolower((string) ($existingDraft['status'] ?? ''));
|
||||
if ($examType === '') {
|
||||
return redirect()->back()->withInput()->with('error', 'Select an exam type before submitting.');
|
||||
}
|
||||
if ($teacherFile === null) {
|
||||
return redirect()->back()->withInput()->with('error', 'Upload a DOC/DOCX file to submit the exam draft.');
|
||||
}
|
||||
@@ -291,7 +292,7 @@ class ExamDraftController extends BaseController
|
||||
if (!empty($existingDraft) && $existingStatus === 'submitted') {
|
||||
$draftRowId = (int) ($existingDraft['id'] ?? 0);
|
||||
$updateSubmit = [
|
||||
'exam_type' => $examType ?: null,
|
||||
'exam_type' => $examType,
|
||||
'draft_title' => $title,
|
||||
'author_comment' => $authorComment === '' ? null : $authorComment,
|
||||
'status' => 'submitted',
|
||||
@@ -322,7 +323,7 @@ class ExamDraftController extends BaseController
|
||||
'class_section_id' => $classSectionId,
|
||||
'semester' => $this->semester,
|
||||
'school_year' => $this->schoolYear,
|
||||
'exam_type' => $examType ?: null,
|
||||
'exam_type' => $examType,
|
||||
'draft_title' => $title,
|
||||
'author_comment' => $authorComment === '' ? null : $authorComment,
|
||||
'status' => 'submitted',
|
||||
@@ -499,7 +500,7 @@ class ExamDraftController extends BaseController
|
||||
$classSectionIds = array_values(array_filter(array_map('intval', $classSectionIds)));
|
||||
$schoolYear = trim((string) ($this->request->getPost('school_year') ?? $this->schoolYear));
|
||||
$semester = trim((string) ($this->request->getPost('semester') ?? $this->semester));
|
||||
$examType = trim((string) $this->request->getPost('exam_type'));
|
||||
$examType = $this->normalizeExamType($this->request->getPost('exam_type'));
|
||||
|
||||
if (empty($classSectionIds)) {
|
||||
return redirect()->back()->withInput()->with('error', 'Select at least one class section.');
|
||||
@@ -510,6 +511,9 @@ class ExamDraftController extends BaseController
|
||||
if ($semester === '') {
|
||||
return redirect()->back()->withInput()->with('error', 'Semester is required.');
|
||||
}
|
||||
if ($examType === '') {
|
||||
return redirect()->back()->withInput()->with('error', 'Exam type is required.');
|
||||
}
|
||||
|
||||
$file = $this->request->getFile('old_exam_file');
|
||||
if (!$file || !$file->isValid()) {
|
||||
@@ -534,8 +538,8 @@ class ExamDraftController extends BaseController
|
||||
$this->authorIdColumn => $adminId, // store under admin user since legacy uploads are admin-only
|
||||
'semester' => ucfirst(strtolower($semester)),
|
||||
'school_year' => $schoolYear,
|
||||
'exam_type' => $examType === '' ? null : $examType,
|
||||
'draft_title' => $examType === '' ? 'Legacy Exam' : $examType,
|
||||
'exam_type' => $examType,
|
||||
'draft_title' => $examType,
|
||||
'author_comment' => null,
|
||||
'final_file' => $stored,
|
||||
'final_filename' => $file->getClientName(),
|
||||
@@ -646,13 +650,18 @@ class ExamDraftController extends BaseController
|
||||
$baseVersion = 1;
|
||||
}
|
||||
$reviewRevision = $this->nextReviewRevision($draft, $baseVersion);
|
||||
$reviewExamType = $this->normalizeExamType($draft['exam_type'] ?? $draft['draft_title'] ?? '');
|
||||
if ($reviewExamType === '') {
|
||||
return redirect()->back()->with('error', 'This draft is missing an exam type. Update the exam type before reviewing.');
|
||||
}
|
||||
|
||||
$newRow = [
|
||||
$this->authorIdColumn => $this->draftTeacherId($draft),
|
||||
'class_section_id' => (int) ($draft['class_section_id'] ?? 0),
|
||||
'semester' => (string) ($draft['semester'] ?? ''),
|
||||
'school_year' => (string) ($draft['school_year'] ?? ''),
|
||||
'exam_type' => $draft['exam_type'] ?? null,
|
||||
'draft_title' => $draft['draft_title'] ?? $draft['exam_type'] ?? 'Exam Draft',
|
||||
'exam_type' => $reviewExamType,
|
||||
'draft_title' => $draft['draft_title'] ?? $reviewExamType,
|
||||
'author_comment' => $draft['author_comment'] ?? null,
|
||||
'status' => $status,
|
||||
'reviewed_at' => $update['reviewed_at'],
|
||||
@@ -1309,7 +1318,7 @@ class ExamDraftController extends BaseController
|
||||
|
||||
// Attempt conversion via LibreOffice if available
|
||||
$cmd = 'soffice --headless --convert-to pdf --outdir ' . escapeshellarg($targetDir) . ' ' . escapeshellarg($sourcePath) . ' 2>/dev/null';
|
||||
@exec($cmd);
|
||||
@\exec($cmd);
|
||||
|
||||
return is_file($targetPath) ? basename($targetPath) : null;
|
||||
}
|
||||
@@ -1358,6 +1367,11 @@ class ExamDraftController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
private function normalizeExamType($value): string
|
||||
{
|
||||
return trim((string) $value);
|
||||
}
|
||||
|
||||
private function copyDraftToFinal(string $draftFilename): ?string
|
||||
{
|
||||
$source = $this->fullUploadPath(self::TEACHER_UPLOAD_DIR, $draftFilename);
|
||||
|
||||
@@ -13,17 +13,19 @@
|
||||
</a>
|
||||
</div>
|
||||
<!-- Search Form -->
|
||||
<!--form method="get" action="<--?= base_url('admin/paypal-transactions') ?>" class="mb-3">
|
||||
<--?= csrf_field(); ?>
|
||||
<!--
|
||||
<form method="get" action="<?= base_url('admin/paypal-transactions') ?>" class="mb-3">
|
||||
<?= csrf_field(); ?>
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" value="<--?= esc($keyword) ?>" class="form-control"
|
||||
<input type="text" name="q" value="<?= esc($keyword) ?>" class="form-control"
|
||||
placeholder="Search by transaction ID, email, order ID, or event type">
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
<--?php if ($keyword): ?>
|
||||
<a href="<--?= base_url('admin/paypal-transactions') ?>" class="btn btn-secondary">Clear</a>
|
||||
<--?php endif; ?>
|
||||
<?php if ($keyword): ?>
|
||||
<a href="<?= base_url('admin/paypal-transactions') ?>" class="btn btn-secondary">Clear</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form-->
|
||||
</form>
|
||||
-->
|
||||
|
||||
<!-- Transactions Table -->
|
||||
<table id="myTable" class="display table table-striped">
|
||||
|
||||
@@ -80,10 +80,10 @@
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= esc($e['approver_firstname'] . ' ' . $e['approver_lastname'] ?? '-') ?></td>
|
||||
<!--td><--?= esc($e['status_reason'] ?? '-') ?></td-->
|
||||
<!-- <td><?= esc($e['status_reason'] ?? '-') ?></td> -->
|
||||
<td>
|
||||
<?php if ($e['receipt_path']): ?>
|
||||
<!--a href="<--?= base_url('writable/' . $e['receipt_path']) ?>" target="_blank">View</a-->
|
||||
<!-- <a href="<?= base_url('writable/' . $e['receipt_path']) ?>" target="_blank">View</a> -->
|
||||
<a href="<?= site_url('receipts/' . $e['receipt_path']) ?>" target="_blank">View receipt</a>
|
||||
<?php else: ?>
|
||||
N/A
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
<strong>Enrollment deadline:</strong>
|
||||
<?= $lastDayOfRegistration ? local_date($lastDayOfRegistration, 'm-d-Y') : 'N/A' ?>
|
||||
</div>
|
||||
<!--div><strong>Withdrawal:</strong> <--?= esc($withdrawalDeadline ?? 'N/A') ?></div-->
|
||||
<!-- <div><strong>Withdrawal:</strong> <?= esc($withdrawalDeadline ?? 'N/A') ?></div> -->
|
||||
<hr class="my-2">
|
||||
<?php if (!empty($enrollments)): ?>
|
||||
<ul class="mb-0 ps-3">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!--meta name="csrf-token" content="<--?= csrf_hash() ?>"-->
|
||||
<!-- <meta name="csrf-token" content="<?= csrf_hash() ?>"> -->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Al Rahma Sunday School</title>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Meta Information -->
|
||||
<!--meta name="csrf-token" content="<--?= csrf_hash() ?>"-->
|
||||
<!-- <meta name="csrf-token" content="<?= csrf_hash() ?>"> -->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<!-- Prevent back/forward cache issues on management pages -->
|
||||
|
||||
@@ -11,7 +11,7 @@ $disableEmergencyBtn = count($emergencies) >= $maxEmergency;
|
||||
<div class="alert alert-info mt-2">You've reached the maximum number of students (<?= $maxChilds ?>).</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($disableEmergencyBtn): ?>
|
||||
<!--div class="alert alert-info mt-2">You've reached the maximum number of emergency contacts (<--?= $maxEmergency ?>).</div-->
|
||||
<!-- <div class="alert alert-info mt-2">You've reached the maximum number of emergency contacts (<?= esc((string) $maxEmergency) ?>).</div> -->
|
||||
<?php endif; ?>
|
||||
<?php if (session()->getFlashdata('error')): ?>
|
||||
<div class="alert alert-danger">
|
||||
|
||||
@@ -22,16 +22,18 @@
|
||||
<input type="tel" name="phone" class="form-control" value="<?= esc($user['phone'] ?? '') ?>" placeholder="Enter phone number">
|
||||
</div>
|
||||
|
||||
<!--div class="mb-3">
|
||||
<!--
|
||||
<div class="mb-3">
|
||||
<label>Role</label>
|
||||
<select name="role_id" class="form-control" required>
|
||||
<--?php foreach ($roles as $role): ?>
|
||||
<option value="<--?= $role['id'] ?>" <--?= $roleId == $role['id'] ? 'selected' : '' ?>>
|
||||
<--?= esc($role['name']) ?>
|
||||
<?php foreach ($roles as $role): ?>
|
||||
<option value="<?= $role['id'] ?>" <?= $roleId == $role['id'] ? 'selected' : '' ?>>
|
||||
<?= esc($role['name']) ?>
|
||||
</option>
|
||||
<--?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</div-->
|
||||
</div>
|
||||
-->
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!--a href="<--?= site_url('staff/create') ?>" class="btn btn-primary mb-3">Add Staff</a-->
|
||||
<!-- <a href="<?= site_url('staff/create') ?>" class="btn btn-primary mb-3">Add Staff</a> -->
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="myTable" class="display table table-striped table-bordered table-hover w-100" style="width:100%">
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
<div id="collapse<?= $index ?>" class="collapse <?= $index === 0 ? 'show' : '' ?>" aria-labelledby="heading<?= $index ?>" data-bs-parent="#classAccordion">
|
||||
<div class="card-body">
|
||||
|
||||
<!--h5>Semester: <--?= esc($classSection['semester'] ?? '') ?></h5-->
|
||||
<!--h5>School Year: <--?= esc($classSection['school_year'] ?? '') ?></h5-->
|
||||
<!--p><--?= esc($classSection['description'] ?? '') ?></p-->
|
||||
<!-- <h5>Semester: <?= esc($classSection['semester'] ?? '') ?></h5> -->
|
||||
<!-- <h5>School Year: <?= esc($classSection['school_year'] ?? '') ?></h5> -->
|
||||
<!-- <p><?= esc($classSection['description'] ?? '') ?></p> -->
|
||||
|
||||
<?php if (!empty($classSection['parents'])): ?>
|
||||
<div class="table-responsive">
|
||||
@@ -92,13 +92,15 @@
|
||||
<option value="0" <?= ((string)$pm === '0') ? 'selected' : '' ?>>No</option>
|
||||
</select>
|
||||
</td>
|
||||
<!--td>
|
||||
<--?php if (!empty($p['primary_email'])): ?>
|
||||
<a href="mailto:<--?= esc($p['primary_email']) ?>"><--?= esc($p['primary_email']) ?></a>
|
||||
<--?php else: ?>
|
||||
<!--
|
||||
<td>
|
||||
<?php if (!empty($p['primary_email'])): ?>
|
||||
<a href="mailto:<?= esc($p['primary_email']) ?>"><?= esc($p['primary_email']) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">—</span>
|
||||
<--?php endif; ?>
|
||||
</td-->
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
-->
|
||||
<td><?= esc($p['second_name']) ?></td>
|
||||
<td>
|
||||
<?php if (!empty($p['second_phone'])): ?>
|
||||
@@ -109,13 +111,15 @@
|
||||
<span class="text-muted">—</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<!--td>
|
||||
<--?php if (!empty($p['second_email'])): ?>
|
||||
<--a href="mailto:<--?= esc($p['second_email']) ?>"><--?= esc($p['second_email']) ?></a>
|
||||
<--?php else: ?>
|
||||
<--span class="text-muted">—</span>
|
||||
<--?php endif; ?>
|
||||
</td-->
|
||||
<!--
|
||||
<td>
|
||||
<?php if (!empty($p['second_email'])): ?>
|
||||
<a href="mailto:<?= esc($p['second_email']) ?>"><?= esc($p['second_email']) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">—</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
-->
|
||||
|
||||
<td class="text-center">
|
||||
<?php if (!empty($p['second_id'])): ?>
|
||||
|
||||
Reference in New Issue
Block a user