Skip to content
Snippets Groups Projects
Rating.php 3.41 KiB
Newer Older
<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Teacher_Rating extends Controller_UserEnvi {
    
    public function action_edit()
    {
        $twig = Twig::factory('teacher/rating');
        $twig->User = $this->UserInfo;
        $db = new Model_Teacher_Rating;
Антон Шалимов's avatar
Антон Шалимов committed
		
            throw HTTP_Exception::factory (404, "Для дисциплины с ID $id не создана УКД или такой дисциплины не существует!");
            if(!isset($disciplineHandled[$i]['SubmodulesCount']))
            {
                $disciplineHandled[$i]['SubmodulesCount'] = 0;
                $disciplineHandled[$i]['MaxRate'] = 0;
            }
            $j = $disciplineHandled[$i]['SubmodulesCount'] += 1;
            $disciplineHandled[$i]['MaxRate'] += (int) $row['MaxRate'];
            $disciplineHandled[$i]['ModuleTitle'] = $row['ModuleName'];
            $disciplineHandled[$i][$j]['Title'] = $row['SubModuleName'];
            $disciplineHandled[$i][$j]['Description'] = $row['SubmoduleDescription'];
            $disciplineHandled[$i][$j]['MaxRate'] = (int) $row['MaxRate'];
            $maxRate += $row['MaxRate'];
        }
        $disciplineHandled['ModulesCount'] = $i;
        $disciplineHandled['MaxRate'] = (int) $maxRate; 
Anton's avatar
Anton committed
        $students = $db->GetStudentsForRating($this->UserInfo['TeacherID'], $id);
Anton's avatar
Anton committed
        $i = 0;
		
Anton's avatar
Anton committed
			$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'];
			if ($row['Degree'] == 'bachelor')
				$studentsHandled[$i]['GradeTitle'] = $row['Grade'].' курс';
			if ($row['Degree'] == 'specialist')
				$studentsHandled[$i]['GradeTitle'] = $row['Grade'].' курс';
			if ($row['Grade'] == 'master')
				$studentsHandled[$i]['GradeTitle'] = 'Магистратура, '.$row['Grade'].' год';
Anton's avatar
Anton committed
			$studentsHandled[$i]['GroupNum'] = $row['GroupNum'];
Anton's avatar
Anton committed
			$rate = $db->getMapForStudent($row['StudentID'], $id);
			$j = 0;
			foreach($rate as $r) {
					$j += 1;
					$studentsHandled[$i][$j]['SubmoduleID'] = $r['SubmoduleID'];
					$studentsHandled[$i][$j]['Rate'] = $r['Rate'];
Anton's avatar
Anton committed
			$studentsHandled[$i]['RateCount'] = $j;