| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -249,6 +249,7 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        self::insertCourseSettings($course); | 
					 | 
					 | 
					 | 
					        self::insertCourseSettings($course); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        self::createGroupCategory($course); | 
					 | 
					 | 
					 | 
					        self::createGroupCategory($course); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $gradebook = self::createRootGradebook($course); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ($fillWithExemplaryContent ?? api_get_setting('example_material_course_creation') !== 'false') { | 
					 | 
					 | 
					 | 
					        if ($fillWithExemplaryContent ?? api_get_setting('example_material_course_creation') !== 'false') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            self::insertExampleContent($course, $authorId, $entityManager); | 
					 | 
					 | 
					 | 
					            self::insertExampleContent($course, $authorId, $entityManager); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -361,11 +362,12 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param Course $course The course object into which the example content will be inserted. | 
					 | 
					 | 
					 | 
					     * @param Course $course The course object into which the example content will be inserted. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param int $authorId The ID of the user who will be listed as the author of the inserted content. | 
					 | 
					 | 
					 | 
					     * @param int $authorId The ID of the user who will be listed as the author of the inserted content. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param GradebookCategory $gradebook | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return void | 
					 | 
					 | 
					 | 
					     * @return void | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @throws Exception | 
					 | 
					 | 
					 | 
					     * @throws Exception | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private static function insertExampleContent(Course $course, int $authorId): void | 
					 | 
					 | 
					 | 
					    private static function insertExampleContent(Course $course, int $authorId, GradebookCategory $gradebook): void | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    { | 
					 | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $now = api_get_utc_datetime(); | 
					 | 
					 | 
					 | 
					        $now = api_get_utc_datetime(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $files = [ | 
					 | 
					 | 
					 | 
					        $files = [ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -560,7 +562,7 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        saveThread($forumEntity, $params, $courseInfo, false); | 
					 | 
					 | 
					 | 
					        saveThread($forumEntity, $params, $courseInfo, false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        self::createGradebookStructure($course, $exercise->id); | 
					 | 
					 | 
					 | 
					        self::createExampleGradebookContent($course, $gradebook, $exercise->id); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -576,27 +578,13 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return void | 
					 | 
					 | 
					 | 
					     * @return void | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private static function createGradebookStructure(Course $course, int $refId): void | 
					 | 
					 | 
					 | 
					    private static function createExampleGradebookContent(Course $course, GradebookCategory $parentCategory, int $refId): void | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    { | 
					 | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $manager = Database::getManager(); | 
					 | 
					 | 
					 | 
					        $manager = Database::getManager(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        /* Gradebook tool */ | 
					 | 
					 | 
					 | 
					        /* Gradebook tool */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $courseCode = $course->getCode(); | 
					 | 
					 | 
					 | 
					        $courseCode = $course->getCode(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory = new GradebookCategory(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setTitle($courseCode); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setLocked(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setGenerateCertificates(false); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setDescription(''); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setCourse($course); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setWeight(100); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setVisible(false); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setCertifMinScore(75); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setUser(api_get_user_entity()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $manager->persist($parentGradebookCategory); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $manager->flush(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory = new GradebookCategory(); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory = new GradebookCategory(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setTitle($courseCode); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setTitle($courseCode); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setLocked(0); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setLocked(0); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -606,7 +594,7 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setWeight(100); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setWeight(100); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setVisible(true); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setVisible(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setCertifMinScore(75); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setCertifMinScore(75); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setParent($parentGradebookCategory); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setParent($parentCategory); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $childGradebookCategory->setUser(api_get_user_entity()); | 
					 | 
					 | 
					 | 
					        $childGradebookCategory->setUser(api_get_user_entity()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $manager->persist($childGradebookCategory); | 
					 | 
					 | 
					 | 
					        $manager->persist($childGradebookCategory); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -628,6 +616,41 @@ class AddCourse | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $manager->flush(); | 
					 | 
					 | 
					 | 
					        $manager->flush(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * Creates the basic gradebook structure for a course. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * This method sets up the initial gradebook categories and links for a new course. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * It creates a parent gradebook category representing the course itself. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param Course $course The course entity for which the gradebook structure will be created. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return GradebookCategory The created gradebook's ID | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @throws \Doctrine\ORM\Exception\ORMException | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private static function createRootGradebook(Course $course): GradebookCategory | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $manager = Database::getManager(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        /* Gradebook tool */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $courseCode = $course->getCode(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory = new GradebookCategory(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setTitle($courseCode); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setLocked(0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setGenerateCertificates(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setDescription(''); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setCourse($course); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setWeight(100); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setVisible(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setCertifMinScore(75); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $parentGradebookCategory->setUser(api_get_user_entity()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $manager->persist($parentGradebookCategory); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        $manager->flush(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return $parentGradebookCategory; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * Installs plugins for a given course. | 
					 | 
					 | 
					 | 
					     * Installs plugins for a given course. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |