Changeset 15088
- Timestamp:
- 16 Jul 2018, 07:56:40 (6 years ago)
- Location:
- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/browser.py
r15017 r15088 29 29 StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, 30 30 CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, 31 BedTicketAddPage, 31 BedTicketAddPage, ExportPDFTranscriptSlip, 32 32 msave, emit_lock_message) 33 33 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket … … 49 49 class CustomBedTicketAddPage(BedTicketAddPage): 50 50 with_ac = False 51 52 class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage): 53 """ Page to display student study levels 54 """ 55 grok.template('studylevelpage') 56 57 class CustomStudyLevelEditFormPage(StudyLevelEditFormPage): 58 """ Page to edit the student study level data by students. 59 60 """ 61 grok.template('studyleveleditpage') 62 63 class CustomCourseTicketDisplayFormPage(CourseTicketDisplayFormPage): 64 """ Page to display course tickets 65 """ 66 form_fields = grok.AutoFields(ICourseTicket).omit('score') 67 68 class CustomExportPDFCourseRegistrationSlip(ExportPDFCourseRegistrationSlip): 69 """Deliver a PDF slip of the context. 70 """ 71 72 def render(self): 73 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 74 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 75 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 76 Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language) 77 Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language) 78 Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language) 79 #Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language) 80 #Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) 81 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 82 studentview = StudentBasePDFFormPage(self.context.student, 83 self.request, self.omit_fields) 84 students_utils = getUtility(IStudentsUtils) 85 86 tabledata = [] 87 tableheader = [] 88 for i in range(1,7): 89 tabledata.append(sorted( 90 [value for value in self.context.values() if value.semester == i], 91 key=lambda value: str(value.semester) + value.code)) 92 tableheader.append([(Code,'code', 2.5), 93 (Title,'title', 5), 94 (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 95 (Cred, 'credits', 1.5), 96 #(Mand, 'mandatory', 1.5), 97 #(Score, 'score', 1.5), 98 (Grade, 'grade', 1.5), 99 #('Auto', 'automatic', 1.5) 100 ]) 101 return students_utils.renderPDF( 102 self, 'course_registration_slip.pdf', 103 self.context.student, studentview, 104 tableheader=tableheader, 105 tabledata=tabledata, 106 omit_fields=self.omit_fields 107 ) 108 109 110 class CustomExportPDFTranscriptSlip(ExportPDFTranscriptSlip): 111 """Deliver a PDF slip of the context. 112 """ 113 114 def render(self): 115 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 116 Term = translate(_('Term'), 'waeup.kofa', target_language=portal_language) 117 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 118 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 119 Cred = translate(_('Credits'), 'waeup.kofa', target_language=portal_language) 120 #Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) 121 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 122 studentview = StudentBasePDFFormPage(self.context.student, 123 self.request, self.omit_fields) 124 students_utils = getUtility(IStudentsUtils) 125 126 tableheader = [(Code,'code', 2.5), 127 (Title,'title', 8.5), 128 (Term, 'semester', 1.5), 129 (Cred, 'credits', 1.5), 130 #(Score, 'score', 1.5), 131 (Grade, 'grade', 1.5), 132 ] 133 134 return students_utils.renderPDFTranscript( 135 self, 'transcript.pdf', 136 self.context.student, studentview, 137 omit_fields=self.omit_fields, 138 tableheader=tableheader, 139 signatures=self._signatures(), 140 sigs_in_footer=self._sigsInFooter(), 141 )
Note: See TracChangeset for help on using the changeset viewer.