diff --git a/~dev_rating/application/classes/Controller/Office/Students.php b/~dev_rating/application/classes/Controller/Office/Students.php index 2c1c45c34843cefee801c7cc216ad4a5e489948a..9b14c4b1a85ad4bcc4d547d5ed955e374c3f85db 100644 --- a/~dev_rating/application/classes/Controller/Office/Students.php +++ b/~dev_rating/application/classes/Controller/Office/Students.php @@ -33,7 +33,9 @@ class Controller_Office_Students extends Controller_Environment_Office $errors = []; if (!empty($_FILES['students']) && $this->request->method() == 'POST') { - $facultyID = User::instance()->Faculty->ID; + $facultyID = ($this->user->isAdmin()) ? + $_POST['facultyID'] : + $this->user->Faculty->ID; $file = $_FILES['students']['tmp_name']; $errors = FileParser::uploadStudents($file, $facultyID); } diff --git a/~dev_rating/application/views/office/students/upload.twig b/~dev_rating/application/views/office/students/upload.twig index 7e42c3f7b182e66614afa00d842079d1a9033916..83b12c468a68f3953edf9815098a8905ec7e966e 100644 --- a/~dev_rating/application/views/office/students/upload.twig +++ b/~dev_rating/application/views/office/students/upload.twig @@ -19,6 +19,17 @@ <p><pre>Р¤РРћ;РљСѓСЂСЃ;Группа;Уровень подготовки;Специальность</pre></p> <p>Уровень подготовки - РѕРґРЅРѕ РёР· следующих значений: Бакалавр, Специалист, Магистр</p> <form enctype="multipart/form-data" action="" method="POST"> + {% if User.isAdmin %} + <div class="goodClearFix defaultForm marginBetween"> + <select id="facultySelect" name="facultyID" class="defaultForm"> + <option value="0" selected="selected">— Выберите подразделение ЮФУ —</option> + {% for row in Faculties %} + <option value="{{ row.ID }}">{{ row.Name }} ({{ row.Abbr }})</option> + {% endfor %} + </select> + </div> + {% endif %} + <div class="goodClearFix"> <div class="defaultForm FLeft"><input name="students" class="defaultForm FullWidth" type="file"></div> <div class="defaultForm FRight"><input type="submit" class="defaultForm GreenButton P2Width noMargin" value="Загрузить"></div>