diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php index 568ed66834956388de2d415039e12d5946c73a3d..edd55dda8ce4ce954458981acdc9a5827d100209 100644 --- a/~dev_rating/application/classes/Controller/Student/Index.php +++ b/~dev_rating/application/classes/Controller/Student/Index.php @@ -9,18 +9,30 @@ class Controller_Student_Index extends Controller_UserEnvi { $db = new Model_Student; $disciplines = $db->getAllDisciplines($this->UserInfo['StudentID']); $i = 0; + $colorsList = array('Undefined', 'ECTS-F', 'ECTS-FX', 'ECTS-E', 'ECTS-D', 'ECTS-C', 'ECTS-B', 'ECTS-A'); foreach($disciplines as $row) { $i++; + $color = 0; $disciplinesHandled[$i]['ID'] = $row['DisciplineID']; if($row['ExamType'] == 'exam') + { $disciplinesHandled[$i]['Control'] = 'Ркзамен'; + $disciplinesHandled[$i]['MaxRate'] = $row['ExamRate'] !== NULL ? 100 : 60; + } elseif($row['ExamType'] == 'credit') + { $disciplinesHandled[$i]['Control'] = 'Зачет'; + $disciplinesHandled[$i]['MaxRate'] = 100; + } $disciplinesHandled[$i]['Teachers'] = $this->getTeachersForDiscipline($row['DisciplineID']); $disciplinesHandled[$i]['Title'] = $row['SubjectName']; $disciplinesHandled[$i]['Rate'] = $row['Rate']; - $disciplinesHandled[$i]['MaxRate'] = $row['MaxCurrentRate']; + $disciplinesHandled[$i]['MaxCurrentRate'] = $row['MaxCurrentRate']; + + // РџРѕРґР±РѕСЂ цвета Рѕ.Рѕ + + $disciplinesHandled[$i]['ColorScheme'] = $colorsList[$this->getColor($row['Rate'], $row['MaxCurrentRate'], $row['ExamRate'])]; } if ($i != 0) { $twig->disciplines = $disciplinesHandled; @@ -43,7 +55,37 @@ class Controller_Student_Index extends Controller_UserEnvi { } return $teachersHandled; } - + + protected function getColor($rate, $current, $examRate) + { + if($current > 0) + { + $percent = $rate / $current; + if($percent < 0.31) + $color = 1; + elseif($percent >= 0.31 AND $percent <= 0.59) + $color = 2; + elseif($percent >= 0.60 AND $percent <= 0.64) + $color = 3; + elseif($percent >= 0.65 AND $percent <= 0.70) + $color = 4; + elseif($percent >= 0.71 AND $percent <= 0.84) + $color = 5; + elseif($percent >= 0.85 AND $percent <= 0.94) + $color = 6; + elseif($percent >= 0.95 AND $percent <= 1) + $color = 7; + if($examRate !== NULL AND $examRate < 22) + $color = 2; + } + else + { + $color = 0; + } + return $color; + } + + public function action_settings() { $twig = Twig::factory('settings'); $twig->User = $this->UserInfo; diff --git a/~dev_rating/application/classes/Controller/Student/Subject.php b/~dev_rating/application/classes/Controller/Student/Subject.php index 149a9fce3e326cfb33e296d4c9497ac1c2af1b49..2359335132622fcefa13b8b21a01b285331ccd7a 100644 --- a/~dev_rating/application/classes/Controller/Student/Subject.php +++ b/~dev_rating/application/classes/Controller/Student/Subject.php @@ -4,20 +4,15 @@ class Controller_Student_Subject extends Controller_UserEnvi { public function action_show() { - $twig = Twig::factory('student/subject'); - $twig->User = $this->UserInfo; + // ЛОГРРљРђ $db = new Model_Student; $id = $this->request->param('id'); - $discipline = $db->getDisciplineMap($this->UserInfo['StudentID'], $id); - - if($discipline->count() == 0) - throw HTTP_Exception::factory(404, "Предмет СЃ ID $id РЅРµ найден!"); + $discipline = $db->getDisciplineMap($this->UserInfo['StudentID'], $id); $info = $db->getDisciplineInfoByID($id)->offsetGet(0); - $teachers = $db->getTeachersForDiscipline($id); + // Рнформация Рѕ предмете $subject['Title'] = $info['SubjectName']; - if($info['ExamType'] == 'exam') { $subject['Control'] = 'Ркзамен'; @@ -26,24 +21,11 @@ class Controller_Student_Subject extends Controller_UserEnvi { { $subject['Control'] = 'Зачет'; } - $subject['LectureHours'] = $info['LectionCount']; $subject['SeminarHours'] = $info['PracticeCount']; + $subject['Teachers'] = $this->getTeachersForDiscipline($id); - $teachersHandled = array(); $i = 0; - foreach ($teachers as $row) { - $teachersHandled[$i] = $row['LastName'].' '.$row['FirstName'].''; - if(!empty($row['TeacherSecond'])) - { - $teachersHandled[$i] .= ' '.$row['SecondName']; - } - $i++; - } - - $subject['Teachers'] = implode(', ', $teachersHandled); - - $twig->Subject = $subject; - + // Учебная карта дисциплины $disciplineHandled = array(); $rate = 0; $maxRate = 0; $i = 0; $id = 0; foreach($discipline as $row) @@ -66,7 +48,7 @@ class Controller_Student_Subject extends Controller_UserEnvi { $disciplineHandled[$i][$j]['Title'] = $row['SubModuleName']; $disciplineHandled[$i][$j]['Description'] = $row['SubmoduleDescription']; $disciplineHandled[$i][$j]['Rate'] = (int) $row['Rate']; - $disciplineHandled[$i][$j]['Date'] = '---'; + $disciplineHandled[$i][$j]['Date'] = $row['Date']; $disciplineHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate']; $rate += $row['Rate']; $maxRate += $row['MaxRate']; @@ -74,7 +56,28 @@ class Controller_Student_Subject extends Controller_UserEnvi { $disciplineHandled['ModulesCount'] = $i; $disciplineHandled['Rate'] = (int) $rate; $disciplineHandled['MaxRate'] = (int) $maxRate; + + // ПРЕДСТАВЛЕНРР• + $twig = Twig::factory('student/subject'); + $twig->User = $this->UserInfo; + $twig->Subject = $subject; $twig->discipline = $disciplineHandled; $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'].' '.$teacher['TeacherFirst'].' '; + if(!empty($teacher['TeacherSecond'])) + { + $teachersHandled[$i] .= $teacher['TeacherSecond']; + } + } + return $teachersHandled; + } } \ 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 fa90ea3a97c813f3f145b57cdc8075d2843bb5b4..c13cfca85663815400ba69702c890a6e4ef64761 100644 --- a/~dev_rating/application/views/student/index.twig +++ b/~dev_rating/application/views/student/index.twig @@ -2,6 +2,7 @@ {% macro subject(i, HTML) %} <tr class="course_content"> + <td class="{{ i.ColorScheme }}"> </td> <td class = "course_name"> {{ HTML.anchor('subject/' ~ i.ID, i.Title)|raw }} </td> @@ -19,12 +20,12 @@ </td> <td class="course_rating_value"> - {{ i.Rate|default('0') }} / {{ i.MaxRate|default('0') }} + {{ i.Rate|default('0') }} / {{ i.MaxCurrentRate|default('0') }} / {{ i.MaxRate }} </td> <td class="course_rating_percent"> - {% if i.MaxRate != 0 %} - {{ (100 * i.Rate) // i.MaxRate}} % + {% if i.MaxCurrentRate != 0 %} + {{ (100 * i.Rate) // i.MaxCurrentRate }} % {% else %} --- {% endif %} @@ -46,6 +47,7 @@ {% if disciplines|length > 0 %} <table cellspacing="0" border="0" width="100%" class="table"> <tr class="course_table_top"> + <td> </td> <td>Предмет</td> <td>Преподаватель</td> <td>Форма контроля</td> diff --git a/~dev_rating/media/css/results.css b/~dev_rating/media/css/results.css index 78765c1766dd7ee47b4ddc81ddc96c4372c76a18..7d272ba89758a2b394ad5817a94b8fd140eac362 100644 --- a/~dev_rating/media/css/results.css +++ b/~dev_rating/media/css/results.css @@ -1,32 +1,34 @@ .user_courses { - padding-top: 10px; - margin-left: 20px; - margin-right: 20px; + padding-top: 10px; + margin-left: 20px; + margin-right: 20px; } - .courses_tittle { - font: 14pt sans-serif; - color: #0072c2; - margin-top: 5px; - text-align: center; + font: 14pt sans-serif; + color: #0072c2; + margin-top: 5px; + text-align: center; } .course_table_top { - height: 50px; - font: 10pt sans-serif; - color: #0183ce; - text-align: center; + height: 50px; + font: 10pt sans-serif; + color: #0183ce; + text-align: center; } - tr.course_table_top td { border-bottom:1pt solid; border-color: #ccc; } +tr.course_table_top td:first-child { + border-bottom: 0pt; +} + .course_content:hover { - background-color: #f1f1f1; + background-color: #f1f1f1; } .course_content > td @@ -35,62 +37,89 @@ tr.course_table_top td { } .course_content { - text-align: center; - /*border-bottom: 1px solid; - border-color: #9b9b9b; */ -} - -.course_img { - height: 32px; - width: 32px; - background-image: url(/~dev_rating/media/css/icons/tick.png); - background-repeat:no-repeat; + text-align: center; } .course_name { - vertical-align: middle; - text-align: left; + vertical-align: middle; + text-align: left; } -.course_name a:link, a:visited { - vertical-align: middle; - text-decoration: none; - font: 11pt sans-serif; - color: #757575; +.course_name a:link, .course_name a:visited { + vertical-align: middle; + text-decoration: none; + font: 11pt sans-serif; + color: #757575; } .course_name a:hover { - text-decoration: none; - font: 11pt sans-serif; - color: #4fbeec; + text-decoration: none; + font: 11pt sans-serif; + color: #4fbeec; } +tr.course_content td:first-of-type { + width: 5px; + border-bottom: 0; +} tr.course_content td { - border-bottom:1pt solid; + border-bottom: 1pt solid; border-color: #ccc; } .course_teacher { - text-align: center; - font: 9pt sans-serif; - + text-align: center; + font: 9pt sans-serif; } .course_form_control { - - font: 10pt sans-serif; - color: #757575; + font: 10pt sans-serif; } .course_rating_value { - font: 11pt sans-serif; - color: #83d800; + font: 11pt sans-serif; + /* color: #83d800; */ } .course_rating_percent { - font: 11pt sans-serif; - color: #83d800; + font-size: 11pt; + padding: 0px !important; } + +.Undefined +{ + background: #777; +} + +.ECTS-F { + background: #f60; +} + +.ECTS-FX { + background: #e56800; +} + +.ECTS-E { + background: #ffb100; +} +.ECTS-D { + background: #ffd000; +} +.ECTS-C { + background: #70c300; +} +.ECTS-B { + background: #059e00; +} +.ECTS-A { + background: #009404; +} + +.course_rating_percent > div +{ + width: 100%; + line-height: 32px; +} \ No newline at end of file