@@ 4694-4711 (lines=18) @@ | ||
4691 | * @param string Optional string giving the new theme of this learnpath |
|
4692 | * @return bool Returns true if theme name is not empty |
|
4693 | */ |
|
4694 | public function set_theme($name = '') |
|
4695 | { |
|
4696 | $course_id = api_get_course_int_id(); |
|
4697 | if ($this->debug > 0) { |
|
4698 | error_log('New LP - In learnpath::set_theme()', 0); |
|
4699 | } |
|
4700 | $this->theme = $name; |
|
4701 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
4702 | $lp_id = $this->get_id(); |
|
4703 | $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "' |
|
4704 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
|
4705 | if ($this->debug > 2) { |
|
4706 | error_log('New LP - lp updated with new theme : ' . $this->theme, 0); |
|
4707 | } |
|
4708 | Database::query($sql); |
|
4709 | ||
4710 | return true; |
|
4711 | } |
|
4712 | ||
4713 | /** |
|
4714 | * Sets the image of an LP (and save) |
|
@@ 4718-4736 (lines=19) @@ | ||
4715 | * @param string Optional string giving the new image of this learnpath |
|
4716 | * @return bool Returns true if theme name is not empty |
|
4717 | */ |
|
4718 | public function set_preview_image($name = '') |
|
4719 | { |
|
4720 | $course_id = api_get_course_int_id(); |
|
4721 | if ($this->debug > 0) { |
|
4722 | error_log('New LP - In learnpath::set_preview_image()', 0); |
|
4723 | } |
|
4724 | ||
4725 | $this->preview_image = $name; |
|
4726 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
4727 | $lp_id = $this->get_id(); |
|
4728 | $sql = "UPDATE $lp_table SET |
|
4729 | preview_image = '" . Database::escape_string($this->preview_image). "' |
|
4730 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
|
4731 | if ($this->debug > 2) { |
|
4732 | error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0); |
|
4733 | } |
|
4734 | Database::query($sql); |
|
4735 | return true; |
|
4736 | } |
|
4737 | ||
4738 | /** |
|
4739 | * Sets the author of a LP (and save) |
|
@@ 4743-4760 (lines=18) @@ | ||
4740 | * @param string Optional string giving the new author of this learnpath |
|
4741 | * @return bool Returns true if author's name is not empty |
|
4742 | */ |
|
4743 | public function set_author($name = '') |
|
4744 | { |
|
4745 | $course_id = api_get_course_int_id(); |
|
4746 | if ($this->debug > 0) { |
|
4747 | error_log('New LP - In learnpath::set_author()', 0); |
|
4748 | } |
|
4749 | $this->author = $name; |
|
4750 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
4751 | $lp_id = $this->get_id(); |
|
4752 | $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "' |
|
4753 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
|
4754 | if ($this->debug > 2) { |
|
4755 | error_log('New LP - lp updated with new preview author : ' . $this->author, 0); |
|
4756 | } |
|
4757 | Database::query($sql); |
|
4758 | ||
4759 | return true; |
|
4760 | } |
|
4761 | ||
4762 | /** |
|
4763 | * Sets the hide_toc_frame parameter of a LP (and save) |
|
@@ 4796-4812 (lines=17) @@ | ||
4793 | * @param int integer giving the new prerequisite of this learnpath |
|
4794 | * @return bool returns true if prerequisite is not empty |
|
4795 | */ |
|
4796 | public function set_prerequisite($prerequisite) |
|
4797 | { |
|
4798 | $course_id = api_get_course_int_id(); |
|
4799 | if ($this->debug > 0) { |
|
4800 | error_log('New LP - In learnpath::set_prerequisite()', 0); |
|
4801 | } |
|
4802 | $this->prerequisite = intval($prerequisite); |
|
4803 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
4804 | $lp_id = $this->get_id(); |
|
4805 | $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."' |
|
4806 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
|
4807 | if ($this->debug > 2) { |
|
4808 | error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0); |
|
4809 | } |
|
4810 | Database::query($sql); |
|
4811 | return true; |
|
4812 | } |
|
4813 | ||
4814 | /** |
|
4815 | * Sets the location/proximity of the LP (local/remote) (and save) |
|
@@ 4943-4959 (lines=17) @@ | ||
4940 | * Sets and saves the expired_on date |
|
4941 | * @return bool Returns true if author's name is not empty |
|
4942 | */ |
|
4943 | public function set_modified_on() |
|
4944 | { |
|
4945 | $course_id = api_get_course_int_id(); |
|
4946 | if ($this->debug > 0) { |
|
4947 | error_log('New LP - In learnpath::set_expired_on()', 0); |
|
4948 | } |
|
4949 | $this->modified_on = api_get_utc_datetime(); |
|
4950 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
4951 | $lp_id = $this->get_id(); |
|
4952 | $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "' |
|
4953 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
|
4954 | if ($this->debug > 2) { |
|
4955 | error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0); |
|
4956 | } |
|
4957 | Database::query($sql); |
|
4958 | return true; |
|
4959 | } |
|
4960 | ||
4961 | /** |
|
4962 | * Sets the object's error message |