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
(2, 'teacher', 'Преподаватель', 2),
(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>)')
/* --------------- Общие ссылки ---------------- */
Route::set('index', 'index')
Route::set('common:index', 'index')
->defaults(array(
'controller' => 'UserEnvi',
'action' => 'index'
));
Route::set('settings', 'settings')
Route::set('common:settings', 'settings')
->defaults(array(
'controller' => 'UserEnvi',
'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(
'controller' => 'UserEnvi',
'action' => 'profile'
......@@ -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(
'directory' => 'student',
'controller' => 'subject',
......@@ -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){
if($request->is_initial())
return FALSE;
......@@ -218,7 +218,7 @@ Route::set('stdnt:index', 'student/index')
'action' => 'index'
));
Route::set('stdnt:settings', 'student/settings')
Route::set('student:settings', 'student/settings')
->filter(function($route, $params, $request){
if($request->is_initial())
return FALSE;
......@@ -229,7 +229,7 @@ Route::set('stdnt:settings', 'student/settings')
'action' => 'settings'
));
Route::set('stdnt:profile', 'student/profile')
Route::set('student:profile', 'student/profile')
->filter(function($route, $params, $request){
if($request->is_initial())
return FALSE;
......@@ -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(
'directory' => 'teacher',
'controller' => 'map',
'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(
'directory' => 'teacher',
'controller' => 'map',
'action' => 'edit'
));
Route::set('rating', 'rating/<id>', array('id' => '[0-9]+'))
Route::set('teacher:rating', 'rating/<id>', array('id' => '[0-9]+'))
->defaults(array(
'directory' => 'teacher',
'controller' => 'rating',
......@@ -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){
if($request->is_initial())
return FALSE;
......@@ -275,7 +275,7 @@ Route::set('tchr:index', 'teacher/index')
'action' => 'index'
));
Route::set('tchr:settings', 'teacher/settings')
Route::set('teacher:settings', 'teacher/settings')
->filter(function($route, $params, $request){
if($request->is_initial())
return FALSE;
......@@ -286,7 +286,7 @@ Route::set('tchr:settings', 'teacher/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){
if($request->is_initial())
return FALSE;
......
......@@ -52,30 +52,26 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
public function action_create()
{
$twig = Twig::factory('teacher/map/create');
$db = new Model_Teacher_Map;
$db = new Model_Teacher_Map;
$twig->User = $this->UserInfo;
$twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList;
echo Debug::vars($this->UserInfo);
$twig->GradesList = $this->GradesList;
$this->response->body($twig);
}
public function action_edit()
{
$twig = Twig::factory('teacher/map/edit');
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$map = $db->getMapForDiscipline($this->UserInfo['TeacherID'], $id);
$twig->User = $this->UserInfo;
$twig->Map = $this->getMapInfo($map);
$twig->Discipline = $this->getSubjectInfo($db, $id);
$twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList;
$this->response->body($twig);
$twig = Twig::factory('teacher/map/edit');
$twig->User = $this->UserInfo;
$twig->Map = $this->getMapInfo($map);
$twig->Discipline = $this->getSubjectInfo($db, $id);
$twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList;
$this->response->body($twig);
}
private function getMapInfo($map) {
......@@ -167,9 +163,9 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
foreach ($list as $row) {
$i++;
$SubjectsList[$i]['ID'] = $row['ID'];
$SubjectsList[$i]['Title'] = $row['Name'];
$SubjectsList[$i]['Abbr'] = $row['Abbr'];
$SubjectsList[$i]['ID'] = $row['SubjectID'];
$SubjectsList[$i]['Title'] = $row['SubjectName'];
$SubjectsList[$i]['Abbr'] = $row['SubjectAbbr'];
}
return $SubjectsList;
......
......@@ -21,20 +21,20 @@ class Controller_UserEnvi extends Controller {
$bitmask = $sysModel->getBitmaskForRoute($route);
if(!($bitmask & $userMark))
{
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует: '.$bitmask);
throw HTTP_Exception::factory(403, 'Не пытайтесь попасть туда, куда попадать не следует: '.$route);
}
}
}
public function action_index()
{
$page = Request::factory($this->UserInfo['Type'].'/index')->execute();
$page = Request::factory($this->UserInfo['AccType'].'/index')->execute();
$this->response->body($page);
}
public function action_profile()
{
$url = $this->UserInfo['Type']."/profile";
$url = $this->UserInfo['AccType']."/profile";
if(!empty($type))
$url .= '/'.$type;
if(!empty($id))
......@@ -45,7 +45,7 @@ class Controller_UserEnvi extends Controller {
public function action_settings()
{
$page = Request::factory($this->UserInfo['Type'].'/settings')->execute();
$page = Request::factory($this->UserInfo['AccType'].'/settings')->execute();
$this->response->body($page);
}
}
......@@ -106,7 +106,7 @@ class Model_Teacher_Map extends Model
public function GetSubjectList()
{
$sql = "CALL `GetSubjectList`(); ";
$sql = "CALL `GetSubjects`(); ";
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