Skip to content
Snippets Groups Projects
Commit f66d70ad authored by Andrew Rudenets's avatar Andrew Rudenets
Browse files

Исправление багов, vol. 3: искупление грехов

parent 7c15cccc
Branches
Tags
No related merge requests found
...@@ -380,6 +380,23 @@ INSERT INTO `user_roles` (`ID`, `Type`, `RoleName`, `Mark`) VALUES ...@@ -380,6 +380,23 @@ INSERT INTO `user_roles` (`ID`, `Type`, `RoleName`, `Mark`) VALUES
(2, 'teacher', 'Преподаватель', 2), (2, 'teacher', 'Преподаватель', 2),
(3, 'teacher', 'Преподаватель-Администратор', 4); (3, 'teacher', 'Преподаватель-Администратор', 4);
--
-- Дамп данных таблицы `user_roles`
--
INSERT INTO `page_access` (`ID`, `Pagename`, `Bitmask`) VALUES
(NULL, 'common:index', 7),
(NULL, 'common:settings', 7),
(NULL, 'teacher:index', 6),
(NULL, 'teacher:settings', 6),
(NULL, 'teacher:map:create', 6),
(NULL, 'teacher:map:edit', 6),
(NULL, 'teacher:rating', 6),
(NULL, 'admin:common', 4),
(NULL, 'student:index', 1),
(NULL, 'student:settings', 1),
(NULL, 'student:subject', 1);
-- --
-- Ограничения внешнего ключа сохраненных таблиц -- Ограничения внешнего ключа сохраненных таблиц
-- --
......
...@@ -179,19 +179,19 @@ Route::set('twig:show', 'twig(/<id>)') ...@@ -179,19 +179,19 @@ Route::set('twig:show', 'twig(/<id>)')
/* --------------- Общие ссылки ---------------- */ /* --------------- Общие ссылки ---------------- */
Route::set('index', 'index') Route::set('common:index', 'index')
->defaults(array( ->defaults(array(
'controller' => 'UserEnvi', 'controller' => 'UserEnvi',
'action' => 'index' 'action' => 'index'
)); ));
Route::set('settings', 'settings') Route::set('common:settings', 'settings')
->defaults(array( ->defaults(array(
'controller' => 'UserEnvi', 'controller' => 'UserEnvi',
'action' => 'settings' 'action' => 'settings'
)); ));
Route::set('profile', 'profile(/<type>(/<id>))', array('type' => '(teacher|student)')) Route::set('common:profile', 'profile(/<type>(/<id>))', array('type' => '(teacher|student)'))
->defaults(array( ->defaults(array(
'controller' => 'UserEnvi', 'controller' => 'UserEnvi',
'action' => 'profile' 'action' => 'profile'
...@@ -199,7 +199,7 @@ Route::set('profile', 'profile(/<type>(/<id>))', array('type' => '(teacher|stude ...@@ -199,7 +199,7 @@ Route::set('profile', 'profile(/<type>(/<id>))', array('type' => '(teacher|stude
/* --------------- Студенты ---------------- */ /* --------------- Студенты ---------------- */
Route::set('subject', 'subject/<id>', array('id' => '[0-9]+')) Route::set('student:subject', 'subject/<id>', array('id' => '[0-9]+'))
->defaults(array( ->defaults(array(
'directory' => 'student', 'directory' => 'student',
'controller' => 'subject', 'controller' => 'subject',
...@@ -207,7 +207,7 @@ Route::set('subject', 'subject/<id>', array('id' => '[0-9]+')) ...@@ -207,7 +207,7 @@ Route::set('subject', 'subject/<id>', array('id' => '[0-9]+'))
)); ));
// Внутренние вызовы! // Внутренние вызовы!
Route::set('stdnt:index', 'student/index') Route::set('student:index', 'student/index')
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
...@@ -218,7 +218,7 @@ Route::set('stdnt:index', 'student/index') ...@@ -218,7 +218,7 @@ Route::set('stdnt:index', 'student/index')
'action' => 'index' 'action' => 'index'
)); ));
Route::set('stdnt:settings', 'student/settings') Route::set('student:settings', 'student/settings')
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
...@@ -229,7 +229,7 @@ Route::set('stdnt:settings', 'student/settings') ...@@ -229,7 +229,7 @@ Route::set('stdnt:settings', 'student/settings')
'action' => 'settings' 'action' => 'settings'
)); ));
Route::set('stdnt:profile', 'student/profile') Route::set('student:profile', 'student/profile')
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
...@@ -242,21 +242,21 @@ Route::set('stdnt:profile', 'student/profile') ...@@ -242,21 +242,21 @@ Route::set('stdnt:profile', 'student/profile')
/* --------------- Преподаватели ---------------- */ /* --------------- Преподаватели ---------------- */
Route::set('map:create', 'map/create') Route::set('teacher:map:create', 'map/create')
->defaults(array( ->defaults(array(
'directory' => 'teacher', 'directory' => 'teacher',
'controller' => 'map', 'controller' => 'map',
'action' => 'create' 'action' => 'create'
)); ));
Route::set('map:edit', 'map/<id>', array('id' => '[0-9]+')) Route::set('teacher:map:edit', 'map/<id>', array('id' => '[0-9]+'))
->defaults(array( ->defaults(array(
'directory' => 'teacher', 'directory' => 'teacher',
'controller' => 'map', 'controller' => 'map',
'action' => 'edit' 'action' => 'edit'
)); ));
Route::set('rating', 'rating/<id>', array('id' => '[0-9]+')) Route::set('teacher:rating', 'rating/<id>', array('id' => '[0-9]+'))
->defaults(array( ->defaults(array(
'directory' => 'teacher', 'directory' => 'teacher',
'controller' => 'rating', 'controller' => 'rating',
...@@ -264,7 +264,7 @@ Route::set('rating', 'rating/<id>', array('id' => '[0-9]+')) ...@@ -264,7 +264,7 @@ Route::set('rating', 'rating/<id>', array('id' => '[0-9]+'))
)); ));
// Внутренние вызовы! // Внутренние вызовы!
Route::set('tchr:index', 'teacher/index') Route::set('teacher:index', 'teacher/index')
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
...@@ -275,7 +275,7 @@ Route::set('tchr:index', 'teacher/index') ...@@ -275,7 +275,7 @@ Route::set('tchr:index', 'teacher/index')
'action' => 'index' 'action' => 'index'
)); ));
Route::set('tchr:settings', 'teacher/settings') Route::set('teacher:settings', 'teacher/settings')
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
...@@ -286,7 +286,7 @@ Route::set('tchr:settings', 'teacher/settings') ...@@ -286,7 +286,7 @@ Route::set('tchr:settings', 'teacher/settings')
'action' => 'settings' 'action' => 'settings'
)); ));
Route::set('tchr:profile', 'teacher/profile(/<action>(/<id>))', array('action' => '(student)', 'id' => '[0-9]+')) Route::set('teacher:profile', 'teacher/profile(/<action>(/<id>))', array('action' => '(student)', 'id' => '[0-9]+'))
->filter(function($route, $params, $request){ ->filter(function($route, $params, $request){
if($request->is_initial()) if($request->is_initial())
return FALSE; return FALSE;
......
...@@ -52,30 +52,26 @@ class Controller_Teacher_Map extends Controller_UserEnvi { ...@@ -52,30 +52,26 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
public function action_create() public function action_create()
{ {
$twig = Twig::factory('teacher/map/create'); $twig = Twig::factory('teacher/map/create');
$db = new Model_Teacher_Map; $db = new Model_Teacher_Map;
$twig->User = $this->UserInfo; $twig->User = $this->UserInfo;
$twig->SubjectsList = $this->GetSubjectsList($db); $twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList; $twig->GradesList = $this->GradesList;
echo Debug::vars($this->UserInfo);
$this->response->body($twig); $this->response->body($twig);
} }
public function action_edit() public function action_edit()
{ {
$twig = Twig::factory('teacher/map/edit');
$id = $this->request->param('id'); $id = $this->request->param('id');
$db = new Model_Teacher_Map; $db = new Model_Teacher_Map;
$map = $db->getMapForDiscipline($this->UserInfo['TeacherID'], $id); $map = $db->getMapForDiscipline($this->UserInfo['TeacherID'], $id);
$twig->User = $this->UserInfo; $twig = Twig::factory('teacher/map/edit');
$twig->Map = $this->getMapInfo($map); $twig->User = $this->UserInfo;
$twig->Discipline = $this->getSubjectInfo($db, $id); $twig->Map = $this->getMapInfo($map);
$twig->SubjectsList = $this->GetSubjectsList($db); $twig->Discipline = $this->getSubjectInfo($db, $id);
$twig->GradesList = $this->GradesList; $twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList;
$this->response->body($twig); $this->response->body($twig);
} }
private function getMapInfo($map) { private function getMapInfo($map) {
...@@ -167,9 +163,9 @@ class Controller_Teacher_Map extends Controller_UserEnvi { ...@@ -167,9 +163,9 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
foreach ($list as $row) { foreach ($list as $row) {
$i++; $i++;
$SubjectsList[$i]['ID'] = $row['ID']; $SubjectsList[$i]['ID'] = $row['SubjectID'];
$SubjectsList[$i]['Title'] = $row['Name']; $SubjectsList[$i]['Title'] = $row['SubjectName'];
$SubjectsList[$i]['Abbr'] = $row['Abbr']; $SubjectsList[$i]['Abbr'] = $row['SubjectAbbr'];
} }
return $SubjectsList; return $SubjectsList;
......
...@@ -21,20 +21,20 @@ class Controller_UserEnvi extends Controller { ...@@ -21,20 +21,20 @@ class Controller_UserEnvi extends Controller {
$bitmask = $sysModel->getBitmaskForRoute($route); $bitmask = $sysModel->getBitmaskForRoute($route);
if(!($bitmask & $userMark)) if(!($bitmask & $userMark))
{ {
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует: '.$bitmask); throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует: '.$route);
} }
} }
} }
public function action_index() public function action_index()
{ {
$page = Request::factory($this->UserInfo['Type'].'/index')->execute(); $page = Request::factory($this->UserInfo['AccType'].'/index')->execute();
$this->response->body($page); $this->response->body($page);
} }
public function action_profile() public function action_profile()
{ {
$url = $this->UserInfo['Type']."/profile"; $url = $this->UserInfo['AccType']."/profile";
if(!empty($type)) if(!empty($type))
$url .= '/'.$type; $url .= '/'.$type;
if(!empty($id)) if(!empty($id))
...@@ -45,7 +45,7 @@ class Controller_UserEnvi extends Controller { ...@@ -45,7 +45,7 @@ class Controller_UserEnvi extends Controller {
public function action_settings() public function action_settings()
{ {
$page = Request::factory($this->UserInfo['Type'].'/settings')->execute(); $page = Request::factory($this->UserInfo['AccType'].'/settings')->execute();
$this->response->body($page); $this->response->body($page);
} }
} }
...@@ -106,7 +106,7 @@ class Model_Teacher_Map extends Model ...@@ -106,7 +106,7 @@ class Model_Teacher_Map extends Model
public function GetSubjectList() public function GetSubjectList()
{ {
$sql = "CALL `GetSubjectList`(); "; $sql = "CALL `GetSubjects`(); ";
return DB::query(Database::SELECT, $sql)->execute(); return DB::query(Database::SELECT, $sql)->execute();
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment