|
@@ 4547-4566 (lines=20) @@
|
| 4544 |
|
* @param string Optional string giving the new content_maker of this learnpath |
| 4545 |
|
* @return boolean True |
| 4546 |
|
*/ |
| 4547 |
|
public function set_maker($name = '') |
| 4548 |
|
{ |
| 4549 |
|
if ($this->debug > 0) { |
| 4550 |
|
error_log('New LP - In learnpath::set_maker()', 0); |
| 4551 |
|
} |
| 4552 |
|
if (empty ($name)) |
| 4553 |
|
return false; |
| 4554 |
|
$this->maker = $name; |
| 4555 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4556 |
|
$course_id = api_get_course_int_id(); |
| 4557 |
|
$lp_id = $this->get_id(); |
| 4558 |
|
$sql = "UPDATE $lp_table SET |
| 4559 |
|
content_maker = '" . Database::escape_string($this->maker) . "' |
| 4560 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4561 |
|
if ($this->debug > 2) { |
| 4562 |
|
error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0); |
| 4563 |
|
} |
| 4564 |
|
Database::query($sql); |
| 4565 |
|
return true; |
| 4566 |
|
} |
| 4567 |
|
|
| 4568 |
|
/** |
| 4569 |
|
* Sets the name of the current learnpath (and save) |
|
@@ 4767-4789 (lines=23) @@
|
| 4764 |
|
* @param int 1 if frame is hidden 0 then else |
| 4765 |
|
* @return bool Returns true if author's name is not empty |
| 4766 |
|
*/ |
| 4767 |
|
public function set_hide_toc_frame($hide) |
| 4768 |
|
{ |
| 4769 |
|
$course_id = api_get_course_int_id(); |
| 4770 |
|
if ($this->debug > 0) { |
| 4771 |
|
error_log('New LP - In learnpath::set_hide_toc_frame()', 0); |
| 4772 |
|
} |
| 4773 |
|
if (intval($hide) == $hide){ |
| 4774 |
|
$this->hide_toc_frame = $hide; |
| 4775 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4776 |
|
$lp_id = $this->get_id(); |
| 4777 |
|
$sql = "UPDATE $lp_table SET |
| 4778 |
|
hide_toc_frame = '" . $this->hide_toc_frame . "' |
| 4779 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4780 |
|
if ($this->debug > 2) { |
| 4781 |
|
error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0); |
| 4782 |
|
} |
| 4783 |
|
Database::query($sql); |
| 4784 |
|
|
| 4785 |
|
return true; |
| 4786 |
|
} else { |
| 4787 |
|
return false; |
| 4788 |
|
} |
| 4789 |
|
} |
| 4790 |
|
|
| 4791 |
|
/** |
| 4792 |
|
* Sets the prerequisite of a LP (and save) |
|
@@ 4885-4908 (lines=24) @@
|
| 4882 |
|
* @param string $expired_on Optional string giving the new author of this learnpath |
| 4883 |
|
* @return bool Returns true if author's name is not empty |
| 4884 |
|
*/ |
| 4885 |
|
public function set_expired_on($expired_on) |
| 4886 |
|
{ |
| 4887 |
|
$course_id = api_get_course_int_id(); |
| 4888 |
|
if ($this->debug > 0) { |
| 4889 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 4890 |
|
} |
| 4891 |
|
|
| 4892 |
|
if (!empty($expired_on)) { |
| 4893 |
|
$this->expired_on = api_get_utc_datetime($expired_on); |
| 4894 |
|
} else { |
| 4895 |
|
$this->expired_on = ''; |
| 4896 |
|
} |
| 4897 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4898 |
|
$lp_id = $this->get_id(); |
| 4899 |
|
$sql = "UPDATE $lp_table SET |
| 4900 |
|
expired_on = '" . Database::escape_string($this->expired_on) . "' |
| 4901 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4902 |
|
if ($this->debug > 2) { |
| 4903 |
|
error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0); |
| 4904 |
|
} |
| 4905 |
|
Database::query($sql); |
| 4906 |
|
|
| 4907 |
|
return true; |
| 4908 |
|
} |
| 4909 |
|
|
| 4910 |
|
/** |
| 4911 |
|
* Sets and saves the publicated_on date |
|
@@ 4915-4937 (lines=23) @@
|
| 4912 |
|
* @param string $publicated_on Optional string giving the new author of this learnpath |
| 4913 |
|
* @return bool Returns true if author's name is not empty |
| 4914 |
|
*/ |
| 4915 |
|
public function set_publicated_on($publicated_on) |
| 4916 |
|
{ |
| 4917 |
|
$course_id = api_get_course_int_id(); |
| 4918 |
|
if ($this->debug > 0) { |
| 4919 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 4920 |
|
} |
| 4921 |
|
if (!empty($publicated_on)) { |
| 4922 |
|
$this->publicated_on = api_get_utc_datetime($publicated_on); |
| 4923 |
|
} else { |
| 4924 |
|
$this->publicated_on = ''; |
| 4925 |
|
} |
| 4926 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4927 |
|
$lp_id = $this->get_id(); |
| 4928 |
|
$sql = "UPDATE $lp_table SET |
| 4929 |
|
publicated_on = '" . Database::escape_string($this->publicated_on) . "' |
| 4930 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4931 |
|
if ($this->debug > 2) { |
| 4932 |
|
error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0); |
| 4933 |
|
} |
| 4934 |
|
Database::query($sql); |
| 4935 |
|
|
| 4936 |
|
return true; |
| 4937 |
|
} |
| 4938 |
|
|
| 4939 |
|
/** |
| 4940 |
|
* Sets and saves the expired_on date |