source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_student/getStudyCourseInfo.py @ 11110

Last change on this file since 11110 was 1596, checked in by joachim, 18 years ago

merged changes from trunk to joachim-event-branch

  • Property svn:keywords set to Id
File size: 2.1 KB
RevLine 
[845]1## Script (Python) "getStudyCourseInfo"
[723]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##
[805]10# $Id: getStudyCourseInfo.py 1596 2007-03-19 21:45:44Z joachim $
[723]11"""
12return Info about the Students StudyCourse
13"""
[1494]14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19
[723]20request = context.REQUEST
21
[1490]22wftool = context.portal_workflow
[723]23path_info = request.get('PATH_INFO').split('/')
24
25info = {}
[1380]26info['is_so'] = context.isSectionOfficer()
[723]27info['action'] = "%s" % context.campus.absolute_url()
28info['choosen_ids'] = request.get('ids',[])
[1380]29course  = info['doc'] = context.getContent()
30student_id = context.getStudentId()
31res = context.students_catalog(id = student_id)
32if not res:
33    return None
34sbrain = res[0]
[1403]35info['student'] = sbrain
[1380]36cert_id = sbrain.course
37res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
38ci = {}
39if res:
40    info['cert_id'] = cert_id
41    brain = res[0]
42    ci['study_course'] = brain.getId
43    ci['title'] = brain.Title
44    pl = brain.getPath().split('/')
45    ci['faculty'] = pl[-4]
46    ci['department'] = pl[-3]
47    info['course_doc'] = ci
48else:
49    info['course'] = None
[723]50items = []
[1492]51current_level = sbrain.level
52levels = context.objectIds()
53review_state = wftool.getInfoFor(context,'review_state',None)
[1596]54student_review_state = context.getStudentReviewState()
55if review_state != 'content_addable' and student_review_state == 'school_fee_paid': #and context.isStudent():
[1492]56    wftool.doActionFor(context,'close_for_edit')
[1500]57may_register = (student_review_state in ('school_fee_paid',)) and\
[1537]58               current_level not in levels and\
59               (sbrain.verdict in ('A','B') or sbrain.jamb_reg_no.startswith('6'))
[1596]60
[1492]61levels.sort()
62info['create_level'] = None
63if may_register:
64    info['create_level'] = current_level
65for l in levels:
66    row = {}
67    row['id'] = l
68    row['title'] = "Level %s" % l
69    row['url'] = "%s/%s" % (context.absolute_url(),l)
70    items.append(row)
[1380]71
[723]72info['items'] = items
[1504]73
[1596]74try:
[1504]75    info['verdict'] = context.portal_vocabularies.verdicts.get(info['doc'].current_verdict).upper()
76except:
[1596]77    info['verdict'] = course.current_verdict
[1504]78
[723]79return info
[1504]80
Note: See TracBrowser for help on using the repository browser.