|
@@ 5038-5066 (lines=29) @@
|
| 5035 |
|
* @param string $expired_on Optional string giving the new author of this learnpath |
| 5036 |
|
* @return bool Returns true if author's name is not empty |
| 5037 |
|
*/ |
| 5038 |
|
public function set_expired_on($expired_on) |
| 5039 |
|
{ |
| 5040 |
|
if ($this->debug > 0) { |
| 5041 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 5042 |
|
} |
| 5043 |
|
|
| 5044 |
|
$em = Database::getManager(); |
| 5045 |
|
/** @var CLp $lp */ |
| 5046 |
|
$lp = $em |
| 5047 |
|
->getRepository('ChamiloCourseBundle:CLp') |
| 5048 |
|
->findOneBy(['id' => $this->get_id(), 'cId' => api_get_course_int_id()]); |
| 5049 |
|
|
| 5050 |
|
if (!$lp) { |
| 5051 |
|
return false; |
| 5052 |
|
} |
| 5053 |
|
|
| 5054 |
|
$this->expired_on = !empty($expired_on) ? api_get_utc_datetime($expired_on, false, true) : null; |
| 5055 |
|
|
| 5056 |
|
$lp->setExpiredOn($this->expired_on); |
| 5057 |
|
|
| 5058 |
|
$em->persist($lp); |
| 5059 |
|
$em->flush(); |
| 5060 |
|
|
| 5061 |
|
if ($this->debug > 2) { |
| 5062 |
|
error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0); |
| 5063 |
|
} |
| 5064 |
|
|
| 5065 |
|
return true; |
| 5066 |
|
} |
| 5067 |
|
|
| 5068 |
|
/** |
| 5069 |
|
* Sets and saves the publicated_on date |
|
@@ 5073-5101 (lines=29) @@
|
| 5070 |
|
* @param string $publicated_on Optional string giving the new author of this learnpath |
| 5071 |
|
* @return bool Returns true if author's name is not empty |
| 5072 |
|
*/ |
| 5073 |
|
public function set_publicated_on($publicated_on) |
| 5074 |
|
{ |
| 5075 |
|
if ($this->debug > 0) { |
| 5076 |
|
error_log('New LP - In learnpath::set_expired_on()', 0); |
| 5077 |
|
} |
| 5078 |
|
|
| 5079 |
|
$em = Database::getManager(); |
| 5080 |
|
/** @var CLp $lp */ |
| 5081 |
|
$lp = $em |
| 5082 |
|
->getRepository('ChamiloCourseBundle:CLp') |
| 5083 |
|
->findOneBy(['id' => $this->get_id(), 'cId' => api_get_course_int_id()]); |
| 5084 |
|
|
| 5085 |
|
if (!$lp) { |
| 5086 |
|
return false; |
| 5087 |
|
} |
| 5088 |
|
|
| 5089 |
|
$this->publicated_on = !empty($publicated_on) ? api_get_utc_datetime($publicated_on, false, true) : null; |
| 5090 |
|
$lp->setPublicatedOn($this->publicated_on); |
| 5091 |
|
$em->persist($lp); |
| 5092 |
|
$em->flush(); |
| 5093 |
|
|
| 5094 |
|
if ($this->debug > 2) { |
| 5095 |
|
error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0); |
| 5096 |
|
} |
| 5097 |
|
|
| 5098 |
|
return true; |
| 5099 |
|
} |
| 5100 |
|
|
| 5101 |
|
/** |
| 5102 |
|
* Sets and saves the expired_on date |
| 5103 |
|
* @return bool Returns true if author's name is not empty |
| 5104 |
|
*/ |