Code Duplication    Length = 23-24 lines in 2 locations

src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php 2 locations

@@ 395-418 (lines=24) @@
392
     * @param array $id_list If you want to restrict the structure to only the given IDs
393
     * @return void
394
     */
395
    public function build_forum_topics(
396
        $session_id = 0,
397
        $courseId = 0,
398
        $with_base_content = false,
399
        $id_list = array()
400
    ) {
401
        $table = Database:: get_course_table(TABLE_FORUM_THREAD);
402
403
        $sessionCondition = api_get_session_condition(
404
            $session_id,
405
            true,
406
            $with_base_content
407
        );
408
409
        $sql = "SELECT * FROM $table WHERE c_id = $courseId
410
                $sessionCondition
411
                ORDER BY thread_title ";
412
        $result = Database::query($sql);
413
414
        while ($obj = Database::fetch_object($result)) {
415
            $forum_topic = new ForumTopic($obj);
416
            $this->course->add_resource($forum_topic);
417
            $this->build_forum_posts($courseId, $obj->thread_id, $obj->forum_id, true);
418
        }
419
    }
420
421
    /**
@@ 507-529 (lines=23) @@
504
     * @param bool $with_base_content Whether to include content from the course without session or not
505
     * @param array $id_list If you want to restrict the structure to only the given IDs
506
     */
507
    public function build_tool_intro(
508
        $session_id = 0,
509
        $courseId = 0,
510
        $with_base_content = false,
511
        $id_list = array()
512
    ) {
513
        $table = Database:: get_course_table(TABLE_TOOL_INTRO);
514
515
        $sessionCondition = api_get_session_condition(
516
            $session_id,
517
            true,
518
            $with_base_content
519
        );
520
521
        $sql = "SELECT * FROM $table
522
                WHERE c_id = $courseId $sessionCondition";
523
524
        $db_result = Database::query($sql);
525
        while ($obj = Database::fetch_object($db_result)) {
526
            $tool_intro = new ToolIntro($obj->id, $obj->intro_text);
527
            $this->course->add_resource($tool_intro);
528
        }
529
    }
530
531
    /**
532
     * Build a link category