From 19022d322660d405f4cbaae79f7fb0de7a2c5ff3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A0=D1=83=D0=B4?=
 =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D1=86?= <andrey.rudenets@gmail.com>
Date: Sun, 31 Aug 2014 00:52:54 +0400
Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BB=D0=B0=D0=B2=D0=BD=D0=B0=D1=8F=20?=
 =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=20=D1=81=D1=82?=
 =?UTF-8?q?=D1=83=D0=B4=D0=B5=D0=BD=D1=82=D0=B0=20-=20=D1=80=D0=B5=D1=84?=
 =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../classes/Controller/Student/Index.php      | 22 +++++++++++++++----
 .../classes/Controller/Student/Profile.php    | 11 ----------
 .../application/views/student/index.twig      | 15 +++++++------
 ~dev_rating/media/css/results.css             |  7 +++++-
 4 files changed, 32 insertions(+), 23 deletions(-)
 delete mode 100644 ~dev_rating/application/classes/Controller/Student/Profile.php

diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php
index c17a7d6fe..568ed6683 100644
--- a/~dev_rating/application/classes/Controller/Student/Index.php
+++ b/~dev_rating/application/classes/Controller/Student/Index.php
@@ -12,14 +12,12 @@ class Controller_Student_Index extends Controller_UserEnvi {
         foreach($disciplines as $row)
         {
             $i++;
+            $disciplinesHandled[$i]['ID'] = $row['DisciplineID'];
             if($row['ExamType'] == 'exam')
                 $disciplinesHandled[$i]['Control'] = 'Экзамен';
             elseif($row['ExamType'] == 'credit')
                 $disciplinesHandled[$i]['Control'] = 'Зачет';
-            $disciplinesHandled[$i]['Teacher'] = $row['TeacherLast'].' '.UTF8::substr($row['TeacherFirst'], 0, 1).'. ';
-            if(!empty($row['TeacherSecond']))
-                $disciplinesHandled[$i]['Teacher'] .= UTF8::substr($row['TeacherSecond'], 0, 1).'.';
-            $disciplinesHandled[$i]['ID'] = $row['SubjectID'];
+            $disciplinesHandled[$i]['Teachers'] = $this->getTeachersForDiscipline($row['DisciplineID']);
             $disciplinesHandled[$i]['Title'] = $row['SubjectName'];
             $disciplinesHandled[$i]['Rate'] = $row['Rate'];
             $disciplinesHandled[$i]['MaxRate'] = $row['MaxCurrentRate'];
@@ -29,6 +27,22 @@ class Controller_Student_Index extends Controller_UserEnvi {
         }
         $this->response->body($twig);
     }
+    
+    protected function getTeachersForDiscipline($id) {
+        $model = new Model_Student;
+        $teachers = $model->getTeachersForDiscipline($id);
+        $teachersHandled = array(); $i = 0;
+        foreach ($teachers as $teacher)
+        {
+            $i++;
+            $teachersHandled[$i] = $teacher['TeacherLast'].' '.UTF8::substr($teacher['TeacherFirst'], 0, 1).'. ';
+            if(!empty($teacher['TeacherSecond']))
+            {
+                $teachersHandled[$i] .= UTF8::substr($teacher['TeacherSecond'], 0, 1).'.';
+            }
+        }
+        return $teachersHandled;
+    }    
 	
     public function action_settings() {
         $twig = Twig::factory('settings');
diff --git a/~dev_rating/application/classes/Controller/Student/Profile.php b/~dev_rating/application/classes/Controller/Student/Profile.php
deleted file mode 100644
index 451560126..000000000
--- a/~dev_rating/application/classes/Controller/Student/Profile.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-class Controller_Student_Profile extends Controller_UserEnvi {
-
-    public function action_show()
-    {
-        $twig = Twig::factory('student/profile');
-        $twig->User = $this->UserInfo;
-        $this->response->body($twig);
-    }
-}          
\ No newline at end of file
diff --git a/~dev_rating/application/views/student/index.twig b/~dev_rating/application/views/student/index.twig
index f90f83d98..fa90ea3a9 100644
--- a/~dev_rating/application/views/student/index.twig
+++ b/~dev_rating/application/views/student/index.twig
@@ -2,22 +2,24 @@
  
 {% macro subject(i, HTML) %}
 	<tr class="course_content">
-		<td class = "course_img"></td>
-
 		<td class = "course_name">
-                        {{ HTML.anchor('subject/' ~ i.ID, i.Title)|raw }}
+                    {{ HTML.anchor('subject/' ~ i.ID, i.Title)|raw }}
 		</td>
 
 		<td class="course_teacher">
-			{{ i.Teacher }}
+                    {% for teacher in i.Teachers %}
+                        <div>{{ teacher }}</div>
+                    {% else %}
+                        ---
+                    {% endfor %}
 		</td>
 
 		<td  class="course_form_control">
-			{{ i.Control }}
+                    {{ i.Control }}
 		</td>	
 
 		<td class="course_rating_value">
-			{{ i.Rate|default('0') }} / {{ i.MaxRate|default('0') }}
+                    {{ i.Rate|default('0') }} / {{ i.MaxRate|default('0') }}
 		</td>
 
 		<td class="course_rating_percent">
@@ -44,7 +46,6 @@
         {% if disciplines|length > 0 %}
         <table cellspacing="0" border="0" width="100%" class="table">
             <tr class="course_table_top">
-                <td>&nbsp;</td>
                 <td>Предмет</td>
                 <td>Преподаватель</td>
                 <td>Форма контроля</td>
diff --git a/~dev_rating/media/css/results.css b/~dev_rating/media/css/results.css
index 5d350ccc2..78765c176 100644
--- a/~dev_rating/media/css/results.css
+++ b/~dev_rating/media/css/results.css
@@ -29,6 +29,11 @@ tr.course_table_top td {
 	background-color: #f1f1f1;
 }
 
+.course_content > td
+{
+    padding: 10px;
+}
+
 .course_content {
 	text-align: center; 
 	/*border-bottom: 1px solid;
@@ -44,7 +49,7 @@ tr.course_table_top td {
 
 .course_name {
 	vertical-align: middle;
-	text-align: center;
+	text-align: left;
 }
 
 .course_name a:link, a:visited {
-- 
GitLab