From 365957a174b9f1e7b94ae518b04748f522dd6969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A8=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D0=BC=D0=BE=D0=B2?= <solidovic@gmail.com> Date: Thu, 25 Dec 2014 14:23:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=83=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B4=D0=B5=D0=BA=D0=B0=D0=BD=D0=B0=D1=82=D0=B0=20(..?= =?UTF-8?q?./~dev=5Frating/statement)...=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B9?= =?UTF-8?q?=D1=82=D0=B8=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D1=83=20=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20=D0=BB?= =?UTF-8?q?=D1=8E=D0=B1=D0=BE=D0=B9=20=D0=BF=D1=80=D0=B5=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=20(=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=B5=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BC)!!!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ~dev_rating/application/bootstrap.php | 8 +++ .../classes/Controller/DeansOffice/Index.php | 14 +++++ .../classes/Controller/Handler/GetData.php | 27 +++++++++ .../classes/Controller/Handler/readme.txt | 2 + .../application/views/DeansOffice/index.twig | 60 +++++++++++++++++++ ~dev_rating/media/js/GetData.js | 52 ++++++++++++++++ 6 files changed, 163 insertions(+) create mode 100644 ~dev_rating/application/classes/Controller/DeansOffice/Index.php create mode 100644 ~dev_rating/application/classes/Controller/Handler/GetData.php create mode 100644 ~dev_rating/application/classes/Controller/Handler/readme.txt create mode 100644 ~dev_rating/application/views/DeansOffice/index.twig create mode 100644 ~dev_rating/media/js/GetData.js diff --git a/~dev_rating/application/bootstrap.php b/~dev_rating/application/bootstrap.php index 55cb70cd4..c356dc4f0 100644 --- a/~dev_rating/application/bootstrap.php +++ b/~dev_rating/application/bootstrap.php @@ -332,4 +332,12 @@ Route::set('admin:common', 'admin(/<controller>(/<action>(/<param1>(:<param2>))) 'directory' => 'admin', 'controller' => 'index', 'action' => 'index' + )); + +/* --------------- Деканат (Ведомости) ---------------- */ +Route::set('deans_office:statement', 'statement') + ->defaults(array( + 'directory' => 'DeansOffice', + 'controller' => 'index', + 'action' => 'index' )); \ No newline at end of file diff --git a/~dev_rating/application/classes/Controller/DeansOffice/Index.php b/~dev_rating/application/classes/Controller/DeansOffice/Index.php new file mode 100644 index 000000000..bc889c9a2 --- /dev/null +++ b/~dev_rating/application/classes/Controller/DeansOffice/Index.php @@ -0,0 +1,14 @@ +<?php defined('SYSPATH') or die('No direct script access.'); + +class Controller_DeansOffice_Index extends Controller_UserEnvi { + + public function action_index() + { + $twig = Twig::factory('DeansOffice/index'); + $model = new Model_Teacher_Map; + + $twig->GradesList = DataArray::factory('Grades')->common()->asArray(); + + $this->response->body($twig); + } +} \ No newline at end of file diff --git a/~dev_rating/application/classes/Controller/Handler/GetData.php b/~dev_rating/application/classes/Controller/Handler/GetData.php new file mode 100644 index 000000000..8894c24d0 --- /dev/null +++ b/~dev_rating/application/classes/Controller/Handler/GetData.php @@ -0,0 +1,27 @@ +<?php defined('SYSPATH') or die('No direct script access.'); + +class Controller_Handler_GetData extends Controller_Handler +{ + + public function before() { + //$this->model = new Model_Teacher_Rating; + $this->setAccessLevel(self::ACCESS_USER); + parent::before(); + } + + // Получить СЃРїРёСЃРѕРє РіСЂСѓРїРї РїРѕ ID РєСѓСЂСЃР° + public function action_GetGroups() + { + $data['success'] = false; + $this->post -> rule('GradeID', 'not_empty') + -> rule('GradeID', 'digit'); + if($this->post->check()) { + $data['data'] = DataArray::factory('StudyGroups')->ordByGroups( + $this->post->offsetGet('GradeID'), $this->user['FacultyID'] )->asArray(); + + $data['success'] = true; + } + $this->response->body(json_encode($data)); + } + +} \ No newline at end of file diff --git a/~dev_rating/application/classes/Controller/Handler/readme.txt b/~dev_rating/application/classes/Controller/Handler/readme.txt new file mode 100644 index 000000000..228867ba6 --- /dev/null +++ b/~dev_rating/application/classes/Controller/Handler/readme.txt @@ -0,0 +1,2 @@ +FileCreator - создание ведомостей +GetData - Получить список групп, курсов, предметов и тд \ No newline at end of file diff --git a/~dev_rating/application/views/DeansOffice/index.twig b/~dev_rating/application/views/DeansOffice/index.twig new file mode 100644 index 000000000..c581837a3 --- /dev/null +++ b/~dev_rating/application/views/DeansOffice/index.twig @@ -0,0 +1,60 @@ +{% extends 'base' %} + +{% block title %}Деканат > Ведомости{% endblock %} +{% block media %} {# head -> css, js #} + {{ HTML.script('media/js/jquery.fileDownload.js')|raw }} + + {{ HTML.style('media/css/discipline.css')|raw }} + {{ HTML.script('media/js/GetData.js')|raw }} +{% endblock %} + +{% block main_top_title %}Деканат > Ведомости{% endblock %} +{% block main_content %} + + <div style="text-align: center"> + <p><b>Шаг 1. Выберите форму аттестации</b></p> + <div class="LayerSection"> + <div class="itemBlock"> + <div class="title">Форма контроля:</div> + <div class="field"> + <div class="ExamTypeDiv"> + <input id="ExamType" name="ExamType" type="radio" value="exam"> Ркзамен + </div> + <div class="ExamTypeDiv"> + <input id="ExamType" name="ExamType" type="radio" value="credit"> Зачет + </div> + </div> + </div> + </div> + + <p><b>Шаг 2. Выберите РєСѓСЂСЃ</b></p> + <div class="LayerSection"> + <div class="itemBlock"> + <div class="title">РљСѓСЂСЃ:</div> + <div class="field"> + <select class="SelectGrade default_select" id="SelectGrade"> + <option>-РќРµ выбран-</option> + {% for Grade in GradesList %} + <option value="{{ Grade.ID }}" >{{ Grade.Title }}</option> + {% endfor %} + </select> + </div> + </div> + </div> + + <p><b>Шаг 3. Выберите РіСЂСѓРїРїСѓ</b></p> + <div class="LayerSection"> + <div class="itemBlock"> + <div class="title">Группа:</div> + <div class="field"> + <select class="SelectGroup default_select" id="SelectGroup" disabled> + <option>-РќРµ выбрана-</option> + </select> + </div> + </div> + <button class="default_BlueButton" id="DownloadStatement" disabled>Скачать</button> + </div> + + </div> + +{% endblock %} diff --git a/~dev_rating/media/js/GetData.js b/~dev_rating/media/js/GetData.js new file mode 100644 index 000000000..b6f2a1dba --- /dev/null +++ b/~dev_rating/media/js/GetData.js @@ -0,0 +1,52 @@ +var $ = jQuery; +$(function() { + + //Получить СЃРїРёСЃРѕРє РіСЂСѓРїРї РїРѕ ID РєСѓСЂСЃР° + $("#SelectGrade").change(function() { + var gradeID = $(this).val(); + if (gradeID >= 0) + { + $.post( + g_URLdir + "handler/GetData/GetGroups", + { + "GradeID": gradeID + }, + function(d){ + d = $.parseJSON(d); + if(d.success === true) { + console.log(d.data); + var selectGroup = $("#SelectGroup"); + var i = 0; + selectGroup.html("<option>-РќРµ выбрана-</option>"); + for (i in d.data) + { + group = d.data[i]; + selectGroup.append("<option value='"+ group.ID +"'>Группа "+ group.GroupNum +" ("+ group.SpecAbbr +")</option>"); + selectGroup.removeAttr("disabled"); + } + $("#DownloadStatement").removeAttr("disabled"); + } + } + ); + } + }); + + // Скачать ведомость + $('body').on('click', '#DownloadStatement', function(){ + $.fileDownload( g_URLdir + 'handler/FileCreator/GenerateFullStatement', { + httpMethod: "POST", + data: + { + "GroupID": parseInt($("#SelectGroup").val()), + "ExamType": $("#ExamType").val() + }, + successCallback: function () { + + }, + failCallback: function () { + + } + }); + }); + +}); \ No newline at end of file -- GitLab