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

@@ 732-745 (lines=14) @@
729
     * Sets the theme setting in the database
730
     * @param	string	theme setting
731
     */
732
    public function set_theme($theme = '')
733
    {
734
        $courseId = api_get_course_int_id();
735
        if ($this->debug > 0) { error_log('In scorm::set_theme('.$theme.') method', 0); }
736
        $lp = $this->get_id();
737
        if ($lp != 0) {
738
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
739
            $sql = "UPDATE $tbl_lp SET theme = '$theme' WHERE c_id = ".$courseId." AND id = ".$lp;
740
            $res = Database::query($sql);
741
            return $res;
742
        } else {
743
            return false;
744
        }
745
    }
746
747
    /**
748
     * Sets the image setting in the database
@@ 751-764 (lines=14) @@
748
     * Sets the image setting in the database
749
     * @param	string preview_image setting
750
     */
751
    public function set_preview_image($preview_image = '')
752
    {
753
        $courseId = api_get_course_int_id();
754
        if ($this->debug > 0) { error_log('In scorm::set_theme('.$preview_image.') method', 0); }
755
        $lp = $this->get_id();
756
        if ($lp != 0) {
757
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
758
            $sql = "UPDATE $tbl_lp SET preview_image = '$preview_image' WHERE c_id = ".$courseId." AND id = ".$lp;
759
            $res = Database::query($sql);
760
            return $res;
761
        } else {
762
            return false;
763
        }
764
    }
765
766
    /**
767
     * Sets the author  setting in the database
@@ 770-783 (lines=14) @@
767
     * Sets the author  setting in the database
768
     * @param	string preview_image setting
769
     */
770
    public function set_author($author = '')
771
    {
772
        $courseId = api_get_course_int_id();
773
        if ($this->debug > 0) { error_log('In scorm::set_author('.$author.') method', 0); }
774
        $lp = $this->get_id();
775
        if ($lp != 0) {
776
            $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
777
            $sql = "UPDATE $tbl_lp SET author = '$author' WHERE c_id = ".$courseId." AND id = ".$lp;
778
            $res = Database::query($sql);
779
            return $res;
780
        } else {
781
            return false;
782
        }
783
    }
784
785
    /**
786
     * Sets the content maker setting in the database

main/newscorm/learnpath.class.php 1 location

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