Newer
Older
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Teacher_Discipline extends Controller_UserEnvi {
$twig = Twig::factory('teacher/discipline/CreateDiscipline');
$db = new Model_Teacher_Map;
$twig->FacultiesList = Model_Faculties::create()->common()->asArray();
$twig->SubjectsList = Model_Subjects::create()->byFaculty($this->UserInfo['FacultyID'])->asArray();
$twig->GradesList = Model_Grades::create()->common()->asArray();
$this->response->body($twig);
{
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$twig = Twig::factory('teacher/discipline/EditSettings');
//$twig->FacultiesList = Model_Faculties::create()->common()->asArray();
$twig->Discipline = $this->GetDisciplineInfo($db, $id);
$twig->SubjectsList = Model_Subjects::create()->byFaculty($this->UserInfo['FacultyID'])->asArray();
$twig->GradesList = Model_Grades::create()->common()->asArray();
{
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$twig = Twig::factory('teacher/discipline/EditStructure');
$twig->Discipline = $this->GetDisciplineInfo($db, $id);
$twig->Map = $this->GetMapInfo($db->getMapForDiscipline($id));
$this->response->body($twig);
}
public function action_EditGroups()
{
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$twig = Twig::factory('teacher/discipline/EditGroups');
$twig->User = $this->UserInfo;
$twig->Discipline = $this->GetDisciplineInfo($db, $id);
$twig->GroupsForDiscipline = Model_Groups::create()->forDiscipline($id)->asArray();
$twig->Groups = Model_Groups::create()->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray();
public function action_EditStudents()
{
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$twig = Twig::factory('teacher/discipline/EditStudents');
$twig->User = $this->UserInfo;
$twig->Discipline = $this->GetDisciplineInfo($db, $id);
$twig->GradesList = Model_Grades::create()->common()->asArray();
$twig->Groups = Model_Groups::create()->ordByGroups($twig->Discipline['GradeID'], $twig->Discipline['FacultyID'])->asArray();
if ($row['GroupID'] != $groupID) {
$groupID = $row['GroupID'];
$k++;
$n = 0;
$attachStdHandled[$k]['GroupID'] = $row['GroupID'];
$attachStdHandled[$k]['GradeID'] = $row['GradeID'];
$attachStdHandled[$k]['GradeNum'] = $row['GradeNum'];
$attachStdHandled[$k]['GroupNum'] = $row['GroupNum'];
$attachStdHandled[$k]['Degree'] = Model_Grades::getDegreeTitle($row['Degree']);
$attachStdHandled[$k]['students'][$n]['ID'] = $row['ID'];
$attachStdHandled[$k]['students'][$n]['LastName'] = $row['LastName'];
$attachStdHandled[$k]['students'][$n]['FirstName'] = $row['FirstName'];
$attachStdHandled[$k]['students'][$n]['SecondName'] = $row['SecondName'];
$attachStdHandled[$k]['students'][$n]['AttachType'] = $row['AttachType'];
// $k++;
// $attachStdHandled['StdCount'] += 1;
// $attachStdHandled[$k]['StudentID'] = $row['StudentID'];
// $attachStdHandled[$k]['LastName'] = $row['LastName'];
// $attachStdHandled[$k]['FirstName'] = $row['FirstName'];
// $attachStdHandled[$k]['SecondName'] = $row['SecondName'];
// $attachStdHandled[$k]['StudentID'] = $row['StudentID'];
// $attachStdHandled[$k]['GroupID'] = $row['GroupID'];
// $attachStdHandled[$k]['GradeID'] = $row['GradeID'];
// $attachStdHandled[$k]['GradeNum'] = $row['GradeNum'];
// $attachStdHandled[$k]['GroupNum'] = $row['GroupNum'];
// $attachStdHandled[$k]['Degree'] = $row['Degree'];
}
else
{
if ($row['GroupID'] != $groupID) {
$groupID = $row['GroupID'];
$i++;
$j = 0;
$stdHandled[$i]['GroupID'] = $row['GroupID'];
$stdHandled[$i]['GradeID'] = $row['GradeID'];
$stdHandled[$i]['GradeNum'] = $row['GradeNum'];
$stdHandled[$i]['GroupNum'] = $row['GroupNum'];
$stdHandled[$i]['Degree'] = Model_Grades::getDegreeTitle($row['Degree']);
$stdHandled[$i]['students'][$j]['ID'] = $row['ID'];
$stdHandled[$i]['students'][$j]['LastName'] = $row['LastName'];
$stdHandled[$i]['students'][$j]['FirstName'] = $row['FirstName'];
$stdHandled[$i]['students'][$j]['SecondName'] = $row['SecondName'];
$stdHandled[$i]['students'][$j]['AttachType'] = $row['AttachType'];
$twig->Groups = $stdHandled;
$twig->GroupsAttached = $attachStdHandled;
public function action_EditTeachers()
{
$id = $this->request->param('id');
$db = new Model_Teacher_Map;
$twig = Twig::factory('teacher/discipline/EditTeachers');
$twig->User = $this->UserInfo;
$twig->Discipline = $this->getDisciplineInfo($db, $id);
$twig->BindTeachersList = Model_Teachers::create()->forDiscipline($id)->asArray();
$twig->FacultiesList = Model_Faculties::create()->common()->asArray();
$twig->Departments = Model_Departments::byFaculty($this->UserInfo['FacultyID']);
$mapHandled = array();
$maxRate = 0; $i = 0; $module = 0;
foreach($map as $row)
if($row['ModuleID'] != $module)
{
$i++;
$module = $row['ModuleID'];
$mapHandled[$i]['ModuleID'] = $row['ModuleID'];
$mapHandled[$i]['ModuleType'] = $row['ModuleType'];
if ($row['ModuleType'] == 'bonus')
$mapHandled['isSetBonus'] = true;
$mapHandled[$i]['CurrentControl'] = 0;
$mapHandled[$i]['LandmarkControl'] = 0;
}
if(!isset($mapHandled[$i]['SubmodulesCount']))
{
$mapHandled[$i]['SubmodulesCount'] = 0;
$mapHandled[$i]['MaxRate'] = 0;
}
$j = $mapHandled[$i]['SubmodulesCount'] += 1;
$mapHandled[$i]['MaxRate'] += (int) $row['MaxRate'];
$mapHandled[$i]['ModuleTitle'] = $row['ModuleName'];
$mapHandled[$i][$j]['SubmoduleID'] = $row['SubmoduleID'];
$mapHandled[$i][$j]['Description'] = $row['SubmoduleDescription'];
$mapHandled[$i][$j]['SubmoduleControl'] = $row['SubmoduleType'];
$mapHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate'];
$maxRate += $row['MaxRate'];
$mapHandled[$i]['CurrentControl'] += (int) $row['MaxRate'];
$mapHandled[$i]['LandmarkControl'] += (int) $row['MaxRate'];
$mapHandled['ModulesCount'] = $i;
$mapHandled['MaxRate'] = (int) $maxRate;
if ($mapHandled['isSetBonus'] == true)
$mapHandled['MaxRate'] = $mapHandled['MaxRate'] - 10;
return $mapHandled;
public function GetDisciplineInfo(Model_Teacher_Map $db, $id)
$info = $db->getDisciplineInfoByID($id);
if($info->count() == 0)
throw HTTP_Exception::factory(404, "Учебная карта дисциплины с ID $id не найдена!");
else
$info = $info->offsetGet(0);
$subject['AuthorID'] = $info['AuthorID'];
if($this->UserInfo['TeacherID'] != $subject['AuthorID'])
throw HTTP_Exception::factory(403, "Недостаточно прав для редактирования.");
$subject['DisciplineID'] = $id;
$subject['DepID'] = $info['DepID'];
$subject['FacultyID'] = $info['FacultyID'];
$subject['IsLocked'] = $info['IsLocked'];
$subject['IsBonus'] = $info['IsBonus'];
$subject['SemesterID'] = $info['SemesterID'];
$semester = Model_Semesters::getInfo($subject['SemesterID']);
$subject['SemesterNum'] = $semester['SemesterNum'] == 1 ? 'Осенний' : 'Весенний';
$subject['SemesterYear'] = $semester['SemesterYear'];
$teachers = Model_Teachers::create()->forDiscipline($id)->asArray();
$subject['SubjectName'] = $info['SubjectName'];
$subject['SubjectID'] = $info['SubjectID'];
$subject['ExamType'] = $info['ExamType'];
$subject['PracticeHours'] = $info['PracticeCount'];
$subject['LabHours'] = $info['LabCount'];
$subject['GradeID'] = $info['GradeID'];
$teachersHandled = array(); $i = 0;
foreach ($teachers as $row) {
$teachersHandled[$i] = $row['LastName'].' '.$row['FirstName'].'';
if(!empty($row['SecondName']))
$i++;
$subject['Teachers'] = implode(', ', $teachersHandled);