Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
курc.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
606.17 Кб
Скачать

3.3 Реалізація бази даних

Рис. 10 Структура бд

Рис. 11 Таблиця груп - groups

Рис. 12 Таблиця студентів груп - groupStudents

Рис. 13 Таблиця факультетів - specialityKeys

Рис. 14 Таблиця студентів - students

Поле speciality табл. groups пов’язане зовнішнім ключем із таблицею specialityKeys.

Поле studentId табл. groupStudents пов’язане зовнішнім ключем із табл. students

Поле groupIdтабл. groupStudents пов’язане зовнішнім ключем із табл. Groups

3.4. Опис реалізованого функціоналу

Сторінка груп реалізує:

  • Таблиця груп

  • Створення групи

  • Видалення групи

  • Редагування групи

  • Переміщення усіх студентів у іншу групу

  • Видалення усіх студентів із групи

  • Відображення списку студентів групи при натисканні на рядок групи у таблиці

Рис. 15 Сторінка груп

Рис. 16 Список студентів групи

Рис. 17 Створення групи

Рис. 18 Редагування групи

Рис. 19 Видалення групи

Рис. 20 Переміщення студентів у іншу групу

Рис. 21 Видалення студентів із групи

Сторінка студентів реалізує:

  • Створення анкети студента

  • Таблиця студентів

  • Редагування даних студента

  • Видалення студента

Рис. 22 Сторінка студентів

Рис. 23 Створення анкети студента

Рис.21 Перегляд анкети студента

Рис. 22 Редагування анкети студента

Висновок

В процесі виконання курсового проекту, було розроблено WEB-додаток, який надає інформацію про групи і студентів. Забезпечує роботу із студентами та групами (є можливість створення , перегляду , редагування та видалення інформації). Має можливість зберігання інформації в базі даних.

На стороні клієнта використовується патерн MVC, на стороні сервера його часткова реалізація (View не використовується), тому спроектована система може бути розширена без значних змін у програмному коді.

Дані від клієнта проходять через подвійну валідацію: на стороні клієнта та на сервері, тобто ризик введення некоректних або небезпечних даних суттєво зменшився.

Усі запити веб-додатка використовують технологію AJAX. Завдяки цьому дані оновляються динамічно, без перезавантаження сторінки, це значно полегшує роботу з системою і зменшує навантаження на сервер.

У веб-додатку використовується патерн проектування Front Controller – єдина точка входу у додаток, це підвищує захист системи та спрощує та розширення проекту у разі потреби.

Список використаної літератури:

1. Завдстра, Мэтт. РНР: объекты, шаблоны и методики программирования, 4-е изд . Пер. с англ. - М.: ООО "И.Д. Вильяме", 201 5. - 576 с.: ил. - Пара л .

тит. англ .

2. Стефанов С. JavaScript. Шаблоны. – Пер. с англ. – СПб.: Символ-Плюс, 2011. – 272 с., ил. ISBN 978-5-93286-208-7

3. Грубер Мартин. Понимание SQL, 2007 – 302 c

Додаток А

/index.php

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<link rel="stylesheet" type="text/css" href="/assets/css/style.css">

<link rel="stylesheet" href="/assets/libs/font-awesome-4.7.0/css/font-awesome.min.css">

<title>Managment</title>

</head>

<body>

<div id="mainBox">

<div id="mainBoxHeader">

<div class="oneMainBoxHeaderName">

<buttonid="groupsButton"class="active"onclick="Group.showAllGroups()">Groups</button>

</div>

<div class="oneMainBoxHeaderName">

<buttonid="studentsButton" onclick="Student.showAllStudents()">Students</button>

</div>

<div id="addButtonBox">

<button onclick="Group.showCreateGroupBox()">+</button>

</div>

</div>

<div id="groupsTableBox">

<table>

<thead>

<th>Id</th>

<th>Group Name</th>

<th>Curator</th>

<th>Speciality</th>

<th>Count Students</th>

<th>Actions</th>

</thead>

<tbody></tbody>

</table>

</div>

<div id="studentsTableBox">

<table>

<thead>

<th>Id</th>

<th>Name</th>

<th>Last Name</th>

<th>Group Id</th>

<th>Group Name</th>

<th>Birthday</th>

<th>Actions</th>

</thead>

<tbody></tbody>

</table>

</div>

</div>

