source: WAeUP_SRP/trunk/skins/waeup_student/getStudyCourseInfo.py @ 1381

Last change on this file since 1381 was 1380, checked in by joachim, 18 years ago

course registration

M waeup_student/student_index.py
M waeup_student/study_level_view.pt
M waeup_student/getStudyLevelInfo.py
M waeup_student/study_course_view.pt
M waeup_student/getStudyCourseInfo.py
AM waeup_academics/getCourseInfo.py

reindex entry_mode

M waeup_utilities/getFromData_entry_mode.py
M waeup_utilities/reindex_entry_mode.py

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1## Script (Python) "getStudyCourseInfo"
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: getStudyCourseInfo.py 1380 2007-01-31 16:24:18Z joachim $
11"""
12return Info about the Students StudyCourse
13"""
14request = context.REQUEST
15
16wf = context.portal_workflow
17path_info = request.get('PATH_INFO').split('/')
18
19info = {}
20info['is_so'] = context.isSectionOfficer()
21info['action'] = "%s" % context.campus.absolute_url()
22info['choosen_ids'] = request.get('ids',[])
23course  = info['doc'] = context.getContent()
24student_id = context.getStudentId()
25res = context.students_catalog(id = student_id)
26if not res:
27    return None
28sbrain = res[0]
29cert_id = sbrain.course
30res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
31ci = {}
32if res:
33    info['cert_id'] = cert_id
34    brain = res[0]
35    ci['study_course'] = brain.getId
36    ci['title'] = brain.Title
37    pl = brain.getPath().split('/')
38    ci['faculty'] = pl[-4]
39    ci['department'] = pl[-3]
40    info['course_doc'] = ci
41else:
42    info['course'] = None
43items = []
44current_level = sbrain.level
45levels = context.objectIds()
46if current_level not in levels:
47    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
48    level = getattr(context,"%s" % current_level)
49    level.getContent().edit(mapping={'session': "2006/2007"})
50    context.portal_workflow.doActionFor(level,'open')
51    context.portal_workflow.doActionFor(level,'close_for_edit')
52    levels.append(current_level)
53#from Products.zdb import set_trace;set_trace()
54for l in levels:
55    row = {}
56    row['id'] = l
57    row['title'] = "Level %s" % l
58    row['url'] = "%s/%s" % (context.absolute_url(),l)
59    items.append(row)
60
61info['items'] = items
62return info
Note: See TracBrowser for help on using the repository browser.