Code Duplication    Length = 9-12 lines in 3 locations

main/gradebook/lib/be/abstractlink.class.php 1 location

@@ 480-488 (lines=9) @@
477
     * Internal function used by get_target_categories()
478
     * @param integer $level
479
     */
480
    private function add_target_subcategories($targets, $level, $catid)
481
    {
482
        $subcats = Category::load(null,null,null,$catid);
483
        foreach ($subcats as $cat) {
484
            $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
485
            $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
486
        }
487
        return $targets;
488
    }
489
490
    /**
491
     * Move this link to the given category.

main/gradebook/lib/be/evaluation.class.php 1 location

@@ 670-678 (lines=9) @@
667
	 * Internal function used by get_target_categories()
668
	 * @param integer $level
669
	 */
670
	private function add_target_subcategories($targets, $level, $catid)
671
	{
672
		$subcats = Category::load(null,null,null,$catid);
673
		foreach ($subcats as $cat) {
674
			$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
675
			$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
676
		}
677
		return $targets;
678
	}
679
680
	/**
681
	 * Move this evaluation to the given category.

main/gradebook/lib/be/category.class.php 1 location

@@ 1346-1357 (lines=12) @@
1343
     * Internal function used by get_target_categories()
1344
     * @param integer $level
1345
     */
1346
    private function add_target_subcategories($targets, $level, $catid)
1347
    {
1348
        $subcats = Category::load(null,null,null,$catid);
1349
        foreach ($subcats as $cat) {
1350
            if ($this->can_be_moved_to_cat($cat)) {
1351
                $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
1352
                $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
1353
            }
1354
        }
1355
1356
        return $targets;
1357
    }
1358
1359
    /**
1360
     * Internal function used by get_target_categories() and add_target_subcategories()