<?php require_once 'popups.php'; ?>

</body>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

<script src="/assets/js/controllers/AjaxController.js"></script>

<script src="/assets/js/controllers/StudentController.js"></script>

<script src="/assets/js/controllers/GroupController.js"></script>

<script src="/assets/js/models/CommonModel.js"></script>

<script src="/assets/js/models/StudentModel.js"></script>

<script src="/assets/js/models/GroupModel.js"></script>

<script src="/assets/js/views/CommonView.js"></script>

<script src="/assets/js/views/StudentView.js"></script>

<script src="/assets/js/views/GroupView.js"></script>

<script src="/assets/js/classes/Validator.js"></script>

<script src="/assets/js/actions.js"></script>

</html>

<script src="/assets/js/models/GroupModel.js"></script>

/assets/js/controllers/AjaxController.js

function AjaxController(action, controller, data, successHandler, errorHandler)

{

var dataTotal = {

requestInfo: {

action,

data,

controller

}

};

c(dataTotal);

$.ajax({

url:'http://Managment/db/main.php',

method:"POST",

contentType: "application/json",

data:JSON.stringify(dataTotal),

success: function(data)

{

var response = jQuery.parseJSON(data);

c(response)

if(response.code === '000')

{

successHandler(response);

}

else

{

errorHandler(response.code);

}

}

});

}

/assets/js/controllers/GroupController.js

function GroupController({GroupModel, StudentModel}, View)

{

this.View = View;

this.GroupModel = GroupModel;

this.StudentModel = StudentModel;

this.showCreateGroupBox = () =>

{

this.View.renderCreateGroupBox();

};

this.deleteGroupShowBox = (groupRow) =>

{

var groupId = parseInt(groupRow.parentNode.parentNode.getAttribute('data-groupid'));

if(checkNullUndefined(groupId))

{

this.View.renderDeleteGroupShowBox(groupId);

}

};

this.editGroupShowBox = (groupRow) =>

{

var groupId = parseInt(groupRow.parentNode.parentNode.getAttribute('data-groupid')),

group = {};

if(checkNullUndefined(groupId))

{

group = this.GroupModel.getGroupById(groupId);

this.View.renderEditGroupShowBox(group);

}

};

this.exchangeGroupShowBox = (groupRow) =>

{

var groupId = parseInt(groupRow.parentNode.parentNode.getAttribute('data-groupid')),

groupsArr = this.GroupModel.getAllGroupsArr();

if(checkNullUndefined(groupId))

{

this.View.renderExchangeGroupShowBox(groupId, groupsArr);

}

};

this.emptyGroupShowBox = (groupRow) =>

{

var groupId = parseInt(groupRow.parentNode.parentNode.getAttribute('data-groupid'));

if(checkNullUndefined(groupId))

{

this.View.renderEmptyGroupShowBox(groupId);

}

};

this.showGroupStudents = (groupRow) =>

{

var groupId = parseInt(groupRow.getAttribute('data-groupid')),

students = [];

if(checkNullUndefined(groupId))

{

students = this.StudentModel.getGroupStudents(groupId);

this.View.renderGroupStudentsTable(students);

}

};

this.render = () =>

{

var allGroups = this.GroupModel.getAllGroupsArr(),

allSpecialityKeys = this.GroupModel.getAllSpecialityKeysArr(),

allGroupsCountStudents = this.StudentModel.getAllGroupsCountStudents(allGroups);

this.View.renderGroupTable(allGroups, allGroupsCountStudents, allSpecialityKeys);

};

this.showAllGroups = () =>

{

this.render();

};

this.showAllGroupsRequest = () =>

{

var allGroupsCountStudents = {};

this.GroupModel.getAllGroupsStudentsRequest((groupsArr, studentsArr, specialityKeys) =>

{

if(checkNullUndefined(studentsArr) && studentsArr.length > 0)

{

this.StudentModel.setStudentsArr(studentsArr);

}

if(checkNullUndefined(groupsArr) && groupsArr.length > 0)

{

allGroupsCountStudents = this.StudentModel.getAllGroupsCountStudents(groupsArr);

this.View.renderGroupTable(groupsArr, allGroupsCountStudents, specialityKeys);

}

});

};

this.deleteGroup = () =>

{

var groupId = parseInt(document.getElementById('deleteGroup').getAttribute('data-groupid'));