portal.mkgtu.ru/backend/components/ReportsPreprocessor.php

33 lines
1.1 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace backend\components;
use common\modules\abiturient\models\bachelor\BachelorApplication;
use yii\helpers\ArrayHelper;
class ReportsPreprocessor
{
public static function getHumanFriendlyIsIn1C(array $data): string
{
return ArrayHelper::getValue($data, 'from1C') ? 'есть в 1С' : 'нет в 1С';
}
public static function getHumanFriendlyApplicationStatus(array $data): string
{
return BachelorApplication::rawTranslateStatus(ArrayHelper::getValue($data, 'abit_status'));
}
public static function getHumanFriendlyApplicationDraftStatus(array $data): string
{
return BachelorApplication::rawTranslateDraftStatus(ArrayHelper::getValue($data, 'abit_draft_status'));
}
public static function preprocessRow(array $data): array
{
$data['from1C'] = ReportsPreprocessor::getHumanFriendlyIsIn1C($data);
$data['abit_status'] = ReportsPreprocessor::getHumanFriendlyApplicationStatus($data);
$data['abit_draft_status'] = ReportsPreprocessor::getHumanFriendlyApplicationDraftStatus($data);
return $data;
}
}