diff --git a/~dev_rating/application/classes/Controller/Office/Students.php b/~dev_rating/application/classes/Controller/Office/Students.php index 1d908964f5f3045c31bcc67edba53f0daefca40a..5d42b458a2f002d8a7c8b0e4863ac9debc1df8f2 100644 --- a/~dev_rating/application/classes/Controller/Office/Students.php +++ b/~dev_rating/application/classes/Controller/Office/Students.php @@ -33,15 +33,14 @@ class Controller_Office_Students extends Controller_Environment_Office $errors = []; if (!empty($_FILES['students']) && $this->request->method() == 'POST') { - $facultyID = ($this->user->isAdmin()) ? - $_POST['facultyID'] : - $this->user->Faculty->ID; + $facultyID = $this->user->isAdmin() ? $_POST['facultyID'] : $this->user->Faculty->ID; $file = $_FILES['students']['tmp_name']; $errors = FileParser::uploadStudents($file, $facultyID); } $this->twig->set([ 'Errors' => $errors, + 'Uploaded' => isset($file) && empty($errors), 'Faculties' => $this->user->isAdmin() ? Model_Faculties::load() : [], ])->set_filename(static::OFFICE . 'students/upload'); } diff --git a/~dev_rating/application/views/office/students/upload.twig b/~dev_rating/application/views/office/students/upload.twig index 6cf531f1a29f8545af2f2d4616d42155b4fc4ec7..ab6a57a899d4e967198891a7e6c2dee8bc36d783 100644 --- a/~dev_rating/application/views/office/students/upload.twig +++ b/~dev_rating/application/views/office/students/upload.twig @@ -28,10 +28,15 @@ </div> </form> - {% if Errors is not empty %} - <script> - EventInspector.error('Загружено с ошибками!'); + {% if Uploaded %} + <script>$(function() { + EventInspector.success('Успешно загружено!'); + }); </script> + {% endif %} + + {% if Errors is not empty %} + <script>$(function() { EventInspector.error('Загружено с ошибками!'); });</script> {% set res %} {% for item in Errors %} diff --git a/~dev_rating/application/views/office/subjects/upload.twig b/~dev_rating/application/views/office/subjects/upload.twig index 13360d6ceb91e6514711d5aedd56e48065930c11..e1c36076a10089c03db4b18e8015b8977216673c 100644 --- a/~dev_rating/application/views/office/subjects/upload.twig +++ b/~dev_rating/application/views/office/subjects/upload.twig @@ -59,9 +59,12 @@ </form> {% if UploadingResult is not empty %} - <script>({{ UploadingResult.ErrorsCount }}) - ? EventInspector.error('Загружено с ошибками!') - : EventInspector.success('Загружено успешно!'); + <script> + $(function() { + ({{ UploadingResult.ErrorsCount }}) + ? EventInspector.error('Загружено с ошибками!') + : EventInspector.success('Загружено успешно!'); + }); </script> <p>