Skip to content
Snippets Groups Projects
Commit 0b4093e3 authored by PavelBegunkov's avatar PavelBegunkov
Browse files
parents 09939733 c88ad9f5
Branches
Tags
No related merge requests found
......@@ -364,8 +364,36 @@ class Controller_Handler_Map extends Controller_Handler {
$this->response->body(json_encode($data));
}
// Получаем список групп (позже нужно будет перенести в другой контроллер)(для поиска)
public function action_GetStudyGroups() {
$GroupList['success'] = false;
$this->post -> rule('Grade', 'digit')
-> rule('FacultyID', 'digit');
if($this->post->check()) {
$Groups = $this->model->GetStudyGroupsOrdByGroups($this->post->offsetGet('Grade'), $this->post->offsetGet('FacultyID'));
$GroupList = array();
$i = 0;
foreach($Groups as $row) {
$i++;
$GroupList[$i]['GroupID'] = $row['GroupID'];
$GroupList[$i]['GroupNum'] = $row['GroupNum'];
$GroupList[$i]['SpecID'] = $row['SpecID'];
$GroupList[$i]['SpecName'] = $row['SpecName'];
$GroupList[$i]['SpecAbbr'] = $row['SpecAbbr'];
}
$GroupList['count'] = $i;
if ($i > 0 )
$GroupList['success'] = true;
}
$this->response->body(json_encode($GroupList));
}
public function action_SearchStudents() {
// Поиск студентов
public function action_SearchStudents() {
$this->post -> rule('Grade', 'digit')
-> rule('GroupN', 'digit')
-> rule('FacultyID', 'digit');
......@@ -424,12 +452,36 @@ class Controller_Handler_Map extends Controller_Handler {
}
$this->response->body(json_encode($data));
}
// Получаем список кафедр (позже нужно будет перенести в другой контроллер)(для поиска)
public function action_GetDepartments() {
$DepList['success'] = false;
$this->post -> rule('FacultyID', 'not_empty')
-> rule('FacultyID', 'digit');
if($this->post->check()) {
$list = $this->model->GetDepartments($this->post->offsetGet('FacultyID'));
$DepList = array(); $i = 0;
foreach ($list as $row) {
$i++;
$DepList[$i]['DepID'] = $row['DepID'];
$DepList[$i]['DepName'] = $row['DepName'];
}
$DepList['count'] = $i;
if ($i > 0 )
$DepList['success'] = true;
}
$this->response->body(json_encode($DepList));
}
// Поиск преподавателей
public function action_SearchTeachers() {
$this->post -> rule('DepartmentID', 'digit');
if($this->post->check()) {
$SeResult = $this->model->SearchTeachers(
$this->FacultyID,
$this->post->offsetGet('FacultyID'),
$this->post->offsetGet('DepartmentID'),
$this->post->offsetGet('Last'),
$this->post->offsetGet('First'),
......@@ -447,6 +499,7 @@ class Controller_Handler_Map extends Controller_Handler {
$SearchResult[$i]['DepID'] = $row['DepID'];
}
$SearchResult['Count'] = $i;
}
$this->response->body(json_encode($SearchResult));
}
......
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Teacher_Map extends Controller_UserEnvi {
private $GradeID;
private $GradesList = array(
1 => array(
......@@ -58,8 +56,6 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$twig->Discipline = $this->getDisciplineInfo($db, $id);
$twig->SubjectsList = $this->GetSubjectsList($db);
$twig->GradesList = $this->GradesList;
//echo Debug::vars($twig->User);
$this->response->body($twig);
}
......@@ -86,7 +82,7 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$twig->User = $this->UserInfo;
$twig->Discipline = $this->getDisciplineInfo($db, $id);
$twig->GroupsForDiscipline = $this->GetGroupsForDiscipline($db, $id);
$twig->StudyGroups = $this->GetStudyGroupsOrdByGroups($db, $this->GradeID, $twig->Discipline['FacultyID']);
$twig->StudyGroups = $this->GetStudyGroupsOrdByGroups($db, $twig->Discipline['GradeID'], $twig->Discipline['FacultyID']);
$this->response->body($twig);
}
......@@ -100,6 +96,8 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$twig->User = $this->UserInfo;
$twig->Discipline = $this->getDisciplineInfo($db, $id);
$twig->Students = $this->GetStudentsList($db, $id);
$twig->GradesList = $this->GradesList;
$twig->StudyGroups = $this->GetStudyGroupsOrdByGroups($db, $twig->Discipline['GradeID'], $twig->Discipline['FacultyID']);
$this->response->body($twig);
}
......@@ -113,7 +111,8 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$twig->User = $this->UserInfo;
$twig->Discipline = $this->getDisciplineInfo($db, $id);
$twig->BindTeachersList = $this->GetTeachersForDiscipline($db, $id);
$twig->Departments = $this->GetDepartments($db, $twig->Discipline['FacultyID']);
$twig->FacultiesList = $this->GetFaculties($db);
$twig->Departments = $this->GetDepartments($db, $twig->Discipline['FacultyID']);
$twig->TeachersList = $this->GetTeachersByDepartment($db, $twig->Discipline['DepID']);
$this->response->body($twig);
......@@ -180,7 +179,6 @@ class Controller_Teacher_Map extends Controller_UserEnvi {
$subject['LectureHours'] = $info['LectionCount'];
$subject['PracticeHours'] = $info['PracticeCount'];
$subject['GradeID'] = $info['DisciplineGrade'];
$this->GradeID = $subject['GradeID'];
$teachersHandled = array(); $i = 0;
......
......@@ -26,9 +26,23 @@
<div class="SearchStudents">
<h2 class="BlueTitle">Поиск студентов</h2>
<div class="SearchSettings">
<select class="SelectGrade default_select">
<option value="0">Выберите курс:</option>
{% for Grade in GradesList %}
<option value="{{ Grade.ID }}" {% if Grade.ID == Discipline.GradeID %}selected{% endif %}>{{ Grade.Title }}</option>
{% endfor %}
</select>
<select class="SelectStudyGroup default_select">
<option value="0">Выберите группу:</option>
{% for Group in StudyGroups %}
<option value="{{ Group.GroupID }}">Группа {{ Group.GroupNum }} - {{ Group.SpecName }}</option>
{% endfor %}
</select>
<input tupe="text" class="InputStudentName default_input_text" placeholder="Фамилия Имя Отчество" value="">
</div>
<div class="SearchResult"></div>
<div class="SearchResult">
</div>
</div>
</div>
{% endblock %}
......@@ -17,13 +17,17 @@
<h2 class="BlueTitle">Поиск преподавателей</h2>
<div class="SearchSettings">
<input type="hidden" class="HiddenInputFacultyID" value="{{ Discipline.FacultyID }}">
<input tupe="text" class="InputTeacherName default_input_text" placeholder="Фамилия Имя Отчество" value="">
<select class="SelectFaculty default_select">
{% for Faculty in FacultiesList %}
<option value="{{ Faculty.FacultyID }}" {% if Discipline.FacultyID == Faculty.FacultyID %}selected{% endif %}>{{ Faculty.FacultyName }}</option>
{% endfor %}
</select>
<select class="SelectDepartment default_select">
<option value="0">-- Выберите кафедру --</option>
{% for Dep in Departments %}
<option value="{{ Dep.DepID }}" {% if User.DepID == Dep.DepID %}selected{% endif %}>{{ Dep.DepName }}</option>
<option value="{{ Dep.DepID }}" {% if Discipline.DepID == Dep.DepID %}selected{% endif %}>{{ Dep.DepName }}</option>
{% endfor %}
</select>
<input tupe="text" class="InputTeacherName default_input_text" placeholder="Фамилия Имя Отчество" value="">
</div>
<div class="SearchResult">
{% for Teacher in TeachersList %}
......
......@@ -265,6 +265,32 @@
cursor: pointer;
border-bottom: 1px solid #009933;
}
.SearchStudents {
display: block;
margin-top: 20px;
}
.SearchStudents .SearchSettings {
background: #f4f4f4;
margin: 10px 0;
padding: 10px 0;
}
.SearchStudents .SearchSettings .SelectGrade {
float: left;
width: 48%;
margin-left: 1%;
}
.SearchStudents .SearchSettings .SelectStudyGroup {
float: right;
width: 48%;
margin-right: 1%;
}
.SearchStudents .SearchSettings .InputStudentName {
clear: both;
margin: 0 1%;
margin-top: 10px;
width: 98%;
}
/* Прикрипление преподавателей */
.TeachersList {
width: auto
......@@ -309,13 +335,23 @@
margin-top: 20px;
}
.SearchTeachers .SearchSettings {
background: #f4f4f4;
margin: 10px 0;
padding: 10px 0;
}
.SearchTeachers .SearchSettings .InputTeacherName {
float: right;
width: 49%;
.SearchTeachers .SearchSettings .SelectFaculty {
float: left;
width: 48%;
margin-left: 1%;
}
.SearchTeachers .SearchSettings .SelectDepartment {
float: left;
width: 49%;
float: right;
width: 48%;
margin-right: 1%;
}
.SearchTeachers .SearchSettings .InputTeacherName {
clear: both;
margin: 0 1%;
margin-top: 10px;
width: 98%;
}
\ No newline at end of file
......@@ -511,14 +511,16 @@ return '\
<span class="action Action_BindStudent">Прикрепить студента</span>\
</div>';
}
$('.InputStudentName').focusout(function(){
// Поиск студентов
function CallSearchStudents() {
var Name = [];
Name = ($('.InputStudentName ').val()).split(' ');
$.post(
'/~dev_rating/handler/map/SearchStudents',
{
'Grade': 0, //$('.SelectDepartment').val(),
'GroupN': 0,
'Grade': $('.SelectGrade').val(),
'GroupN': $('.SelectStudyGroup').val(),
'FacultyID': FacultyID,
'Last': Name[0],
'First': Name[1],
......@@ -535,10 +537,39 @@ $('.InputStudentName').focusout(function(){
$('.SearchResult').append(AddStudent(ID, Name, From));
}
else
$('.SearchResult').html('Нет результатов');
$('.SearchResult').html('<p class="notification">Нет результатов</p>');
}
);
}
$('.SelectGrade').change(function(){
$.post(
'/~dev_rating/handler/map/GetStudyGroups',
{
'FacultyID': FacultyID,
'Garde': $('.SelectGrade').val()
},
function(data){
data = $.parseJSON(data);
if (data != null && data != undefined) {
$('.SelectStudyGroup').html('');
for (i = 1; i <= data.count; i++) {
$('.SelectStudyGroup').append('<option value="'+ data[i].GroupID +'">'+ data[i].GroupNum +'</option>');
}
if (data.count <= 0)
$('.SelectStudyGroup').append('<option value="0">Нет групп</option>');
}
CallSearchStudents();
}
);
});
$('.SelectStudyGroup').change(function(){
CallSearchStudents();
});
$('.InputStudentName').focusout(function(){
CallSearchStudents();
});
// Прикрепить студента
$('.StudentsList').on('click', '.Action_BindStudent', function(){
......@@ -592,6 +623,7 @@ $('.StudentsList').on('click', '.Action_UnbindStudent', function(){
);
});
// Добавить преподавателя
function AddTeacher(ID, Name, Action){
$r = '\
<div class="Teacher" id="'+ ID +'">\
......@@ -613,7 +645,7 @@ function CallSearchTeachers(){
$.post(
'/~dev_rating/handler/map/SearchTeachers',
{
'FacultyID': FacultyID,
'FacultyID': $('.SelectFaculty').val(),
'DepartmentID': $('.SelectDepartment').val(),
'Last': Name[0],
'First': Name[1],
......@@ -621,17 +653,43 @@ function CallSearchTeachers(){
},
function(data){
SearchResult = $.parseJSON(data);
$('.SearchResult').html('');
if (parseInt(SearchResult.Count) > 0)
for(var i = 1; i <= parseInt(SearchResult.Count); i++) {
var Name = SearchResult[i].TeacherLast + ' ' + SearchResult[i].TeacherFirst + ' ' + SearchResult[i].TeacherSecond;
$('.SearchResult').append(AddTeacher(SearchResult[i].TeacherID, Name, 'Bind'));
}
else
$('.SearchResult').html('Нет результатов');
if (SearchResult != null && SearchResult != undefined) {
$('.SearchResult').html('');
if (parseInt(SearchResult.Count) > 0)
for(var i = 1; i <= parseInt(SearchResult.Count); i++) {
var Name = SearchResult[i].TeacherLast + ' ' + SearchResult[i].TeacherFirst + ' ' + SearchResult[i].TeacherSecond;
$('.SearchResult').append(AddTeacher(SearchResult[i].TeacherID, Name, 'Bind'));
}
else
$('.SearchResult').html('<p class="notification">Нет результатов</p>');
}
}
);
}
// Выборка кафедр
$('.SelectFaculty').change(function(){
$.post(
'/~dev_rating/handler/map/GetDepartments',
{
'FacultyID': $('.SelectFaculty').val()
},
function(data){
data = $.parseJSON(data);
if (data != null && data != undefined) {
$('.SelectDepartment').html('');
for (i = 1; i <= data.count; i++) {
$('.SelectDepartment').append('<option value="'+ data[i].DepID +'">'+ data[i].DepName +'</option>');
}
if (data.count <= 0)
$('.SelectDepartment').append('<option value="0">Нет кафедр</option>');
}
CallSearchTeachers();
}
);
});
$('.SelectDepartment ').change(function(){
CallSearchTeachers();
});
......
......@@ -3,6 +3,10 @@ function isNum(v) {
return typeof v === 'number' && isFinite(v);
}
function is_object(obj){
return (typeof obj == "object");
}
// Разрешаем вводить только цифры
function KeyDownOnlyNumber(event) {
// Разрешаем: backspace, delete, tab и escape
......
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