## Script (Python) "getStudyLevelInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: getStudyLevelInfo.py 2664 2007-11-15 14:35:05Z henrik $ """ return Info about the Studylevel """ wf = context.portal_workflow mtool = context.portal_membership if mtool.isAnonymousUser(): return None member = mtool.getAuthenticatedMember() member_id = str(member) try: from Products.zdb import set_trace except: def set_trace(): pass # from Products.AdvancedQuery import Eq, Between, Le,In # try: # aq_portal = context.portal_catalog.evalAdvancedQuery # except: # aq_portal = context.portal_catalog_real.evalAdvancedQuery course_results = context.course_results request = context.REQUEST response = request.RESPONSE import logging logger = logging.getLogger('Skins.getStudyLevelInfo') student_id = context.getStudentId() level_id = context.getId() info = {} info['is_so'] = is_so = context.isSectionOfficer() info['is_student'] = is_student = context.isStudent() info['is_ca'] = is_ca = context.isCourseAdviser() info['student'] = student = context.students_catalog(id=student_id)[0] info['review_state'] = review_state = student.review_state info['view_only'] = review_state != "school_fee_paid" has_paid = review_state == 'school_fee_paid' info['show_check_boxes'] = (is_ca and has_paid) or\ (is_student and has_paid) or\ (is_so) info['choosen_ids'] = request.get('ids',[]) info['status_info'] = "" if is_student: if review_state == 'courses_registered': info['status_info'] = "Request for Course Validation pending" elif review_state == 'courses_validated': info['status_info'] = "Courses validated" elif is_ca: if review_state == 'courses_registered': info['status_info'] = "Please validate these Courses" elif review_state == 'courses_validated': info['status_info'] = "Courses validated" info['doc'] = context.getContent() cert_id = student.course info['cert_id'] = cert_id if context.objectIds(): course_results.moveResultsHere(context,student_id) logger.info("%s initiated moveResultsHere for %s in level %s" % (member_id,student_id,level_id)) credits_total,carry_overs,normal1,normal2,normal3 = course_results.getCourses(student_id,level_id) info['credits_total'] = credits_total max_credits = 50 if context.getId() == student.end_level: max_credits = 51 info['max_credits'] = max_credits info['credits_exceeded'] = credits_total > max_credits current_session = student.session info['submission_allowed']= review_state in ('school_fee_paid','returning') and has_paid info['validation_allowed']= review_state == 'courses_registered' info['rejection_allowed']= review_state in ('courses_registered', 'courses_validated',) # carry_overs.sort(cmp_semester_id) info['carry_overs'] = carry_overs # normal.sort(cmp_semester_id) info['normal1'] = normal1 info['normal2'] = normal2 info['normal3'] = normal3 info['data_missing'] = not info['normal1'] and not info['normal2'] and not info['normal3'] info['spillover'] = student.level > student.end_level students_object = context.portal_url.getPortalObject().campus.students student = getattr(students_object, student_id) info['app'] = student.application info['app_doc'] = student.application.getContent() return info