[3718] | 1 | ## Script (Python) "getPastoralReportInfo"
|
---|
| 2 | ##bind container=container
|
---|
| 3 | ##bind context=context
|
---|
| 4 | ##bind namespace=
|
---|
| 5 | ##bind script=script
|
---|
| 6 | ##bind subpath=traverse_subpath
|
---|
| 7 | ##parameters=student=None
|
---|
| 8 | ##title=
|
---|
| 9 | ##
|
---|
| 10 | # $Id: getPastoralReportInfo.py 2760 2007-11-26 07:39:15Z henrik $
|
---|
| 11 | """
|
---|
| 12 | return Info about the Studylevel
|
---|
| 13 | try:
|
---|
| 14 | from Products.zdb import set_trace
|
---|
| 15 | except:
|
---|
| 16 | def set_trace():
|
---|
| 17 | pass
|
---|
| 18 | """
|
---|
| 19 |
|
---|
[4424] | 20 | import DateTime
|
---|
| 21 |
|
---|
[3718] | 22 | info = context.waeup_tool.getAccessInfo(context)
|
---|
| 23 | student_id = info['student_id']
|
---|
| 24 | if student_id is None:
|
---|
| 25 | return None
|
---|
| 26 |
|
---|
| 27 | mtool = context.portal_membership
|
---|
| 28 | member = mtool.getAuthenticatedMember()
|
---|
| 29 | member_id = str(member)
|
---|
[4424] | 30 | pprops = context.portal_properties
|
---|
[3718] | 31 |
|
---|
| 32 | course_results = context.course_results
|
---|
| 33 | request = context.REQUEST
|
---|
| 34 | response = request.RESPONSE
|
---|
| 35 | import logging
|
---|
| 36 | logger = logging.getLogger('Skins.getPastoralReportInfo')
|
---|
| 37 |
|
---|
| 38 | level_doc = info['level_doc'] = context.aq_parent.getContent()
|
---|
| 39 | doc = info['doc'] = context.getContent()
|
---|
| 40 | info['session'] = context.portal_vocabularies.sessions.get(level_doc.session)
|
---|
| 41 | info['level'] = context.portal_vocabularies.student_levels.get(context.aq_parent.getId())
|
---|
| 42 | info['term'] = context.portal_vocabularies.terms.get(context.getId())
|
---|
[4424] | 43 |
|
---|
| 44 | if pprops.session == info['session']:
|
---|
| 45 | info['date1'] = DateTime.DateTime(pprops.date1).strftime('%d/%m/%Y')
|
---|
| 46 | info['date2'] = DateTime.DateTime(pprops.date2).strftime('%d/%m/%Y')
|
---|
| 47 | info['date3'] = DateTime.DateTime(pprops.date3).strftime('%d/%m/%Y')
|
---|
| 48 | else:
|
---|
| 49 | info['date1'] = 'n/a'
|
---|
| 50 | info['date2'] = 'n/a'
|
---|
| 51 | info['date3'] = 'n/a'
|
---|
| 52 | if context.getId() == 'fpr':
|
---|
| 53 | info['term_num'] = 1
|
---|
| 54 | elif context.getId() == 'spr':
|
---|
| 55 | info['term_num'] = 2
|
---|
| 56 | elif context.getId() == 'tpr':
|
---|
| 57 | info['term_num'] = 3
|
---|
| 58 |
|
---|
[3718] | 59 | info['is_so'] = is_so = info['is_sectionofficer']
|
---|
| 60 | #info['is_student'] = is_student = context.isStudent()
|
---|
| 61 | #info['is_ca'] = is_ca = context.isCourseAdviser()
|
---|
| 62 | #info['student'] = student = context.students_catalog(id=student_id)[0]
|
---|
| 63 | #info['student'] = student = context.students_catalog.getRecordByKey(student_id)
|
---|
| 64 |
|
---|
| 65 | students_object = context.portal_url.getPortalObject().campus.students
|
---|
| 66 | student = getattr(students_object, student_id)
|
---|
[3804] | 67 | #info['app'] = student.application
|
---|
| 68 | #info['app_doc'] = student.application.getContent()
|
---|
[3718] | 69 |
|
---|
| 70 | return info |
---|