def getCourseIDSForNewYear(self, level): sql ="SELECT courses.id, courses.course_name \ FROM courses \ INNER JOIN courses_by_year ON (int(courses.id) = int(courses_by_year.course_id)) \ WHERE courses_by_year.schYr=%d \ AND courses.course_level=%d" % (gVar.schYr, int(level)) res = fetch.getAllDict(sql) ##rint sql, res return res
def dispalyDataForLastYearsKelases (self, level, row): # last years classes grid = self.grid sql ="SELECT Kode, Nama, Sekolah FROM Kelas WHERE course_level=%d AND TahunAjaran =%d" % (level, gVar.schYr-1) classes = fetch.getAllDict(sql) if classes: self.labelRowKelas(row) grid.AppendRows(1); row += 1 #rintrow, 'D rows=', grid.GetNumberRows() tot_now, tot_out, tot_cont, tot_retake, sub_tot, tot_tot = (0, 0, 0, 0, 0, 0) for myClass in classes: KKode = myClass['Kode'] class_name = myClass['Nama'] now = fetch.batchPopulation(KKode) #GetClassPopulation tot_now +=now cont = fetch.numberOfStudents_reregistering(KKode) tot_cont +=cont out = fetch.numberOfStudents_leaving(KKode) tot_out += out retake = fetch.numberOfStudents_retaking(KKode) tot_retake += retake sub_tot = cont + retake tot_tot += sub_tot grid.SetRowAttr(row, self.attrDetailsKelas) grid.SetCellValue( row, 0, "Kelas") grid.SetCellValue( row, 1, str(KKode)) grid.SetCellValue( row, 2, class_name) grid.SetCellValue( row, 3, str(now)) grid.SetCellValue( row, 4, str(out)) grid.SetCellValue( row, 5, str(cont)) grid.SetCellValue( row, 6, str(retake)) grid.SetCellValue( row, 7, str(sub_tot)) grid.AppendRows(1); row += 1 #rintrow, 'E rows=', grid.GetNumberRows() # display totals grid.SetRowAttr(row, self.attrTotalsKelas) grid.SetCellValue( row, 0, "totals") grid.SetCellValue( row, 3, str(tot_now)) grid.SetCellValue( row, 4, str(tot_out)) grid.SetCellValue( row, 5, str(tot_cont)) grid.SetCellValue( row, 6, str(tot_retake)) grid.SetCellValue( row, 7, str(tot_tot)) grid.AppendRows(1); row += 1 #rintrow, 'F rows=', grid.GetNumberRows() return row
def OnLogin(self, evt): import hashlib import os name = self.text_ctrl_name.GetValue() password = str(self.text_ctrl_password.GetValue()) #salt = os.urandom(16) m = hashlib.md5() m.update(password) # (salt + password) x = m.hexdigest() sql = "SELECT * FROM User WHERE ID ='%s' AND password2='%s'" % (name, x) if fetch.getAllDict(sql): # change to check and set up user privilages gVar.userIsAdmin = True self.GetTopLevelParent().loggedIn()