|
@@ 4538-4557 (lines=20) @@
|
| 4535 |
|
* @param string Optional string giving the new content_maker of this learnpath |
| 4536 |
|
* @return boolean True |
| 4537 |
|
*/ |
| 4538 |
|
public function set_maker($name = '') |
| 4539 |
|
{ |
| 4540 |
|
if ($this->debug > 0) { |
| 4541 |
|
error_log('New LP - In learnpath::set_maker()', 0); |
| 4542 |
|
} |
| 4543 |
|
if (empty ($name)) |
| 4544 |
|
return false; |
| 4545 |
|
$this->maker = $name; |
| 4546 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4547 |
|
$course_id = api_get_course_int_id(); |
| 4548 |
|
$lp_id = $this->get_id(); |
| 4549 |
|
$sql = "UPDATE $lp_table SET |
| 4550 |
|
content_maker = '" . Database::escape_string($this->maker) . "' |
| 4551 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4552 |
|
if ($this->debug > 2) { |
| 4553 |
|
error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0); |
| 4554 |
|
} |
| 4555 |
|
Database::query($sql); |
| 4556 |
|
return true; |
| 4557 |
|
} |
| 4558 |
|
|
| 4559 |
|
/** |
| 4560 |
|
* Sets the name of the current learnpath (and save) |
|
@@ 4758-4780 (lines=23) @@
|
| 4755 |
|
* @param int 1 if frame is hidden 0 then else |
| 4756 |
|
* @return bool Returns true if author's name is not empty |
| 4757 |
|
*/ |
| 4758 |
|
public function set_hide_toc_frame($hide) |
| 4759 |
|
{ |
| 4760 |
|
$course_id = api_get_course_int_id(); |
| 4761 |
|
if ($this->debug > 0) { |
| 4762 |
|
error_log('New LP - In learnpath::set_hide_toc_frame()', 0); |
| 4763 |
|
} |
| 4764 |
|
if (intval($hide) == $hide){ |
| 4765 |
|
$this->hide_toc_frame = $hide; |
| 4766 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4767 |
|
$lp_id = $this->get_id(); |
| 4768 |
|
$sql = "UPDATE $lp_table SET |
| 4769 |
|
hide_toc_frame = '" . $this->hide_toc_frame . "' |
| 4770 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4771 |
|
if ($this->debug > 2) { |
| 4772 |
|
error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0); |
| 4773 |
|
} |
| 4774 |
|
Database::query($sql); |
| 4775 |
|
|
| 4776 |
|
return true; |
| 4777 |
|
} else { |
| 4778 |
|
return false; |
| 4779 |
|
} |
| 4780 |
|
} |
| 4781 |
|
|
| 4782 |
|
/** |
| 4783 |
|
* Sets the prerequisite of a LP (and save) |
|
@@ 4876-4899 (lines=24) @@
|
| 4873 |
|
* @param string $expired_on Optional string giving the new author of this learnpath |
| 4874 |
|
* @return bool Returns true if author's name is not empty |
| 4875 |
|
*/ |
| 4876 |
|
public function set_expired_on($expired_on) |
| 4877 |
|
{ |
| 4878 |
|
$course_id = api_get_course_int_id(); |
| 4879 |
|
if ($this->debug > 0) { |
| 4880 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 4881 |
|
} |
| 4882 |
|
|
| 4883 |
|
if (!empty($expired_on)) { |
| 4884 |
|
$this->expired_on = api_get_utc_datetime($expired_on); |
| 4885 |
|
} else { |
| 4886 |
|
$this->expired_on = ''; |
| 4887 |
|
} |
| 4888 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4889 |
|
$lp_id = $this->get_id(); |
| 4890 |
|
$sql = "UPDATE $lp_table SET |
| 4891 |
|
expired_on = '" . Database::escape_string($this->expired_on) . "' |
| 4892 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4893 |
|
if ($this->debug > 2) { |
| 4894 |
|
error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0); |
| 4895 |
|
} |
| 4896 |
|
Database::query($sql); |
| 4897 |
|
|
| 4898 |
|
return true; |
| 4899 |
|
} |
| 4900 |
|
|
| 4901 |
|
/** |
| 4902 |
|
* Sets and saves the publicated_on date |
|
@@ 4906-4928 (lines=23) @@
|
| 4903 |
|
* @param string $publicated_on Optional string giving the new author of this learnpath |
| 4904 |
|
* @return bool Returns true if author's name is not empty |
| 4905 |
|
*/ |
| 4906 |
|
public function set_publicated_on($publicated_on) |
| 4907 |
|
{ |
| 4908 |
|
$course_id = api_get_course_int_id(); |
| 4909 |
|
if ($this->debug > 0) { |
| 4910 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 4911 |
|
} |
| 4912 |
|
if (!empty($publicated_on)) { |
| 4913 |
|
$this->publicated_on = api_get_utc_datetime($publicated_on); |
| 4914 |
|
} else { |
| 4915 |
|
$this->publicated_on = ''; |
| 4916 |
|
} |
| 4917 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4918 |
|
$lp_id = $this->get_id(); |
| 4919 |
|
$sql = "UPDATE $lp_table SET |
| 4920 |
|
publicated_on = '" . Database::escape_string($this->publicated_on) . "' |
| 4921 |
|
WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4922 |
|
if ($this->debug > 2) { |
| 4923 |
|
error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0); |
| 4924 |
|
} |
| 4925 |
|
Database::query($sql); |
| 4926 |
|
|
| 4927 |
|
return true; |
| 4928 |
|
} |
| 4929 |
|
|
| 4930 |
|
/** |
| 4931 |
|
* Sets and saves the expired_on date |