Code Duplication    Length = 14-17 lines in 9 locations

main/newscorm/aicc.class.php 5 locations

@@ 558-571 (lines=14) @@
555
     * Sets the proximity setting in the database
556
     * @param	string	$proxy Proximity setting
557
     */
558
    function set_proximity($proxy = '')
559
    {
560
        $course_id = api_get_course_int_id();
561
        if ($this->debug > 0) { error_log('In aicc::set_proximity('.$proxy.') method', 0); }
562
        $lp = $this->get_id();
563
        if ($lp != 0) {
564
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
565
            $sql = "UPDATE $tbl_lp SET content_local = '$proxy' WHERE c_id = ".$course_id." id = ".$lp;
566
            $res = Database::query($sql);
567
            return $res;
568
        } else {
569
            return false;
570
        }
571
    }
572
573
    /**
574
     * Sets the theme setting in the database
@@ 577-590 (lines=14) @@
574
     * Sets the theme setting in the database
575
     * @param	string	Theme setting
576
     */
577
    function set_theme($theme = '')
578
    {
579
        $course_id = api_get_course_int_id();
580
        if ($this->debug > 0) { error_log('In aicc::set_theme('.$theme.') method', 0); }
581
        $lp = $this->get_id();
582
        if ($lp != 0) {
583
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
584
            $sql = "UPDATE $tbl_lp SET theme = '$theme' WHERE c_id = ".$course_id." id = ".$lp;
585
            $res = Database::query($sql);
586
            return $res;
587
        } else {
588
            return false;
589
        }
590
    }
591
592
    /**
593
     * Sets the image LP in the database
@@ 596-609 (lines=14) @@
593
     * Sets the image LP in the database
594
     * @param	string	$preview_image Theme setting
595
     */
596
    function set_preview_image($preview_image = '')
597
    {
598
        $course_id = api_get_course_int_id();
599
        if ($this->debug > 0) {error_log('In aicc::set_preview_image('.$preview_image.') method', 0); }
600
        $lp = $this->get_id();
601
        if ($lp != 0) {
602
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
603
            $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE c_id = ".$course_id." id = ".$lp;
604
            $res = Database::query($sql);
605
            return $res;
606
        } else {
607
            return false;
608
        }
609
    }
610
611
    /**
612
     * Sets the Author LP in the database
@@ 615-628 (lines=14) @@
612
     * Sets the Author LP in the database
613
     * @param	string	$author
614
     */
615
    function set_author($author = '')
616
    {
617
        $course_id = api_get_course_int_id();
618
        if ($this->debug > 0) { error_log('In aicc::set_author('.$author.') method', 0); }
619
        $lp = $this->get_id();
620
        if ($lp != 0) {
621
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
622
            $sql = "UPDATE $tbl_lp SET author = '$author' WHERE c_id = ".$course_id." id = ".$lp;
623
            $res = Database::query($sql);
624
            return $res;
625
        } else {
626
            return false;
627
        }
628
    }
629
630
    /**
631
     * Sets the content maker setting in the database
@@ 634-647 (lines=14) @@
631
     * Sets the content maker setting in the database
632
     * @param	string	$maker
633
     */
634
    function set_maker($maker = '')
635
    {
636
        $course_id = api_get_course_int_id();
637
        if ($this->debug > 0) { error_log('In aicc::set_maker method('.$maker.')', 0); }
638
        $lp = $this->get_id();
639
        if ($lp != 0) {
640
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
641
            $sql = "UPDATE $tbl_lp SET content_maker = '$maker' WHERE c_id = ".$course_id." id = ".$lp;
642
            $res = Database::query($sql);
643
            return $res;
644
        } else {
645
            return false;
646
        }
647
    }
648
649
    /**
650
     * Exports the current AICC object's files as a zip. Excerpts taken from learnpath_functions.inc.php::exportpath()

main/newscorm/scorm.class.php 3 locations

@@ 760-773 (lines=14) @@
757
     * Sets the theme setting in the database
758
     * @param	string	theme setting
759
     */
760
    public function set_theme($theme = '')
761
    {
762
        $courseId = api_get_course_int_id();
763
        if ($this->debug > 0) { error_log('In scorm::set_theme('.$theme.') method', 0); }
764
        $lp = $this->get_id();
765
        if ($lp != 0) {
766
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
767
            $sql = "UPDATE $tbl_lp SET theme = '$theme' WHERE c_id = ".$courseId." AND id = ".$lp;
768
            $res = Database::query($sql);
769
            return $res;
770
        } else {
771
            return false;
772
        }
773
    }
774
775
    /**
776
     * Sets the image setting in the database
@@ 779-792 (lines=14) @@
776
     * Sets the image setting in the database
777
     * @param	string preview_image setting
778
     */
779
    public function set_preview_image($preview_image = '')
780
    {
781
        $courseId = api_get_course_int_id();
782
        if ($this->debug > 0) { error_log('In scorm::set_theme('.$preview_image.') method', 0); }
783
        $lp = $this->get_id();
784
        if ($lp != 0) {
785
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
786
            $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE c_id = ".$courseId." AND id = ".$lp;
787
            $res = Database::query($sql);
788
            return $res;
789
        } else {
790
            return false;
791
        }
792
    }
793
794
    /**
795
     * Sets the author  setting in the database
@@ 798-811 (lines=14) @@
795
     * Sets the author  setting in the database
796
     * @param	string preview_image setting
797
     */
798
    public function set_author($author = '')
799
    {
800
        $courseId = api_get_course_int_id();
801
        if ($this->debug > 0) { error_log('In scorm::set_author('.$author.') method', 0); }
802
        $lp = $this->get_id();
803
        if ($lp != 0) {
804
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
805
            $sql = "UPDATE $tbl_lp SET author = '$author' WHERE c_id = ".$courseId." AND id = ".$lp;
806
            $res = Database::query($sql);
807
            return $res;
808
        } else {
809
            return false;
810
        }
811
    }
812
813
    /**
814
     * Sets the content maker setting in the database

main/newscorm/learnpath.class.php 1 location

@@ 4524-4540 (lines=17) @@
4521
     * @param	string	Proximity setting
4522
     * @return  boolean True on update success. False otherwise.
4523
     */
4524
    public function set_jslib($lib = '')
4525
    {
4526
        if ($this->debug > 0) {
4527
            error_log('New LP - In learnpath::set_jslib()', 0);
4528
        }
4529
        $lp = $this->get_id();
4530
        $course_id = api_get_course_int_id();
4531
4532
        if ($lp != 0) {
4533
            $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4534
            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4535
            $res = Database::query($sql);
4536
            return $res;
4537
        } else {
4538
            return false;
4539
        }
4540
    }
4541
4542
    /**
4543
     * Sets the name of the LP maker (publisher) (and save)