mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
normalize-logging
This commit is contained in:
@@ -20,6 +20,8 @@ class DB
|
||||
|
||||
}
|
||||
|
||||
const ELOQUENT_CONNECTION_NAME = 'default';
|
||||
|
||||
public function setDriver(DBInterface $driver)
|
||||
{
|
||||
$this->driver = $driver;
|
||||
|
||||
@@ -11,33 +11,29 @@ class Exam
|
||||
{
|
||||
global $lang_functions;
|
||||
$examRep = new ExamRepository();
|
||||
$userExams = $examRep->listUserExamProgress($uid);
|
||||
if ($userExams->isEmpty()) {
|
||||
$userExam = $examRep->getUserExamProgress($uid);
|
||||
if (empty($userExam)) {
|
||||
return '';
|
||||
}
|
||||
$htmlArr = [];
|
||||
foreach ($userExams as $userExam) {
|
||||
$exam = $userExam->exam;
|
||||
$row = [];
|
||||
$row[] = sprintf('%s:%s', $lang_functions['exam_name'], $exam->name);
|
||||
$row[] = sprintf('%s:%s ~ %s', $lang_functions['exam_time_range'], $exam->begin, $exam->end);
|
||||
foreach ($exam->indexes as $key => $index) {
|
||||
if (isset($index['checked']) && $index['checked']) {
|
||||
$requireValue = $index['require_value'];
|
||||
$currentValue = $userExam->progress_value[$index['index']] ?? 0;
|
||||
$unit = ExamModel::$indexes[$index['index']]['unit'] ?? '';
|
||||
$row[] = sprintf(
|
||||
'%s:%s, Require:%s %s, Current:%s %s, Result:%s',
|
||||
$lang_functions['exam_index'] . ($key + 1),
|
||||
ExamModel::$indexes[$index['index']]['name'] ?? '',
|
||||
$requireValue, $unit,
|
||||
$currentValue, $unit,
|
||||
$currentValue >= $requireValue ? 'Done!' : 'Not done!'
|
||||
);
|
||||
}
|
||||
$exam = $userExam->exam;
|
||||
$row = [];
|
||||
$row[] = sprintf('%s:%s', $lang_functions['exam_name'], $exam->name);
|
||||
$row[] = sprintf('%s:%s ~ %s', $lang_functions['exam_time_range'], $exam->begin, $exam->end);
|
||||
foreach ($exam->indexes as $key => $index) {
|
||||
if (isset($index['checked']) && $index['checked']) {
|
||||
$requireValue = $index['require_value'];
|
||||
$currentValue = $userExam->progress[$index['index']] ?? 0;
|
||||
$unit = ExamModel::$indexes[$index['index']]['unit'] ?? '';
|
||||
$row[] = sprintf(
|
||||
'%s:%s, %s:%s %s, %s:%s %s, %s:%s',
|
||||
$lang_functions['exam_index'] . ($key + 1), ExamModel::$indexes[$index['index']]['name'] ?? '',
|
||||
$lang_functions['exam_require'], $requireValue, $unit,
|
||||
$lang_functions['exam_progress_current'], $currentValue, $unit,
|
||||
$lang_functions['exam_progress_result'],
|
||||
$currentValue >= $requireValue ? $lang_functions['exam_progress_result_pass_yes'] : $lang_functions['exam_progress_result_pass_no']
|
||||
);
|
||||
}
|
||||
$htmlArr[] = implode("\n", $row);
|
||||
}
|
||||
return nl2br(implode("\n\n", $htmlArr));
|
||||
return nl2br(implode("\n", $row));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user