- •Постановка завдання
- •1. Опис використаних технологій
- •1.2. JavaScript
- •1.3. Jquery
- •1.4. Html
- •1.7. Ajax
- •2. Діаграми uml об’єктної моделі системи
- •2.1 Діаграма варіантів використання
- •2.2 Діаграма дій
- •2.3 Діаграма послідовності
- •2.4. Діаграма кооперацій
- •2.5. Діаграми класів
- •2.6. Діаграми станів
- •3. Опис програмної реалізації
- •3.1. Опис серверної частини проекту
- •3.2. Опис клієнтської частини проекту
- •If(!groupInfo.CheckError)
- •If(checkNullUndefined(group))
- •3.3 Реалізація бази даних
- •3.4. Опис реалізованого функціоналу
- •Висновок
- •Список використаної літератури:
- •If(checkNullUndefined(groupId))
- •If(!groupInfo.CheckError)
- •If(!groupInfo.CheckError)
- •If(checkNullUndefined(groupId) && checkNullUndefined(newGroupId))
- •If(checkNullUndefined(groupId))
- •If(checkNullUndefined(studentId))
- •If(checkNullUndefined(studentId))
- •If(checkNullUndefined(studentId))
- •If(!studentInfo.CheckError)
- •If(!studentInfo.CheckError)
- •If(checkNullUndefined(studentId))
- •If(checkNullUndefined(group))
- •If(checkNullUndefined(group))
- •If(checkNullUndefined(student))
- •If(checkNullUndefined)
- •If(item.ClassList.Contains('popupWrapBox'))
If(checkNullUndefined(studentId))
{
student = this.StudentModel.getStudentById(studentId);
this.View.renderStudentInfoBox(student);
}
};
this.editUserShowBox = (studentRow) =>
{
var studentId = parseInt(studentRow.parentNode.parentNode.getAttribute('data-studentid')),
student = {},
allGroups = [];
If(checkNullUndefined(studentId))
{
allGroups = this.GroupModel.getAllGroupsArr();
student = this.StudentModel.getStudentById(studentId);
this.View.renderEditStudentBox(student, allGroups);
}
};
this.deleteUserShowBox = (studentRow) =>
{
var studentId = parseInt(studentRow.parentNode.parentNode.getAttribute('data-studentid'));
If(checkNullUndefined(studentId))
{
this.View.renderDeleteUserShowBox(studentId);
}
};
this.render = () =>
{
var allStudents = this.StudentModel.getAllStudents(),
allGroups = this.GroupModel.getAllGroupsArr();
this.View.renderStudentTable(allStudents, allGroups);
};
this.createStudent = () =>
{
var inputsBox = document.getElementById('createStudents').querySelectorAll('input, select'),
groupsIdArr = this.GroupModel.getAllGroupsIdArr(),
studentObj = {},
studentInfo = {};
studentInfo = this.studentBoxGetInputParams(inputsBox, groupsIdArr);
studentObj = studentInfo.data;
If(!studentInfo.CheckError)
{
this.StudentModel.createStudent(
studentObj,
() => this.render()
);
}
};
this.editStudent = () =>
{
var inputsBox = document.getElementById('editStudent').querySelectorAll('input, select'),
studentId = parseInt(document.getElementById('editStudent').getAttribute('data-studentid')),
groupsIdArr = this.GroupModel.getAllGroupsIdArr(),
studentObj = {},
studentInfo = {};
studentInfo = this.studentBoxGetInputParams(inputsBox, groupsIdArr);
studentObj = studentInfo.data;
If(!studentInfo.CheckError)
{
studentObj.studentId = studentId;
this.StudentModel.editStudent(
studentObj,
() => () => this.render()
);
}
};
this.deleteStudent = () =>
{
var studentId = parseInt(document.getElementById('deleteStudent').getAttribute('data-studentid'));
If(checkNullUndefined(studentId))
{
this.StudentModel.deleteStudent(
{studentId},
() => this.render()
);
}
};
}
/assets/js/model/CommonModel .js
function CommonModel()
{
this.basicErrorHandler = (code) =>
{
c('ERROR: ' + code);
};
}
/assets/js/models/GroupModel .js
function GroupModel()
{
this.groupsArr = [];
this.specialityKeys = {};
this.addNewGroup = (group) =>
{
this.groupsArr.push(group);
};
this.updateGroup = (group) =>
{
var groupId = group.id;
this.groupsArr.some((item, i) =>
{
if(item.id === groupId)
{
this.groupsArr[i] = group;
return true;
}
});
};
this.geleteGroup = (groupId) =>
{
this.groupsArr.forEach((item, i) =>
{
if(item.id === groupId)
{
this.groupsArr.splice(i, 1);
}
});
};
this.getAllGroupsStudentsRequest = (callbackFunc) =>
{
AjaxController('getAllGroupsStudents',
'groupController',
{},
({data: {groupsArr}, data: {studentsArr}, data: {specialityKeys}}) =>
{
this.groupsArr = groupsArr;
for(let key in specialityKeys)
{
this.specialityKeys[specialityKeys[key].id] = specialityKeys[key].name;
}
callbackFunc(groupsArr, studentsArr, this.specialityKeys);
},
this.basicErrorHandler
);
};
this.deleteGroup = ({groupId}, callbackFunc) =>
{
AjaxController('deleteGroup',
'groupController',
{groupId},
() =>
{
this.geleteGroup(groupId);
callbackFunc();
},
this.basicErrorHandler
);
};
this.createGroup = ({name, curatorNameLast, speciality}, callbackFunc) =>
{
AjaxController('createGroup',
'groupController',
{name, curatorNameLast, speciality},
({data: {group}}) =>
{
