コード例 #1
0
ファイル: main.py プロジェクト: erpreciso/school-tagging
    def initializeDashboard(self):
        teacher = self.getFromCookie()
        if not teacher:
	    return self.redirect("/t/login")
	if not teacher.currentLessonID:
	    return self.redirect("/t/login")
	language = teacher.language or objs.DEFAULT_LANGUAGE
	lesson = objs.getLesson(teacher.currentLessonID)
	if lesson:
	    templ = "teacherDashboard.html"
	    studentLabels = []
	    for studentName in lesson.students:
	        student = objs.getStudent(studentName, teacher.currentLessonID)
                if student:
		    studentLabels.append({"username":studentName,"fullname":student.fullname})
	    return self.renderPage(templ ,
				teacherName=teacher.fullname,
				lessonName=teacher.currentLessonName,
				students=studentLabels,
				token=teacher.token,
				language=language,
				labels=labdict.labels(templ, language),
				)
	else:
	    return self.redirect("/t/login")
コード例 #2
0
ファイル: main.py プロジェクト: erpreciso/school-tagging
 def get(self):
     link = None
     user = self.getFromCookie()
     if user and user.currentLessonID:
         lesson = objs.getLesson(user.currentLessonID)
         if lesson:
             if self.getRoleFromCookie() =="teacher":
                 link = "/t/dashboard"
             elif self.getRoleFromCookie() == "student":
                 link = "/s/dashboard"
     self.renderPage("start.html", resumeDashboardLink=link)
コード例 #3
0
ファイル: main.py プロジェクト: erpreciso/school-tagging
 def sendStats(self):
     teacher = self.getFromCookie()
     if not teacher:
         return self.redirect("/t/login")
     if not teacher.currentLessonID:
         return self.redirect("/t/login")
     lesson = objs.getLesson(teacher.currentLessonID)
     if lesson:
         return lesson.produceAndSendStats()
     else:
         return self.redirect("/t/login")
コード例 #4
0
ファイル: main.py プロジェクト: erpreciso/school-tagging
 def logout(self):
     teacher = self.getFromCookie()
     if teacher:
         self.clearCookies()
         if teacher.currentExercise:
             exercise = objs.getExercise(teacher.currentExercise)
             if exercise:
                 exercise.end()
         if teacher.currentLessonID:
             lesson = objs.getLesson(teacher.currentLessonID)
             if lesson:
                 lesson.end()
             teacher.logout()
     return self.redirect("/t/login")