## Script (Python) "getStudyCourseInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: getStudyCourseInfo.py 1417 2007-02-15 10:56:43Z joachim $ """ return Info about the Students StudyCourse """ request = context.REQUEST wf = context.portal_workflow path_info = request.get('PATH_INFO').split('/') info = {} info['is_so'] = context.isSectionOfficer() info['action'] = "%s" % context.campus.absolute_url() info['choosen_ids'] = request.get('ids',[]) course = info['doc'] = context.getContent() student_id = context.getStudentId() res = context.students_catalog(id = student_id) if not res: return None sbrain = res[0] info['student'] = sbrain cert_id = sbrain.course res = context.portal_catalog(portal_type = "Certificate", id = cert_id) ci = {} if res: info['cert_id'] = cert_id brain = res[0] ci['study_course'] = brain.getId ci['title'] = brain.Title pl = brain.getPath().split('/') ci['faculty'] = pl[-4] ci['department'] = pl[-3] info['course_doc'] = ci else: info['course'] = None items = [] current_level = sbrain.level levels = context.objectIds() #levels.sort() #if int(current_level) > int(levels[-1]): if not levels: context.invokeFactory('StudentStudyLevel',"%s" % current_level) level = getattr(context,"%s" % current_level) level.getContent().edit(mapping={'session': "2006/2007"}) context.portal_workflow.doActionFor(level,'open') context.portal_workflow.doActionFor(level,'close_for_edit') levels.append(current_level) #from Products.zdb import set_trace;set_trace() for l in levels: row = {} row['id'] = l row['title'] = "Level %s" % l row['url'] = "%s/%s" % (context.absolute_url(),l) items.append(row) info['items'] = items return info