From 11415bd17c44ceec694f4395facb6e72032ea0f2 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:36:32 +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=B4=D0=BB=D1=8F=20=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=BE=D0=BB=D1=8C=D0=BA=D0=B8=D1=85=20=D0=B4?= =?UTF-8?q?=D0=B8=D1=81=D1=86=D0=B8=D0=BF=D0=BB=D0=B8=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/classes/Controller/Handler/Rating.php | 7 ++++--- .../application/classes/Controller/Teacher/Rating.php | 5 ++--- ~dev_rating/media/js/rating.js | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/~dev_rating/application/classes/Controller/Handler/Rating.php b/~dev_rating/application/classes/Controller/Handler/Rating.php index b5cbb6bfb..03e0d7135 100644 --- a/~dev_rating/application/classes/Controller/Handler/Rating.php +++ b/~dev_rating/application/classes/Controller/Handler/Rating.php @@ -35,10 +35,11 @@ class Controller_Handler_Rating extends Controller_Handler { -> rule('groupSelected', 'not_empty'); if($this->post->check()) { //$SGID = Cookie::get('SGID', null); + $SG_json = json_decode(Cookie::get('SGID', null), true); + + $SG_json[$this->post->offsetGet('disciplineID')] = $this->post->offsetGet('groupSelected'); - $SG_ar[$this->post->offsetGet('disciplineID')] = $this->post->offsetGet('groupSelected'); - - Cookie::set('SGID', json_encode($SG_ar), '3600'); // Пока час + Cookie::set('SGID', json_encode($SG_json), '3600'); $data['success'] = true; } $this->response->body(json_encode($data)); diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index 8e481273b..82ab188ce 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -8,13 +8,12 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $SG_json = json_decode(Cookie::get('SGID', null), true); if ($SG_json !== null) { - var_dump($SG_json, $id); + //var_dump($SG_json); - if (array_key_exists($id, $SG_json)) return $SG_json[$id]; else return 0; - } + } else return 0; } public function action_edit() diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index ce18396a3..59394a8d3 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -20,7 +20,6 @@ $(function() { $("#hidden_div").remove(); filterGroups(json_settings.studyGroupID); $(".groupSelector [value='"+ json_settings.studyGroupID +"']").attr("selected", "selected"); - //console.log(json); // Скрываем все остальные группы // 0 - показать все -- GitLab