- Timestamp:
- 16 Jul 2018, 08:03:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py
r14883 r15089 29 29 StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, 30 30 CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, 31 ExportPDFTranscriptSlip, 31 32 msave, emit_lock_message) 32 33 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket … … 68 69 return _('No IT letter uploaded.') 69 70 return False 71 72 class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage): 73 """ Page to display student study levels 74 """ 75 grok.template('studylevelpage') 76 77 class CustomStudyLevelEditFormPage(StudyLevelEditFormPage): 78 """ Page to edit the student study level data by students. 79 80 """ 81 grok.template('studyleveleditpage') 82 83 class CustomCourseTicketDisplayFormPage(CourseTicketDisplayFormPage): 84 """ Page to display course tickets 85 """ 86 form_fields = grok.AutoFields(ICourseTicket).omit('score') 87 88 class CustomExportPDFCourseRegistrationSlip(ExportPDFCourseRegistrationSlip): 89 """Deliver a PDF slip of the context. 90 """ 91 92 def render(self): 93 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 94 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 95 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 96 Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language) 97 Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language) 98 Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language) 99 #Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language) 100 #Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) 101 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 102 studentview = StudentBasePDFFormPage(self.context.student, 103 self.request, self.omit_fields) 104 students_utils = getUtility(IStudentsUtils) 105 106 tabledata = [] 107 tableheader = [] 108 for i in range(1,7): 109 tabledata.append(sorted( 110 [value for value in self.context.values() if value.semester == i], 111 key=lambda value: str(value.semester) + value.code)) 112 tableheader.append([(Code,'code', 2.5), 113 (Title,'title', 5), 114 (Dept,'dcode', 1.5), (Faculty,'fcode', 1.5), 115 (Cred, 'credits', 1.5), 116 #(Mand, 'mandatory', 1.5), 117 #(Score, 'score', 1.5), 118 (Grade, 'grade', 1.5), 119 #('Auto', 'automatic', 1.5) 120 ]) 121 return students_utils.renderPDF( 122 self, 'course_registration_slip.pdf', 123 self.context.student, studentview, 124 tableheader=tableheader, 125 tabledata=tabledata, 126 omit_fields=self.omit_fields 127 ) 128 129 130 class CustomExportPDFTranscriptSlip(ExportPDFTranscriptSlip): 131 """Deliver a PDF slip of the context. 132 """ 133 134 def render(self): 135 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 136 Term = translate(_('Term'), 'waeup.kofa', target_language=portal_language) 137 Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language) 138 Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language) 139 Cred = translate(_('Credits'), 'waeup.kofa', target_language=portal_language) 140 #Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language) 141 Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language) 142 studentview = StudentBasePDFFormPage(self.context.student, 143 self.request, self.omit_fields) 144 students_utils = getUtility(IStudentsUtils) 145 146 tableheader = [(Code,'code', 2.5), 147 (Title,'title', 8.5), 148 (Term, 'semester', 1.5), 149 (Cred, 'credits', 1.5), 150 #(Score, 'score', 1.5), 151 (Grade, 'grade', 1.5), 152 ] 153 154 return students_utils.renderPDFTranscript( 155 self, 'transcript.pdf', 156 self.context.student, studentview, 157 omit_fields=self.omit_fields, 158 tableheader=tableheader, 159 signatures=self._signatures(), 160 sigs_in_footer=self._sigsInFooter(), 161 )
Note: See TracChangeset for help on using the changeset viewer.