From 01f05c683fc351604ee443c0e37f8c5424768136 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, 27 Nov 2014 17:21:23 +0300
Subject: [PATCH] =?UTF-8?q?=D1=8D=D1=84=D1=84=D0=B5=D0=BA=D1=82=20=D0=BF?=
 =?UTF-8?q?=D0=B0=D0=BC=D1=8F=D1=82=D0=B8.=20=D0=9F=D0=BE=D0=BA=D0=B0=20?=
 =?UTF-8?q?=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B4=D0=BB=D1=8F=20?=
 =?UTF-8?q?=D0=BE=D0=B4=D0=BD=D0=BE=D0=B9=20=D0=B4=D0=B8=D1=81=D1=86=D0=B8?=
 =?UTF-8?q?=D0=BF=D0=BB=D0=B8=D0=BD=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../application/classes/Controller/Teacher/Rating.php      | 2 +-
 ~dev_rating/application/views/teacher/rating.twig          | 4 ++--
 ~dev_rating/media/js/rating.js                             | 7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php
index ea228858b..8e481273b 100644
--- a/~dev_rating/application/classes/Controller/Teacher/Rating.php
+++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php
@@ -5,7 +5,7 @@ class Controller_Teacher_Rating extends Controller_UserEnvi {
     private function GetSGID($id)
     {
         # $id = disciplineID
-        $SG_json = json_decode(Cookie::get('SGID', null));
+        $SG_json = json_decode(Cookie::get('SGID', null), true);
         if ($SG_json !== null) 
         {
             var_dump($SG_json, $id);
diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig
index c3eb7b6fd..d4bf47f55 100644
--- a/~dev_rating/application/views/teacher/rating.twig
+++ b/~dev_rating/application/views/teacher/rating.twig
@@ -84,7 +84,7 @@
 			<span id="maxRate">Максимальный балл: <b></b></span>
 		</div>
 	</div>
-	<div class="hidden_div">
-		{{ studyGroupID }}
+	<div id="hidden_div">
+		{ "studyGroupID": "{{ studyGroupID }}" }
 	</div>
 {% endblock %}
\ No newline at end of file
diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js
index 613305b7f..ce18396a3 100644
--- a/~dev_rating/media/js/rating.js
+++ b/~dev_rating/media/js/rating.js
@@ -15,6 +15,13 @@ $(function() {
     var g_URL = (window.location.href).split("/");
     var g_disciplineID = g_URL[g_URL.length - 1];
 
+    // studyGroupID для фильтра
+    var json_settings = $.parseJSON($("#hidden_div").html());
+    $("#hidden_div").remove();
+    filterGroups(json_settings.studyGroupID);
+    $(".groupSelector [value='"+ json_settings.studyGroupID +"']").attr("selected", "selected");
+    //console.log(json);
+
     // Скрываем все остальные группы
     // 0 - показать все
     function filterGroups(groupID) {
-- 
GitLab