public static function getMarks($month, $year, $class, $yearNum) { echo '<table class="table table-striped table-bordered">'; $students = StudentManagement::getStudentIds($year, $class); if ($students[0] == 'none') { echo "Ebben az osztályban nincsenek tanulók!"; } else { $subjects = SubjectHandler::getSubjectIds(); /*var_dump($students); for ($i = 0; $i < count($students) + 1; $i++) { echo '<tr>'; for ($j = 0; $j < count($subj)+1; $j++) { echo '<td>'; if ($i == 0 && $j == 0) { } else if ($i == 0 && $j != 0) { $su = new SubjectHandler($subj[$j - 1]['id']); $sName = $su->getName(); echo '<strong>' . $sName . '</strong>'; } else if ($j == 0 && $i != 0) { $s = new StudentManagement($students[$i-1]['id']); echo '<strong>' . $s->getName() . '</strong>'; } else { $marks = StudentManagement::getStudentMarks($students[$i-1]['id'],$month,$subj[$j-1]['id'],$yearNum); for($k = 0; $k<count($marks);$k++){ if($marks[$k] == 'none'){} else { if($k==0) { echo $marks[$k]['mark']; } else{ echo ", ".$marks[$k]['mark']; } } } } echo '</td>'; } echo '</tr>'; }*/ $nyear = $yearNum + 1; $db = new DatabaseConnection("localhost", "adminuser", "asd12345", "school"); $sql = "SELECT s.id, m.mark, m.subject_id FROM students s INNER JOIN marks m WHERE s.id = m.student_id AND s.year = ? AND s.class = ? AND (m.year = ? OR m.year = ?) AND m.month = ? ORDER BY s.id, m.subject_id"; $string = array($year, $class, $yearNum, $nyear, $month); $res = $db->select($sql, $string, true, 'isiii'); $id = $res[0]['id']; $subj = $res[0]['subject_id']; $s = new StudentManagement($id); echo '<thead><tr>'; for ($i = 0; $i < count($subjects) + 1; $i++) { if ($i != 0) { $subjObj = new SubjectHandler($subjects[$i - 1]['id']); echo '<td><strong>' . $subjObj->getName() . '</strong></td>'; } else { echo '<td></td>'; } } echo '</tr></thead>'; echo "<tr><td><strong>" . $s->getName() . "</strong></td>"; echo '<td>'; for ($i = 0; $i < count($res); $i++) { /*echo '<tr>'; $id = 1; $subj = 1; echo '</tr>';*/ if ($res[$i]['id'] != $id) { $s = new StudentManagement($res[$i]['id']); echo '</tr><tr><td><strong>' . $s->getName() . '</strong></td>'; $id = $res[$i]['id']; } if ($res[$i]['subject_id'] != $subj) { echo '</td><td>'; $subj = $res[$i]['subject_id']; } echo $res[$i]['mark'] . " "; } echo "</tr>"; echo '</td>'; } echo '</table>'; }
<?php /** * Created by PhpStorm. * Date: 2015.09.28. * Time: 23:16 */ require "model.php"; if (isset($_SESSION['status']) && $_SESSION['status']) { $logIn = new LoginTo($_SESSION['code'], $_SESSION['password'], $_SESSION['status']); $true = $logIn->logInCheck(true); } else { $true = false; } if ($true) { $year = $_POST['year']; $class = $_POST['class']; $students = TeacherManagement::getStudentsFromClass($year, $class); //var_dump($students); if ($students[0] == 'none') { echo '<select class="form-control" disabled><option>Diákok neve</option></select>'; } else { $write = '<select id="selectStudent" class="form-control">'; for ($i = 0; $i < count($students); $i++) { $s = new StudentManagement($students[$i]['id']); $write = $write . '<option value="' . $students[$i]['id'] . '">' . $s->getName() . '</option>'; } $write = $write . '</select>'; echo $write; } }
require "model.php"; if (isset($_SESSION['status']) && $_SESSION['status']) { $logIn = new LoginTo($_SESSION['code'], $_SESSION['password'], $_SESSION['status']); $true = $logIn->logInCheck(true); } else { $true = false; } if ($true) { $student = $_POST['student']; $subject = $_POST['subject']; $mark = $_POST['mark']; $teacher = $_SESSION['id']; $year = $_POST['year']; $month = $_POST['month']; if (isset($student) && is_numeric($student)) { if (isset($subject) && is_numeric($subject)) { if (isset($mark) && ($mark == 1 || $mark == 2 || $mark == 3 || $mark == 4 || $mark == 5)) { $t = new TeacherManagement($teacher); $true = $t->addMarks($student, $subject, $year, $month, $mark); $s = new StudentManagement($student); echo '<div class="left marg-left margin-top">A ' . $mark . '-s jegy sikeresen be lett írva ' . $s->getName() . ' részére!</div>'; } else { echo '<div class="left marg-left margin-top">A jegy csak valós jegyeket tartalmazhat! (1,2,3,4,5)</div>'; } } else { echo '<div class="left marg-left margin-top">Helytelen tantárgy!</div>'; } } else { echo '<div class="left marg-left margin-top">Helytelen diáknév!</div>'; } }
$true = false; } if ($true) { $year = $_POST['year']; $class = $_POST['class']; $students = TeacherManagement::getStudentsFromClass($year, $class); //var_dump($students); if ($students[0] == 'none') { echo 'Ebben az osztályban nincs diák!'; } else { echo '<table class="table table-striped table-bordered">'; echo '<thead>'; echo '<tr style="text-align: center;">'; echo '<td><strong>Diák neve</strong></td>'; echo '<td><strong>Hiányzott órák száma</strong></td>'; echo '<td><strong>Plusz egy hiányzás</strong></td>'; echo '<td><strong>Minusz egy hiányzás</strong></td>'; echo '</tr>'; echo '</thead>'; for ($i = 0; $i < count($students); $i++) { $s = new StudentManagement($students[$i]['id']); echo '<tr>'; echo '<td>' . $s->getName() . '</td>'; echo '<td style="text-align: center;">' . $s->getMisses() . ' óra </td>'; echo '<td style="text-align: center; cursor: pointer;" onclick="addMiss(' . $s->getId() . ',1)"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></td>'; echo '<td style="text-align: center; cursor: pointer;" onclick="addMiss(' . $s->getId() . ',-1)"><span class="glyphicon glyphicon-minus" aria-hidden="true"></span></td>'; echo '</tr>'; } echo '</table>'; } }