## Script (Python) "getCoursesCertificatesInfo"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=student=None
##title=
##
# $Id: getCoursesCertificatesInfo.py 1434 2007-02-18 08:58:35Z henrik $
"""
return Info about the Faculties
"""
request = context.REQUEST

wf = context.portal_workflow
path_info = request.get('PATH_INFO').split('/')

info = {}
info['action'] = "%s/faculty_view" % context.absolute_url()
info['choosen_ids'] = request.get('ids',[])
info['doc'] = context.getContent()
brain = context.portal_catalog(meta_type="Department", id = context.getId())[-1]
cp = brain.getPath()
info['container_path'] = cp
#res = context.portal_catalog(container_path="%s/courses" % cp)
#items = []
#for r in res:
#    row = {}
#    ro = r.getObject()
#    rd = ro.getContent()
#    row['id'] = r.getId
#    row['title'] = rd.Title()
#    row['url'] = ro.absolute_url()
#    items.append(row)
#info['courses'] = items
res = context.portal_catalog(container_path="%s/certificates" % cp)
items = []
for r in res:
    row = {}
    ro = r.getObject()
    rd = ro.getContent()
    row['id'] = r.getId
    row['title'] = rd.Title()
    row['url'] = ro.absolute_url()
    items.append(row)
info['certificates'] = items
return info

