From 8dbdbe048dc7b48d16ea18d798475d413bb3612f 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: Tue, 9 Dec 2014 22:27:46 +0300
Subject: [PATCH] exam begin

---
 ~dev_rating/application/bootstrap.php         |   6 +
 .../classes/Controller/Teacher/Rating.php     |  12 ++
 .../application/views/teacher/exam.twig       | 105 ++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 ~dev_rating/application/views/teacher/exam.twig

diff --git a/~dev_rating/application/bootstrap.php b/~dev_rating/application/bootstrap.php
index 1a463a1a6..805324d6b 100644
--- a/~dev_rating/application/bootstrap.php
+++ b/~dev_rating/application/bootstrap.php
@@ -283,6 +283,12 @@ Route::set('teacher:rating', 'rate/<id>', array('id' => '[0-9]+'))
             'controller' => 'rating',
             'action' => 'edit'
         ));
+Route::set('teacher:exam', 'exam/<id>', array('id' => '[0-9]+'))
+        ->defaults(array(
+            'directory' => 'teacher',
+            'controller' => 'rating',
+            'action' => 'exam'
+        ));
 
         // Внутренние вызовы!
 Route::set('teacher:index', 'teacher/index')
diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php
index b746a7d77..f48a5901a 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Rating.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php
@@ -122,5 +122,17 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
 
 		$this->response->body($twig);
     }
+
+    public function action_edit()
+    {
+        $twig = Twig::factory('teacher/exam');
+        $twig->User = $this->UserInfo;
+        $id = $this->request->param('id');
+        $db = new Model_Teacher_Rating;
+
+        // Код для экзамена
+
+        $this->response->body($twig);
+    }
 }
             
\ No newline at end of file
diff --git a/~dev_rating/application/views/teacher/exam.twig b/~dev_rating/application/views/teacher/exam.twig
new file mode 100644
index 000000000..6a939f2e0
--- /dev/null
+++ b/~dev_rating/application/views/teacher/exam.twig
@@ -0,0 +1,105 @@
+{% extends 'base' %}
+
+{% block title %}Экзамен{% endblock %} {# head -> title #}
+{% block media %} {# head -> css, js #}
+	{{ HTML.script('media/js/functions.js')|raw }}
+	
+	{{ HTML.style('media/css/rating.css')|raw }}
+	{{ HTML.script('media/js/rating.js')|raw }}
+{% endblock %}
+
+{% block main_top_title %}Экзамен{% endblock %}
+{% block main_content %}
+	<h2 style="margin-left: 2.5%; font-weight: normal; color: #3399CC;">{{ SubjectName }}</h2>
+
+	<div class="groupSelectorWrap">
+		<div class="groupSelectorText">Фильтр:</div>
+		<select class="groupSelector">
+			<option value="0">Р’СЃРµ РіСЂСѓРїРїС‹</option>
+			{% for key, group in groups %}
+				<option value="{{ key }}">{{ group }}</option>
+			{% endfor %}
+		</select>
+	</div>
+	
+	<table class="studentsRate" border="0" cellspacing="0" cellpadding="0">
+		<tr class="RatingTableModulesHead">
+			<td class="title" width="150px">Модуль</td>
+			{% for i in 1..headerRate.ModulesCount %}
+				<td class="subject {% if headerRate[i].ModuleType == 'bonus' %} bonus{% endif %}" colspan="{{headerRate[i].SubmodulesCount}}" {% if headerRate[i].ModuleType == 'exam' or headerRate[i].ModuleType == 'bonus' %} rowspan="2" {% endif %}>
+					{{ headerRate[i].ModuleTitle }}
+				</td>
+			{% endfor %}
+			<td class="subject" rowspan="3">Итог</td>
+		</tr>
+		<tr class="RatingTableSubmodulesHead">
+			{% set CellCount = 0 %}
+			{% set col = 0 %}
+			<td class="title">Мероприятие</td>
+			{% for i in 1..headerRate.ModulesCount %}
+				{% set CellCount = CellCount + headerRate[i].SubmodulesCount %}
+				{% if headerRate[i]['ModuleType'] == 'regular' %}
+					{% for j in 1..headerRate[i].SubmodulesCount %}
+						{% set col = col + 1 %}
+						<td class="subject col_{{ col }}">{{ headerRate[i][j].Title }}</td>
+					{% endfor %}
+				{% endif %}
+			{% endfor %}
+		</tr>
+		<tr class="RatingTableSubmodulesHeadMaxRate">
+			{% set CellCount = 0 %}
+			{% set col = 0 %}
+			<td class="title">Макс. балл</td>
+			{% for i in 1..headerRate.ModulesCount %}
+				{% set CellCount = CellCount + headerRate[i].SubmodulesCount %}
+				{% for j in 1..headerRate[i].SubmodulesCount %}
+					{% if headerRate[i].ModuleType == "exam" %}
+						<td class="subject" id="{{ headerRate[i][j].SubmoduleID }}">{{ headerRate[i][j].MaxRate }}</td>
+					{% else %}
+						{% set col = col + 1 %}
+						<td class="subject col_{{ col }}" id="{{ headerRate[i][j].SubmoduleID }}">{{ headerRate[i][j].MaxRate }}
+							<input type="hidden" class="MaxRate" value="{{ headerRate[i][j].MaxRate }}">
+						</td>
+					{% endif %}
+				{% endfor %}
+			{% endfor %}
+		</tr>
+		{% set row = 0 %}
+		{% for group in rateTable %}
+			<tr class="group {{ group.GroupID }}">
+				<td colspan="{{ CellCount + 2 }}">{% if group.isAttached == 1 %} {{ group.GradeTitle }} {% endif %}{{ group.GroupNum }} РіСЂСѓРїРїР°</td>
+			</tr>
+			{% for student in group.Students %}
+				{% set row = row + 1 %}
+				{% set j = 0 %}
+				<tr id="{{ row }}" class="{{ group.GroupID }}">
+					<td class="student" id="{{ student.ID }}">{{ student.Last }} {{ student.First }}</td>
+					{% for i in 1..CellCount %}
+						{% set j = j + 1 %}
+						{% if examSubmoduleID != student.Rates[i].SubmoduleID %}
+							<td id="{{ j }}" class="rateCell">
+								<input type="text" value="{{ student.Rates[i].Rate }}">
+							</td>
+						{% else %}
+							{% set j = j - 1 %}
+							<td class="rateCell notChange">
+								<p>{{ student.Rates[i].Rate }}</p>
+							</td>
+						{% endif %}
+					{% endfor %}
+					<td class="row_{{ row }} col_{{ i + 1 }} RateResult">{{ student.RateResult }}</td>
+				</tr>
+			{% endfor %}
+		{% endfor %}
+	</table>
+	<div id="tdInfo_wrap">
+		<div id="tdInfo">
+			<span id="student">Студент: <b></b></span>
+			<span id="submodule">Мероприятие: <b></b></span>
+			<span id="maxRate">Максимальный балл: <b></b></span>
+		</div>
+	</div>
+	<div id="hidden_div">
+		{ "studyGroupID": "{{ studyGroupID }}" }
+	</div>
+{% endblock %}
\ No newline at end of file
-- 
GitLab