Changeset 11550 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 28 Mar 2014, 08:54:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r11535 r11550 38 38 from waeup.kofa.browser.pdf import ( 39 39 ENTRY1_STYLE, format_html, NOTE_STYLE, HEADING_STYLE, 40 get_signature_tables )40 get_signature_tables, get_qrcode) 41 41 from waeup.kofa.browser.interfaces import IPDFCreator 42 42 from waeup.kofa.utils.helpers import to_timezone … … 105 105 ) 106 106 107 def render_student_data(studentview, omit_fields=(), lang='en'): 107 def render_student_data(studentview, context, omit_fields=(), 108 lang='en', slipname=None): 108 109 """Render student table for an existing frame. 109 110 """ … … 111 112 set_up_widgets(studentview, ignore_request=True) 112 113 data_left = [] 113 data_ right= []114 data_middle = [] 114 115 style = getSampleStyleSheet() 115 116 img = getUtility(IExtFileStore).getFileByContext( … … 126 127 f_text = formatted_text(studentview.context.display_fullname) 127 128 f_text = Paragraph(f_text, ENTRY1_STYLE) 128 data_ right.append([f_label,f_text])129 data_middle.append([f_label,f_text]) 129 130 130 131 for widget in studentview.widgets: … … 137 138 f_text = formatted_text(widget(), lang=lang) 138 139 f_text = Paragraph(f_text, ENTRY1_STYLE) 139 data_ right.append([f_label,f_text])140 data_middle.append([f_label,f_text]) 140 141 141 142 if getattr(studentview.context, 'certcode', None): … … 146 147 studentview.context['studycourse'].certificate.longtitle) 147 148 f_text = Paragraph(f_text, ENTRY1_STYLE) 148 data_ right.append([f_label,f_text])149 data_middle.append([f_label,f_text]) 149 150 if not 'department' in omit_fields: 150 151 f_label = trans(_('Department:'), lang) … … 155 156 ) 156 157 f_text = Paragraph(f_text, ENTRY1_STYLE) 157 data_ right.append([f_label,f_text])158 data_middle.append([f_label,f_text]) 158 159 if not 'faculty' in omit_fields: 159 160 f_label = trans(_('Faculty:'), lang) … … 164 165 ) 165 166 f_text = Paragraph(f_text, ENTRY1_STYLE) 166 data_ right.append([f_label,f_text])167 data_middle.append([f_label,f_text]) 167 168 if not 'current_mode' in omit_fields: 168 169 studymodes_dict = getUtility(IKofaUtils).STUDY_MODES_DICT … … 172 173 f_text = formatted_text(sm) 173 174 f_text = Paragraph(f_text, ENTRY1_STYLE) 174 data_ right.append([f_label,f_text])175 data_middle.append([f_label,f_text]) 175 176 if not 'entry_session' in omit_fields: 176 177 f_label = trans(_('Entry Session:'), lang) … … 180 181 f_text = formatted_text(entry_session) 181 182 f_text = Paragraph(f_text, ENTRY1_STYLE) 182 data_ right.append([f_label,f_text])183 data_middle.append([f_label,f_text]) 183 184 # Requested by Uniben, does not really make sense 184 185 if not 'current_level' in omit_fields: … … 191 192 f_text = formatted_text(current_level) 192 193 f_text = Paragraph(f_text, ENTRY1_STYLE) 193 data_ right.append([f_label,f_text])194 data_middle.append([f_label,f_text]) 194 195 if not 'date_of_birth' in omit_fields: 195 196 f_label = trans(_('Date of Birth:'), lang) … … 202 203 f_text = formatted_text(date_of_birth) 203 204 f_text = Paragraph(f_text, ENTRY1_STYLE) 204 data_right.append([f_label,f_text]) 205 data_middle.append([f_label,f_text]) 206 207 # append QR code to the right 208 if slipname: 209 url = studentview.url(context, slipname) 210 data_right = [[get_qrcode(url, width=70.0)]] 211 table_right = Table(data_right,style=SLIP_STYLE) 212 else: 213 table_right = None 205 214 206 215 table_left = Table(data_left,style=SLIP_STYLE) 207 table_ right = Table(data_right,style=SLIP_STYLE, colWidths=[5*cm, 6*cm])208 table = Table([[table_left, table_ right],],style=SLIP_STYLE)216 table_middle = Table(data_middle,style=SLIP_STYLE, colWidths=[5*cm, 5*cm]) 217 table = Table([[table_left, table_middle, table_right],],style=SLIP_STYLE) 209 218 return table 210 219 … … 589 598 590 599 # Student data 591 data.append(render_student_data(view, omit_fields, lang=portal_language)) 600 data.append(render_student_data(view, student, 601 omit_fields, lang=portal_language, 602 slipname='admission_slip.pdf')) 592 603 593 604 # Text after student data … … 649 660 data.append(Paragraph(bd_translation, HEADING_STYLE)) 650 661 data.append(render_student_data( 651 studentview, omit_fields, lang=portal_language)) 662 studentview, view.context, omit_fields, lang=portal_language, 663 slipname=filename)) 652 664 653 665 # Insert widgets … … 757 769 #data.append(Paragraph(bd_translation, HEADING_STYLE)) 758 770 data.append(render_student_data( 759 studentview, omit_fields, lang=portal_language)) 760 771 studentview, view.context, 772 omit_fields, lang=portal_language, 773 slipname=filename)) 761 774 762 775 transcript_data = view.context.getTranscriptData()
Note: See TracChangeset for help on using the changeset viewer.