def createCourse(obj, event): """ This is a callback function for the IObjectInitializedEvent. This function is called when a course folder has been created. The ZCML call is: <subscriber for=".interfaces.ICourse Products.Archetypes.interfaces.IObjectInitializedEvent" handler=".events.createCourse" /> """ context = ICourse(obj) # Make a Lessons folder makeItem(context, 'lessons', 'Lessons', 'Modules', 'Insert content and configure as necesary') # Make Tests makeItem(context, 'exams', 'ExamContent', 'Exámenes', 'Exámenes del curso') #obj.setConstrainTypesMode(constraintypes.ENABLED) #obj.setLocallyAllowedTypes(['Exam']) #obj.setImmediatelyAddableTypes(['Exam']) #obj.setLayout('view_exams') #obj.reindexObject() # Make Quizzes makeItem(context, 'quizzes', 'QuizContent', 'Quizzes', 'Quizes de los cursos') # obj.setConstrainTypesMode(constraintypes.ENABLED) # obj.setLocallyAllowedTypes(['Quiz']) # obj.setImmediatelyAddableTypes(['Quiz']) # obj.setLayout('view_quizzes') # obj.reindexObject() # Make Polls makeItem(context, 'polls', 'PollContent', 'Encuestas', 'Encuestas del Curso') # Make Files makeItem(context, 'files', 'Resources', 'Recursos', 'Carpeta contenedora de archivos del curso') context.reindexObject()
def editCourse(obj, event): """ This is a callback function for the IObjectEditedEvent. This function is called when a course folder has been edited. <subscriber for=".interfaces.ICourse Products.Archetypes.interfaces.IObjectEditedEvent" handler=".events.editCourse" /> """ context = ICourse(obj) #Set the instructors instructors = context.getLocalRoles('Manager') context.setInstructor(instructors) #print "editCourse-instructor ",instructors #Register all the users registered = len(context.getRegisteredStudents()) context.setRegistered(registered)