Code Duplication    Length = 14-17 lines in 9 locations

main/lp/scorm.class.php 3 locations

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

main/lp/aicc.class.php 5 locations

@@ 581-594 (lines=14) @@
578
     * @param string $proxy Proximity setting
579
     * @return bool
580
     */
581
    function set_proximity($proxy = '')
582
    {
583
        $course_id = api_get_course_int_id();
584
        if ($this->debug > 0) { error_log('In aicc::set_proximity('.$proxy.') method', 0); }
585
        $lp = $this->get_id();
586
        if ($lp != 0) {
587
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
588
            $sql = "UPDATE $tbl_lp SET content_local = '$proxy' WHERE c_id = ".$course_id." id = ".$lp;
589
            Database::query($sql);
590
            return true;
591
        } else {
592
            return false;
593
        }
594
    }
595
596
    /**
597
     * Sets the theme setting in the database
@@ 601-614 (lines=14) @@
598
     * @param    string    Theme setting
599
     * @return bool
600
     */
601
    function set_theme($theme = '')
602
    {
603
        $course_id = api_get_course_int_id();
604
        if ($this->debug > 0) { error_log('In aicc::set_theme('.$theme.') method', 0); }
605
        $lp = $this->get_id();
606
        if ($lp != 0) {
607
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
608
            $sql = "UPDATE $tbl_lp SET theme = '$theme' WHERE c_id = ".$course_id." id = ".$lp;
609
            $res = Database::query($sql);
610
            return true;
611
        } else {
612
            return false;
613
        }
614
    }
615
616
    /**
617
     * Sets the image LP in the database
@@ 621-634 (lines=14) @@
618
     * @param    string $preview_image Theme setting
619
     * @return bool
620
     */
621
    function set_preview_image($preview_image = '')
622
    {
623
        $course_id = api_get_course_int_id();
624
        if ($this->debug > 0) {error_log('In aicc::set_preview_image('.$preview_image.') method', 0); }
625
        $lp = $this->get_id();
626
        if ($lp != 0) {
627
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
628
            $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE c_id = ".$course_id." id = ".$lp;
629
            Database::query($sql);
630
            return true;
631
        } else {
632
            return false;
633
        }
634
    }
635
636
    /**
637
     * Sets the Author LP in the database
@@ 641-654 (lines=14) @@
638
     * @param    string $author
639
     * @return true
640
     */
641
    function set_author($author = '')
642
    {
643
        $course_id = api_get_course_int_id();
644
        if ($this->debug > 0) { error_log('In aicc::set_author('.$author.') method', 0); }
645
        $lp = $this->get_id();
646
        if ($lp != 0) {
647
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
648
            $sql = "UPDATE $tbl_lp SET author = '$author' 
649
                    WHERE c_id = ".$course_id." id = ".$lp;
650
            Database::query($sql);
651
            return true;
652
        } else {
653
            return false;
654
        }
655
    }
656
657
    /**
@@ 662-675 (lines=14) @@
659
     * @param    string $maker
660
     * @return bool
661
     */
662
    function set_maker($maker = '')
663
    {
664
        $course_id = api_get_course_int_id();
665
        if ($this->debug > 0) { error_log('In aicc::set_maker method('.$maker.')', 0); }
666
        $lp = $this->get_id();
667
        if ($lp != 0) {
668
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
669
            $sql = "UPDATE $tbl_lp SET content_maker = '$maker' 
670
                    WHERE c_id = ".$course_id." id = ".$lp;
671
            Database::query($sql);
672
            return true;
673
        } else {
674
            return false;
675
        }
676
    }
677
678
    /**

main/lp/learnpath.class.php 1 location

@@ 4718-4734 (lines=17) @@
4715
     * @param	string	Proximity setting
4716
     * @return  boolean True on update success. False otherwise.
4717
     */
4718
    public function set_jslib($lib = '')
4719
    {
4720
        if ($this->debug > 0) {
4721
            error_log('New LP - In learnpath::set_jslib()', 0);
4722
        }
4723
        $lp = $this->get_id();
4724
        $course_id = api_get_course_int_id();
4725
4726
        if ($lp != 0) {
4727
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
4728
            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' 
4729
                    WHERE c_id = ".$course_id." AND id = ".$lp;
4730
            $res = Database::query($sql);
4731
            return $res;
4732
        } else {
4733
            return false;
4734
        }
4735
    }
4736
4737
    /**