Code Duplication    Length = 14-17 lines in 9 locations

main/lp/aicc.class.php 5 locations

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

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/learnpath.class.php 1 location

@@ 4678-4694 (lines=17) @@
4675
     * @param	string	Proximity setting
4676
     * @return  boolean True on update success. False otherwise.
4677
     */
4678
    public function set_jslib($lib = '')
4679
    {
4680
        if ($this->debug > 0) {
4681
            error_log('New LP - In learnpath::set_jslib()', 0);
4682
        }
4683
        $lp = $this->get_id();
4684
        $course_id = api_get_course_int_id();
4685
4686
        if ($lp != 0) {
4687
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
4688
            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' 
4689
                    WHERE c_id = ".$course_id." AND id = ".$lp;
4690
            $res = Database::query($sql);
4691
            return $res;
4692
        } else {
4693
            return false;
4694
        }
4695
    }
4696
4697
    /**