source: WAeUP_SRP/base/skins/waeup_student/getStudyLevelInfo.py @ 2614

Last change on this file since 2614 was 2614, checked in by Henrik Bettermann, 17 years ago

display semesters seperately: first, second and combined

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1## Script (Python) "getStudyLevelInfo"
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: getStudyLevelInfo.py 2614 2007-11-09 21:30:03Z henrik $
11"""
12return Info about the Studylevel
13"""
14
15wf = context.portal_workflow
16mtool = context.portal_membership
17if mtool.isAnonymousUser():
18    return None
19member = mtool.getAuthenticatedMember()
20member_id = str(member)
21
22try:
23    from Products.zdb import set_trace
24except:
25    def set_trace():
26        pass
27
28
29# from Products.AdvancedQuery import Eq, Between, Le,In
30# try:
31#     aq_portal = context.portal_catalog.evalAdvancedQuery
32# except:
33#     aq_portal = context.portal_catalog_real.evalAdvancedQuery
34course_results = context.course_results
35request = context.REQUEST
36response = request.RESPONSE
37import logging
38logger = logging.getLogger('Skins.getStudyLevelInfo')
39
40student_id = context.getStudentId()
41level_id = context.getId()
42
43info = {}
44info['is_so'] = is_so = context.isSectionOfficer()
45info['is_student'] = is_student = context.isStudent()
46info['is_ca'] = is_ca = context.isCourseAdviser()
47info['student'] = student = context.students_catalog(id=student_id)[0]
48info['review_state'] = review_state = context.getStudentReviewState()
49info['view_only'] =  review_state != "school_fee_paid"
50info['show_check_boxes'] =  (is_ca and review_state in ('school_fee_paid',)) or\
51                            (is_student and context.getStudentReviewState() == "school_fee_paid") or\
52                            (is_so)
53info['choosen_ids'] = request.get('ids',[])
54info['status_info'] = ""
55if is_student:
56    if review_state == 'courses_registered':
57        info['status_info'] = "Request for Course Validation pending"
58    elif review_state == 'courses_validated':
59        info['status_info'] = "Courses validated"
60elif is_ca:
61    if review_state == 'courses_registered':
62        info['status_info'] = "Please validate these Courses"
63    elif review_state == 'courses_validated':
64        info['status_info'] = "Courses validated"
65info['doc'] = context.getContent()
66cert_id = student.course
67info['cert_id'] = cert_id
68if context.objectIds():
69    course_results.moveResultsHere(context,student_id)
70    logger.info("%s initiated moveResultsHere for %s in level %s" % (member_id,student_id,level_id))
71credits_total,carry_overs,normal1,normal2,normal3 = course_results.getCourses(student_id,level_id)
72info['credits_total'] = credits_total
73max_credits = 50
74if context.getId() == student.end_level:
75    max_credits = 51
76info['max_credits'] = max_credits
77info['credits_exceeded'] = credits_total > max_credits
78current_session = student.session
79info['submission_allowed']= not info['credits_exceeded'] and\
80    current_session == context.getSessionId()[0]
81# carry_overs.sort(cmp_semester_id)
82info['carry_overs'] = carry_overs
83# normal.sort(cmp_semester_id)
84info['normal1'] = normal1
85info['normal2'] = normal2
86info['normal3'] = normal3
87
88students_object = context.portal_url.getPortalObject().campus.students
89student = getattr(students_object, student_id)
90info['app'] = student.application
91info['app_doc'] = student.application.getContent()
92
93return info
Note: See TracBrowser for help on using the repository browser.