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

Last change on this file since 1456 was 1435, checked in by Henrik Bettermann, 18 years ago

name in application object is no longer visible for students

  • Property svn:keywords set to Id
File size: 1.8 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 1435 2007-02-19 10:35:10Z henrik $
[723]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 = {}
[1380]20info['is_so'] = context.isSectionOfficer()
[723]21info['action'] = "%s" % context.campus.absolute_url()
22info['choosen_ids'] = request.get('ids',[])
[1380]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]
[1403]29info['student'] = sbrain
[1380]30cert_id = sbrain.course
31res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
32ci = {}
33if res:
34    info['cert_id'] = cert_id
35    brain = res[0]
36    ci['study_course'] = brain.getId
37    ci['title'] = brain.Title
38    pl = brain.getPath().split('/')
39    ci['faculty'] = pl[-4]
40    ci['department'] = pl[-3]
41    info['course_doc'] = ci
42else:
43    info['course'] = None
[723]44items = []
[1380]45current_level = sbrain.level
46levels = context.objectIds()
[1435]47context.portal_workflow.doActionFor(context,'close_for_edit')
48
[1417]49#levels.sort()
50#if int(current_level) > int(levels[-1]):
[1435]51#if not levels:
52#    context.invokeFactory('StudentStudyLevel',"%s" % current_level)   
53#    level = getattr(context,"%s" % current_level)
54#    level.getContent().edit(mapping={'session': "2006/2007"})
55#    context.portal_workflow.doActionFor(level,'open')
56#    context.portal_workflow.doActionFor(level,'close_for_edit')
57#    levels.append(current_level)
58#for l in levels:
59#    row = {}
60#    row['id'] = l
61#    row['title'] = "Level %s" % l
62#    row['url'] = "%s/%s" % (context.absolute_url(),l)
63#    items.append(row)
[1380]64
[723]65info['items'] = items
66return info
Note: See TracBrowser for help on using the repository browser.