Logging in (applies to both Desktop and Mobile Applications)
Mobile and desktop users will need to be given the database address and password in order to log in, and mobile users (a.k.a. Teachers) will be unable to log in until an administrator sets up their account through the desktop application. The algorithm should check in the “Users” table of the database for the username and password requested, and if they match a user get their access privileges and show them the appropriate form (Desktop) or allow/deny access on Mobile.
Username = USERINPUT
Password = USERINPUT
Success = FALSE
sqlConnection = connectionString #connectionString is public – Database info
sqlConnection.Open()
WHILE sqlReader.Read(UserName, UserPassword, AccessRights FROM dbo.Users)
tempUser = sqlReader(UserName, UserPassword, AccessRights)
listOfUsers.ADD(tempUser)
ENDWHILE
FOR i = 1 TO listOfUsers.Length
IF Username = listOfUsers[i].UserName AND Password = listOfUsers[i].UserPassword
Success = TRUE
CheckAccessRights(listOfUsers[i]) #on desktop, will grant access to secretaries and administrators only – on mobile, teachers only
ENDIF
ENDFOR
IF Success = FALSE
OUTPUT “Incorrect login credentials, please try again.”
ENDIF
Signing up (applies to Desktop Application – Administrators Only)
One user named “admin” will be provided to the school along with the database information, so they are able to begin registering other users. The initial administrator will have to enter a new password after the first login, and from there they can use the Users Management tab in the Desktop Application to register new Administrators, Secretaries or Teachers.
Username = USERINPUT
Password = USERINPUT
FirstName = USERINPUT
LastName = USERINPUT
Access = USERINPUT
IF Username != “” AND Password != “” AND FirstName != “”
sqlConnection = connectionString #connectionString is public – DB info
sqlConnection.Open()
sqlExecute(“INSERT INTO dbo.USERS VALUES Username, Password, FirstName, LastName, Access;”)
ELSE
OUTPUT “Username, Password and First Name cannot be empty.”
ENDIF
Registering Students (applies to Desktop Application – Administrators and Secretaries Only)
From the control panel, students may be registered in bulk or individually. The former option requires a correctly written csv file to be imported, whereas the latter displays a new form to register the new Student.
#Adding from flat file
fileLocation = USERINPUT
WHILE csvReader.READ(fileLocation)
listOfStudents.ADD(SeparateCSVrow(csvReader.CurrentLine))
ENDWHILE
UploadStudents(listOfStudents)
#Adding individually
FirstName = USERINPUT
LastName = USERINPUT
MothersName = USERINPUT
FathersName = USERINPUT
ThirdName = USERINPUT
ThirdRole = USERINPUT
MotherPhone = USERINPUT
FatherPhone = USERINPUT
ThirdPhone = USERINPUT
Group = USERINPUT
IF FirstName != “” AND LastName != “” AND MothersName != “” AND FathersName != “” AND ThirdName != “” AND MotherPhone != “” AND FatherPhone != “” AND ThirdPhone != “” AND Group != “”
sqlConnection = connectionString #connectionString is public – DB info
sqlConnection.Open()
sqlExecute(“INSERT INTO dbo.Students VALUES FirstName, LastName, MothersName, FathersName, ThirdName, ThirdRole, MotherPhone, FatherPhone, ThirdPhone, Group;”)
ELSE
OUTPUT “Student information cannot be empty.”
ENDIF
Adding “Teachings”, A.K.A. the Teacher’s Timetable (applies to Desktop Application – Administrators Only)
From the control panel, an administrator may upload the timetable of each Teacher so that the mobile application can be utilised by them later. This will also be done by importing a csv file.
#importing flat file containing numeric IDs of lessons organised in days and periods (columns and rows)
fileLocation = USERINPUT
j = 0
WHILE csvReader.READ(fileLocation) OR j != 4
FOR i = 0 TO 6
teachingsArr[i, j] = SeparateCSVrow(csvReader.CurrentLine)
ENDFOR
j = j + 1
ENDWHILE
UploadTeachings(teachingsArr)
Creating ‘teaching’ dates and semesters (applies to Desktop Application – Administrators Only)
Administrators may create and delete dates for which Teachers may take attendance as Semesters. Sundays and Saturdays will be registered as non-teaching dates.
initialDate = USERINPUT
finalDate = USERINPUT
semesterID = USERINPUT
FOREACH DATE i BETWEEN initialDate AND finalDate
sqlExecute(“INSERT INTO dbo.Dates VALUES i, semesterID;”)
ENDFOR
Disabling access to specific tabs in the control panel if the user logged in is a secretary (applies to Desktop Application)
As the user is switching tabs in the desktop control panel an event is “fired”, which can be linked to a custom method. Every time a tab is selected, the access rights of the currently logged-in user are checked, and if they are a secretary they should be denied access to 3 tabs in the control panel every time they are clicked on.
IF currentUser.access = ‘s’
IF selectedTab != allowedAccessLvlTabs
selectedTab.Reset()
OUTPUT “You do not have permission to access this tab”
ENDIF
ENDIF
Changing a user’s password
Although administrators may not read the passwords of other users in the desktop control panel, they may ‘reset’ their passwords by entering a new password for them. The new password requires to be identical for two entries in order for changes to take effect.
NewPassword = USERINPUT
RepeatPasswd = USERINPUT
SelectedUser = USERINPUT
IF NewPassword = “” OR RepeatPasswd = “”
OUTPUT “New password cannot be empty”
ELSE
IF NewPassword = RepeatPasswd
sqlConnection = connectionString #connectionString is public – DB info
sqlConnection.Open()
sqlExecute(“UPDATE dbo.USERS SET Password = “, NewPassword, “WHERE UserName = “, SelectedUser, ”;”)
ELSE
OUTPUT “The passwords do not match”
ENDIF
Filling in the register (applies to Mobile application)
Teachers should be able to see the correct list of students for the period they select. This list will either be generated from the “Absences” table if the register has been submitted before for that date and period or from the Students table if the former condition is not applicable. In this case, only students from the correct group may be selected so that the appropriate Absence information can be sent to the “Absences” table.
IF attendancesTaken
FetchStudents(groupOfTimeTable)
FetchRegister(groupOfTimeTable, period, date)
ELSE
FetchStudents(groupOfTimeTable)
SetEmptyRegister()
ENDIF
Register = USERINPUT #Register is a list containing the students and their status
IF attendancesTaken
UpdateRegister(Register)
ELSE
SetRegister(Register)
ENDIF
Getting the correct schedule from the timetable according to what day it is on start-up (applies to Mobile application)
As the signed-in user opens the application, it should immediately populate a selectable list of their lessons schedule from the “Teachings” table, along with the lesson name from the “Lessons” table so that selecting the period they want to take the register for is as seamless and clear as possible.
currentDate = CalculateDateNow()
currentDay = CalculateDayNow(currentDate) #1-7 from week days
todaysLessons = GetTeachings(currentDay, loggedInUser)
UpdateList(todaysLessons)