diff --git a/db/Sample.sql b/db/Sample.sql index de225865c35626b43b8f74434aa009c45cc18619..dd70f7bdc61492bbcaad7813b628b64d701b3e3b 100644 --- a/db/Sample.sql +++ b/db/Sample.sql @@ -23,7 +23,7 @@ SET time_zone = "+00:00"; -- -- Дамп данных таблицы `grades` -- -INSERT INTO `grades` (`ID`, `Grade`, `Degree`) VALUES +INSERT INTO `grades` (`ID`, `Num`, `Degree`) VALUES (1, 1, 'bachelor'), (2, 2, 'bachelor'), (3, 3, 'bachelor'), diff --git a/db/Structure.sql b/db/Structure.sql index 2cbf8ea653c4eb6ab62409dbe85e31c2a2834a58..bdd4ebc289e311104523499c72ec905c9d24ed1c 100644 --- a/db/Structure.sql +++ b/db/Structure.sql @@ -449,7 +449,7 @@ CREATE TABLE IF NOT EXISTS `grades` ( `Num` int(11) NOT NULL, `Degree` enum('bachelor','master','specialist') NOT NULL, PRIMARY KEY (`ID`), - UNIQUE KEY `Grade_2` (`Grade`,`Degree`) + UNIQUE KEY `Grade_2` (`Num`,`Degree`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/~dev_rating/application/classes/Controller/Handler/Map.php b/~dev_rating/application/classes/Controller/Handler/Map.php index 3392e940337292fc07cf278df6db3c0d7e0144db..800e37ceb803cd9fd430eb4ef83c5b82572e8be7 100644 --- a/~dev_rating/application/classes/Controller/Handler/Map.php +++ b/~dev_rating/application/classes/Controller/Handler/Map.php @@ -259,6 +259,7 @@ class Controller_Handler_Map extends Controller_Handler { // Добавление мероприятия public function action_AddSubmodule() { $data['success'] = false; + return; $this->post -> rule('submoduleID', 'not_empty') -> rule('submoduleID', 'digit'); if($this->post->check()) { diff --git a/~dev_rating/application/classes/Controller/Student/Index.php b/~dev_rating/application/classes/Controller/Student/Index.php index edd55dda8ce4ce954458981acdc9a5827d100209..25e60c7a8bb5d8a7a17fd6dd2460c6774f9c4c75 100644 --- a/~dev_rating/application/classes/Controller/Student/Index.php +++ b/~dev_rating/application/classes/Controller/Student/Index.php @@ -14,7 +14,7 @@ class Controller_Student_Index extends Controller_UserEnvi { { $i++; $color = 0; - $disciplinesHandled[$i]['ID'] = $row['DisciplineID']; + $disciplinesHandled[$i]['ID'] = $row['ID']; if($row['ExamType'] == 'exam') { $disciplinesHandled[$i]['Control'] = 'Ркзамен'; @@ -25,7 +25,7 @@ class Controller_Student_Index extends Controller_UserEnvi { $disciplinesHandled[$i]['Control'] = 'Зачет'; $disciplinesHandled[$i]['MaxRate'] = 100; } - $disciplinesHandled[$i]['Teachers'] = $this->getTeachersForDiscipline($row['DisciplineID']); + $disciplinesHandled[$i]['Teachers'] = $this->getTeachersForDiscipline($row['ID']); $disciplinesHandled[$i]['Title'] = $row['SubjectName']; $disciplinesHandled[$i]['Rate'] = $row['Rate']; $disciplinesHandled[$i]['MaxCurrentRate'] = $row['MaxCurrentRate']; @@ -47,8 +47,8 @@ class Controller_Student_Index extends Controller_UserEnvi { foreach ($teachers as $teacher) { $i++; - $teachersHandled[$i] = $teacher['TeacherLast'].' '.UTF8::substr($teacher['TeacherFirst'], 0, 1).'. '; - if(!empty($teacher['TeacherSecond'])) + $teachersHandled[$i] = $teacher['Last'].' '.UTF8::substr($teacher['First'], 0, 1).'. '; + if(!empty($teacher['Second'])) { $teachersHandled[$i] .= UTF8::substr($teacher['TeacherSecond'], 0, 1).'.'; } diff --git a/~dev_rating/application/classes/Controller/Student/Subject.php b/~dev_rating/application/classes/Controller/Student/Subject.php index ec77d370f29a6559cfd64dd3e0431bafc6b13e71..2eb6fffd1d37f22ac690d21421e53f981153409e 100644 --- a/~dev_rating/application/classes/Controller/Student/Subject.php +++ b/~dev_rating/application/classes/Controller/Student/Subject.php @@ -28,9 +28,9 @@ class Controller_Student_Subject extends Controller_UserEnvi { $subject['DepName'] = $info['DepName']; $subject['Teachers'] = $this->getTeachersForDiscipline($id); $semester = $db->getSemesterInfo($info['SemesterID']); - $semester['SemesterNum'] = $semester['SemesterNum'] == 1 ? 'Осенний' : 'Весенний'; - $subject['SemesterNum'] = $semester['SemesterNum']; - $subject['SemesterYear'] = $semester['SemesterYear']; + $semester['Num'] = $semester['Num'] == 1 ? 'Осенний' : 'Весенний'; + $subject['Num'] = $semester['Num']; + $subject['Year'] = $semester['Year']; // Учебная карта дисциплины $disciplineHandled = array(); $rate = 0; $maxRate = 0; $i = 0; $id = 0; @@ -97,10 +97,10 @@ class Controller_Student_Subject extends Controller_UserEnvi { foreach ($teachers as $teacher) { $i++; - $teachersHandled[$i] = $teacher['TeacherLast'].' '.$teacher['TeacherFirst'].' '; - if(!empty($teacher['TeacherSecond'])) + $teachersHandled[$i] = $teacher['Last'].' '.$teacher['First'].' '; + if(!empty($teacher['Second'])) { - $teachersHandled[$i] .= $teacher['TeacherSecond']; + $teachersHandled[$i] .= $teacher['Second']; } } return $teachersHandled; diff --git a/~dev_rating/application/classes/Controller/Teacher/Index.php b/~dev_rating/application/classes/Controller/Teacher/Index.php index 7a0ed8285d75249c50f521d098cc732adc09d4f2..6bb9394df50205903c3832ceb881df7d6c870657 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Index.php +++ b/~dev_rating/application/classes/Controller/Teacher/Index.php @@ -8,7 +8,8 @@ class Controller_Teacher_Index extends Controller_UserEnvi { $model = new Model_Teacher_Index; $disciplines = $model->getDisciplinesForTeacher($this->UserInfo['TeacherID']); - $disciplinesHandled = array(); $subjID = $discID = $gradeNum = $i = $j = $k = 0; + $subjID = $discID = $gradeNum = $i = $j = $k = 0; // Combo!!! + $disciplinesHandled = array(); $groupsInDiscipline = array(); $degrees = array('bachelor' => 'Бакалавриат', 'specialist' => 'Специалитет', 'master' => 'Магистратура'); foreach ($disciplines as $row) { @@ -19,26 +20,26 @@ class Controller_Teacher_Index extends Controller_UserEnvi { $subjID = $row['SubjectID']; $gradeNum = $row['GradeID']; $disciplinesHandled[$i]['Title'] = $row['SubjectName']; - $disciplinesHandled[$i]['GradeNum'] = $row['DisciplineGrade']; - $disciplinesHandled[$i]['Degree'] = $degrees[$row['DisciplineDegree']]; + $disciplinesHandled[$i]['GradeNum'] = $row['GradeNum']; + $disciplinesHandled[$i]['Degree'] = $degrees[$row['Degree']]; } - if($discID != $row['DisciplineID']) + if($discID != $row['ID']) { $j++; $k = 0; $groupsInDiscipline = array(); $disciplinesHandled[$i]['Disciplines'][$j]['isAuthor'] = $row['isAuthor']; $disciplinesHandled[$i]['Disciplines'][$j]['isLocked'] = $row['isLocked']; $disciplinesHandled[$i]['Disciplines'][$j]['isMapCreated'] = $row['isMapCreated']; - $disciplinesHandled[$i]['Disciplines'][$j]['ID'] = $discID = $row['DisciplineID']; - $disciplinesHandled[$i]['Disciplines'][$j]['ControlType'] = $this->getControlType($row['DisciplineType']); + $disciplinesHandled[$i]['Disciplines'][$j]['ID'] = $discID = $row['ID']; + $disciplinesHandled[$i]['Disciplines'][$j]['ControlType'] = $this->getControlType($row['ExamType']); $disciplinesHandled[$i]['Disciplines'][$j]['Teachers'] = $this->getTeachersForDiscipline($discID); } - if($row['StudyGroupNum'] != 0) - $groupsInDiscipline[++$k] = $row['StudyGroupNum'].' РіСЂ.'; + if($row['GroupNum'] != 0) + $groupsInDiscipline[++$k] = $row['GroupNum'].' РіСЂ.'; $disciplinesHandled[$i]['Disciplines'][$j]['Groups'] = implode(', ', $groupsInDiscipline); - } + } //!for_each $twig->Subjects = $disciplinesHandled; $twig->User = $this->UserInfo; @@ -70,10 +71,10 @@ class Controller_Teacher_Index extends Controller_UserEnvi { foreach ($teachers as $teacher) { $i++; - $teachersHandled[$i] = $teacher['TeacherLast'].' '.UTF8::substr($teacher['TeacherFirst'], 0, 1).'. '; - if(!empty($teacher['TeacherSecond'])) + $teachersHandled[$i] = $teacher['Last'].' '.UTF8::substr($teacher['First'], 0, 1).'. '; + if(!empty($teacher['Second'])) { - $teachersHandled[$i] .= UTF8::substr($teacher['TeacherSecond'], 0, 1).'.'; + $teachersHandled[$i] .= UTF8::substr($teacher['Second'], 0, 1).'.'; } } return $teachersHandled; diff --git a/~dev_rating/application/classes/Controller/Teacher/Rating.php b/~dev_rating/application/classes/Controller/Teacher/Rating.php index ff57ac8dacd3696df5d5d3d3e6d1a211ed7840bb..30d2490ee5dd29c28edf8eb44f18954fff06b19d 100644 --- a/~dev_rating/application/classes/Controller/Teacher/Rating.php +++ b/~dev_rating/application/classes/Controller/Teacher/Rating.php @@ -54,19 +54,22 @@ class Controller_Teacher_Rating extends Controller_UserEnvi { $studentsHandled = array(); $i = 0; + foreach($students as $row) { $i++; - $studentsHandled[$i]['StudentID'] = $row['StudentID']; - $studentsHandled[$i]['LastName'] = $row['LastName']; - $studentsHandled[$i]['FirstName'] = $row['FirstName']; - $studentsHandled[$i]['SecondName'] = $row['SecondName']; - $studentsHandled[$i]['Grade'] = $row['Grade']; + $studentsHandled[$i]['ID'] = $row['ID']; + $studentsHandled[$i]['Last'] = $row['Last']; + $studentsHandled[$i]['First'] = $row['First']; + $studentsHandled[$i]['Second'] = $row['Second']; + $studentsHandled[$i]['GradeNum'] = $row['GradeNum']; + if ($row['Degree'] == 'bachelor') $studentsHandled[$i]['GradeTitle'] = $row['Grade'].' РєСѓСЂСЃ'; if ($row['Degree'] == 'specialist') $studentsHandled[$i]['GradeTitle'] = $row['Grade'].' РєСѓСЂСЃ'; - if ($row['Grade'] == 'master') + if ($row['Degree'] == 'master') $studentsHandled[$i]['GradeTitle'] = 'Магистратура, '.$row['Grade'].' РіРѕРґ'; + $studentsHandled[$i]['GroupNum'] = $row['GroupNum']; $studentsHandled[$i]['isAttached'] = $row['isAttached']; $rate = $db->getMapForStudent($row['StudentID'], $id); diff --git a/~dev_rating/application/classes/Controller/UserEnvi.php b/~dev_rating/application/classes/Controller/UserEnvi.php index c83580a56b2c7d0ae83a974d9150320702f42df8..095f2601a2b1ffb29b87ef7c19bf8937cee79e46 100644 --- a/~dev_rating/application/classes/Controller/UserEnvi.php +++ b/~dev_rating/application/classes/Controller/UserEnvi.php @@ -14,14 +14,14 @@ class Controller_UserEnvi extends Controller { // Проверка РЅР° $this->UserInfo = User::instance()->getInfoAsArray(); - if($this->UserInfo['AccType'] == 'student') + if($this->UserInfo['Type'] == 'student') { $degrees = array('bachelor' => 'Бакалавриат', 'specialist' => 'Специалитет', 'master' => 'Магистратура'); - $this->UserInfo['StudentDegree'] = $degrees[$this->UserInfo['StudentDegree']]; + $this->UserInfo['Degree'] = $degrees[$this->UserInfo['Degree']]; } // Проверка РЅР° доступ Рє странице $route = Route::name($this->request->route()); - $userMark = User::instance()->offsetGet('AccRoleMark'); + $userMark = User::instance()->offsetGet('RoleMark'); $sysModel = new Model_System; $bitmask = $sysModel->getBitmaskForRoute($route); if(!($bitmask & $userMark)) @@ -33,13 +33,13 @@ class Controller_UserEnvi extends Controller { public function action_index() { - $page = Request::factory($this->UserInfo['AccType'].'/index')->execute(); + $page = Request::factory($this->UserInfo['Type'].'/index')->execute(); $this->response->body($page); } public function action_profile() { - if($this->UserInfo['AccType'] != 'teacher') + if($this->UserInfo['Type'] != 'teacher') { $this->redirect('/', 302); } @@ -57,7 +57,7 @@ class Controller_UserEnvi extends Controller { public function action_settings() { - $page = Request::factory($this->UserInfo['AccType'].'/settings')->execute(); + $page = Request::factory($this->UserInfo['Type'].'/settings')->execute(); $this->response->body($page); } } diff --git a/~dev_rating/application/views/base.twig b/~dev_rating/application/views/base.twig index f53f9e15c6b896cab35f919436a6248b1e968a96..21f261baa7f2a88ef5c72d8dabdaefa50ca34d69 100644 --- a/~dev_rating/application/views/base.twig +++ b/~dev_rating/application/views/base.twig @@ -62,7 +62,7 @@ {{ HTML.image('media/img/user.png', {'height': '11px'})|raw }} {{ User.First }} {{ User.Last }} </div> | - {% if User.AccRoleMark == 4 %} + {% if User.RoleMark == 4 %} {{ HTML.anchor('admin', 'Администрирование', {'title': 'Перейти РІ панель управления системой'})|raw }} {% endif %} {{ HTML.anchor('/', 'Главная страница', {'title': 'Перейти РЅР° главную страницу'})|raw }} @@ -71,9 +71,9 @@ </div> </div> </div> - {% if User.AccType == 'student' %} + {% if User.Type == 'student' %} {% include 'profile/student' %} - {% elseif User.AccType == 'teacher' %} + {% elseif User.Type == 'teacher' %} {% include 'profile/teacher' %} {% endif %} <div class="main"> diff --git a/~dev_rating/application/views/profile/student.twig b/~dev_rating/application/views/profile/student.twig index e2ee26ca17ec451200a69d850844aff25a5317a0..b49944a8d1e720b3208ea335d75a9abe33fdd3bd 100644 --- a/~dev_rating/application/views/profile/student.twig +++ b/~dev_rating/application/views/profile/student.twig @@ -12,18 +12,18 @@ </div> <div class="profile_clearFix profile_delimeter"> <div class="label">РљСѓСЂСЃ, РіСЂСѓРїРїР°:</div> - <div class="labeled_info">{{ User.StudentDegree }}, {{ User.StudentGrade }} РєСѓСЂСЃ, {{ User.GroupNum }} РіСЂСѓРїРїР°</div> + <div class="labeled_info">{{ User.Degree }}, {{ User.GradeNum }} РєСѓСЂСЃ, {{ User.GroupNum }} РіСЂСѓРїРїР°</div> </div> <div class="profile_clearFix"> <div class="label">РўРёРї аккаунта:</div> - <div class="labeled_info">{{ User.AccRole }}</div> + <div class="labeled_info">{{ User.Role }}</div> </div> <div class="profile_clearFix"> <div class="label">РРјСЏ пользователя:</div> - <div class="labeled_info">{{ User.AccLogin }}</div> + <div class="labeled_info">{{ User.Login }}</div> </div> <div class="profile_clearFix"> <div class="label">E-Mail:</div> - <div class="labeled_info">{{ User.AccEMail }}</div> + <div class="labeled_info">{{ User.EMail }}</div> </div> </div> \ No newline at end of file diff --git a/~dev_rating/application/views/profile/teacher.twig b/~dev_rating/application/views/profile/teacher.twig index 0b66ac912298f8ee5c7a046fb6901c967a2ac009..7c9b14f61cf271bcb3461688139d39ae24c401fa 100644 --- a/~dev_rating/application/views/profile/teacher.twig +++ b/~dev_rating/application/views/profile/teacher.twig @@ -16,15 +16,15 @@ </div> <div class="profile_clearFix"> <div class="label">РўРёРї аккаунта:</div> - <div class="labeled_info">{{ User.AccRole }}</div> + <div class="labeled_info">{{ User.Role }}</div> </div> <div class="profile_clearFix"> <div class="label">РРјСЏ пользователя:</div> - <div class="labeled_info">{{ User.AccLogin }}</div> + <div class="labeled_info">{{ User.Login }}</div> </div> <div class="profile_clearFix"> <div class="label">E-Mail:</div> - <div class="labeled_info">{{ User.AccEMail }}</div> + <div class="labeled_info">{{ User.EMail }}</div> </div> <div class="profile_clearFix" style="text-align: center;"> {{ HTML.anchor('profile', 'Редактировать профиль')|raw }} diff --git a/~dev_rating/application/views/student/subject.twig b/~dev_rating/application/views/student/subject.twig index 0920556bead9f77d0136be372306d3db3cfc5719..3ea0878e595bd9dce27aadf471b3dd66d0a3d484 100644 --- a/~dev_rating/application/views/student/subject.twig +++ b/~dev_rating/application/views/student/subject.twig @@ -41,7 +41,7 @@ </div> <div class="clearFix"> <div class="label">Семестр:</div> - <div class="labeled_info">{{ Discipline.SemesterNum }} семестр {{ Discipline.SemesterYear }}/{{ Discipline.SemesterYear + 1 }} учебного РіРѕРґР°</div> + <div class="labeled_info">{{ Discipline.Num }} семестр {{ Discipline.Year }}/{{ Discipline.Year + 1 }} учебного РіРѕРґР°</div> </div> <div class="clearFix"> <div class="label">Учебных часов:</div> diff --git a/~dev_rating/application/views/teacher/rating.twig b/~dev_rating/application/views/teacher/rating.twig index 90f03fc09491f5d9486cb569eda648aa088919f5..fe2c267d1e13c33b70840ace4d2c4c515beec25f 100644 --- a/~dev_rating/application/views/teacher/rating.twig +++ b/~dev_rating/application/views/teacher/rating.twig @@ -56,7 +56,7 @@ </tr> {% endif %} <tr> - <td class="row_{{ row }} student" id="{{ student.StudentID }}">{{ student.LastName }} {{ student.FirstName }}</td> + <td class="row_{{ row }} student" id="{{ student.ID }}">{{ student.Last }} {{ student.First }}</td> {% for i in 1..CellCount %} {% set RateResult = RateResult + student[i].Rate %} <td class="row_{{ row }} col_{{ i }} rateCell"><input type="text" value="{{ student[i].Rate }}"></td> diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 80af042f2b30b951080fb8d28ab69330ec6a1841..d759c0737bfb467de3d00760e8832d5b646824bb 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -108,7 +108,7 @@ $(function() { var jTemp = $(".HiddenInputFacultyID"); if (jTemp.length > 0) { g_facultyID = jTemp.val(); // Факультет, Рє которой привязана дисциплина - jTemp.remove(); // РўСѓС‚ даже Шерлок Холмс бессилен + //jTemp.remove(); // РўСѓС‚ даже Шерлок Холмс бессилен } }) \ No newline at end of file diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php index fa7635b6acb4b7a6bd0d39ca77ad9a509435108b..25b373b0ac4891744f9a117c15be481196904fbf 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/modules/account/classes/Kohana/User.php @@ -232,8 +232,8 @@ class Kohana_User implements ArrayAccess { protected function _getInfoFromDB($id) { - $info = $this->_model->getPersonalInfoByID($id)->offsetGet(0); - $info += $this->_model->getAccountInfoByID($id)->offsetGet(0); + $info = $this->_model->getPersonalInfo($id)->offsetGet(0); + $info += $this->_model->getAccountInfo($id)->offsetGet(0); return $info; } diff --git a/~dev_rating/modules/account/classes/Model/Kohana/Account.php b/~dev_rating/modules/account/classes/Model/Kohana/Account.php index 4af4e732c57bb7bfca1a3b215566ef7d92e88981..ccfcc58ee72d73f143d320252b764a0f590fe60f 100644 --- a/~dev_rating/modules/account/classes/Model/Kohana/Account.php +++ b/~dev_rating/modules/account/classes/Model/Kohana/Account.php @@ -64,16 +64,16 @@ class Model_Kohana_Account extends Model return $response->get('Num'); } - public function getPersonalInfoByID($id) + public function getPersonalInfo($id) { - $sql = "CALL `GetPersonalInfoByID`('$id');"; + $sql = "CALL `GetPersonalInfo`('$id');"; $query = DB::query(Database::SELECT, $sql)->execute(); return $query; } - public function getAccountInfoByID($id) + public function GetAccountInfo($id) { - $sql = "CALL GetAccInfoByID('$id');"; + $sql = "CALL GetAccountInfo('$id');"; $query = DB::query(Database::SELECT, $sql)->execute(); return $query; }