Internal: Learnpath: Rename c_lp.publicated_on to c_lp.published_on - refs #4523

Author: @christianbeeznest
pull/4575/head
christianbeeznest 3 years ago committed by GitHub
parent 995eb2ea36
commit f02a2263af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      public/main/inc/ajax/course_home.ajax.php
  2. 6
      public/main/inc/lib/tracking.lib.php
  3. 4
      public/main/inc/lib/webservices/Rest.php
  4. 24
      public/main/lp/learnpath.class.php
  5. 10
      public/main/lp/learnpathList.class.php
  6. 10
      public/main/lp/lp_add.php
  7. 16
      public/main/lp/lp_edit.php
  8. 8
      public/main/lp/lp_list.php
  9. 8
      public/main/lp/my_list.php
  10. 4
      public/main/session/index.php
  11. 34
      src/CoreBundle/Migrations/Schema/V200/Version20230124123419.php
  12. 2
      src/CourseBundle/Component/CourseCopy/CourseBuilder.php
  13. 6
      src/CourseBundle/Component/CourseCopy/CourseRestorer.php
  14. 4
      src/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
  15. 14
      src/CourseBundle/Entity/CLp.php

@ -118,15 +118,15 @@ switch ($action) {
$icons = Display::return_icon($image, get_lang('Since your latest visit').': '.$label.' - '.$lp_date);
}
if (!empty($lp_item['publicated_on'])) {
$date = substr($lp_item['publicated_on'], 0, 10);
if (!empty($lp_item['published_on'])) {
$date = substr($lp_item['published_on'], 0, 10);
} else {
$date = '-';
}
// Checking LP publicated and expired_on dates
if (!empty($lp_item['publicated_on'])) {
if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
if (!empty($lp_item['published_on'])) {
if ($now < api_strtotime($lp_item['published_on'], 'UTC')) {
continue;
}
}
@ -144,7 +144,7 @@ switch ($action) {
];
$temp[$count]['course'] = strip_tags($item['title']);
$temp[$count]['lp'] = $lp_item['lp_name'];
$temp[$count]['date'] = $lp_item['publicated_on'];
$temp[$count]['date'] = $lp_item['published_on'];
$count++;
}
}
@ -220,7 +220,7 @@ switch ($action) {
api_get_user_id(),
api_get_course_info($item['code']),
$session_id,
'lp.publicatedOn DESC'
'lp.publishedOn DESC'
);
$flat_list = $list->get_flat_list();
$lps[$item['code']] = $flat_list;
@ -255,16 +255,16 @@ switch ($action) {
$icons = Display::return_icon($image, get_lang('Since your latest visit').': '.$label.' - '.$lp_date);
}
if (!empty($lp_item['publicated_on'])) {
$date = substr($lp_item['publicated_on'], 0, 10);
if (!empty($lp_item['published_on'])) {
$date = substr($lp_item['published_on'], 0, 10);
} else {
$date = '-';
}
// Checking LP publicated and expired_on dates
if (!empty($lp_item['publicated_on'])) {
$week_data = date('Y', api_strtotime($lp_item['publicated_on'], 'UTC')).' - '.get_week_from_day($lp_item['publicated_on']);
if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
if (!empty($lp_item['published_on'])) {
$week_data = date('Y', api_strtotime($lp_item['published_on'], 'UTC')).' - '.get_week_from_day($lp_item['published_on']);
if ($now < api_strtotime($lp_item['published_on'], 'UTC')) {
continue;
}
} else {
@ -393,15 +393,15 @@ switch ($action) {
if (strtotime($last_date) < strtotime($lp_date)) {
$icons = Display::return_icon($image, get_lang('Since your latest visit').': '.$label.' - '.$lp_date);
}
if (!empty($lp_item['publicated_on'])) {
$date = substr($lp_item['publicated_on'], 0, 10);
if (!empty($lp_item['published_on'])) {
$date = substr($lp_item['published_on'], 0, 10);
} else {
$date = '-';
}
// Checking LP publicated and expired_on dates
if (!empty($lp_item['publicated_on'])) {
if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
if (!empty($lp_item['published_on'])) {
if ($now < api_strtotime($lp_item['published_on'], 'UTC')) {
continue;
}
}
@ -417,7 +417,7 @@ switch ($action) {
];
$temp[$count]['course'] = strip_tags($item['title']);
$temp[$count]['lp'] = $lp_item['lp_name'];
$temp[$count]['date'] = $lp_item['publicated_on'];
$temp[$count]['date'] = $lp_item['published_on'];
$count++;
}
}

@ -5584,7 +5584,7 @@ class Tracking
api_get_user_id(),
['real_id' => $courseId],
$sessionId,
'lp.publicatedOn ASC',
'lp.publishedOn ASC',
true,
null,
true
@ -6825,7 +6825,7 @@ class Tracking
$userId,
$courseInfo,
0,
'lp.publicatedOn ASC',
'lp.publishedOn ASC',
true,
null,
true
@ -7752,7 +7752,7 @@ class Tracking
api_get_user_id(),
$courseInfo,
$sessionId,
'lp.publicatedOn ASC',
'lp.publishedOn ASC',
true,
null,
true

@ -870,8 +870,8 @@ class Rest extends WebService
}
if ($timeLimits) {
if (!empty($lpDetails['publicated_on']) && !empty($lpDetails['expired_on'])) {
$startTime = api_strtotime($lpDetails['publicated_on'], 'UTC');
if (!empty($lpDetails['published_on']) && !empty($lpDetails['expired_on'])) {
$startTime = api_strtotime($lpDetails['published_on'], 'UTC');
$endTime = api_strtotime($lpDetails['expired_on'], 'UTC');
$now = time();
$isActiveTime = false;

@ -105,7 +105,7 @@ class learnpath
public $subscribeUsers = 0; // Subscribe users or not
public $created_on = '';
public $modified_on = '';
public $publicated_on = '';
public $published_on = '';
public $expired_on = '';
public $ref;
public $course_int_id;
@ -163,8 +163,8 @@ class learnpath
$this->accumulateScormTime = $entity->getAccumulateWorkTime();
if (!empty($entity->getPublicatedOn())) {
$this->publicated_on = $entity->getPublicatedOn()->format('Y-m-d H:i:s');
if (!empty($entity->getPublishedOn())) {
$this->published_on = $entity->getPublishedOn()->format('Y-m-d H:i:s');
}
if (!empty($entity->getExpiredOn())) {
@ -525,7 +525,7 @@ class learnpath
* @param string $learnpath
* @param string $origin
* @param string $zipname Zip file containing the learnpath or directory containing the learnpath
* @param string $publicated_on
* @param string $published_on
* @param string $expired_on
* @param int $categoryId
* @param int $userId
@ -539,7 +539,7 @@ class learnpath
$learnpath = 'guess',
$origin = 'zip',
$zipname = '',
$publicated_on = '',
$published_on = '',
$expired_on = '',
$categoryId = 0,
$userId = 0
@ -556,10 +556,10 @@ class learnpath
$categoryId = (int) $categoryId;
if (empty($publicated_on)) {
$publicated_on = null;
if (empty($published_on)) {
$published_on = null;
} else {
$publicated_on = api_get_utc_datetime($publicated_on, true, true);
$published_on = api_get_utc_datetime($published_on, true, true);
}
if (empty($expired_on)) {
@ -613,7 +613,7 @@ class learnpath
->setDescription($description)
->setDisplayOrder($dsp)
->setCategory($category)
->setPublicatedOn($publicated_on)
->setPublishedOn($published_on)
->setExpiredOn($expired_on)
->setParent($courseEntity)
->addCourseLink($courseEntity, $sessionEntity)
@ -1786,8 +1786,8 @@ class learnpath
// Also check the time availability of the LP
if ($is_visible) {
// Adding visibility restrictions
if (null !== $lp->getPublicatedOn()) {
if ($now < $lp->getPublicatedOn()->getTimestamp()) {
if (null !== $lp->getPublishedOn()) {
if ($now < $lp->getPublishedOn()->getTimestamp()) {
$is_visible = false;
}
}
@ -1796,7 +1796,7 @@ class learnpath
if (isset($_custom['lps_hidden_when_no_start_date']) &&
$_custom['lps_hidden_when_no_start_date']
) {
if (null !== $lp->getPublicatedOn()) {
if (null !== $lp->getPublishedOn()) {
$is_visible = false;
}
}

@ -69,10 +69,10 @@ class LearnpathList
$now = api_get_utc_datetime();
if ($check_publication_dates) {
$qb->andWhere(
" (resource.publicatedOn IS NOT NULL AND resource.publicatedOn < '$now' AND resource.expiredOn IS NOT NULL AND resource.expiredOn > '$now') OR
(resource.publicatedOn IS NOT NULL AND resource.publicatedOn < '$now' AND resource.expiredOn IS NULL) OR
(resource.publicatedOn IS NULL AND resource.expiredOn IS NOT NULL AND resource.expiredOn > '$now') OR
(resource.publicatedOn IS NULL AND resource.expiredOn IS NULL) "
" (resource.publishedOn IS NOT NULL AND resource.publishedOn < '$now' AND resource.expiredOn IS NOT NULL AND resource.expiredOn > '$now') OR
(resource.publishedOn IS NOT NULL AND resource.publishedOn < '$now' AND resource.expiredOn IS NULL) OR
(resource.publishedOn IS NULL AND resource.expiredOn IS NOT NULL AND resource.expiredOn > '$now') OR
(resource.publishedOn IS NULL AND resource.expiredOn IS NULL) "
);
}
@ -155,7 +155,7 @@ class LearnpathList
'autolaunch' => $lp->getAutolaunch(),
'created_on' => $lp->getCreatedOn() ? $lp->getCreatedOn()->format('Y-m-d H:i:s') : null,
'modified_on' => $lp->getModifiedOn() ? $lp->getModifiedOn()->format('Y-m-d H:i:s') : null,
'publicated_on' => $lp->getPublicatedOn() ? $lp->getPublicatedOn()->format('Y-m-d H:i:s') : null,
'published_on' => $lp->getPublishedOn() ? $lp->getPublishedOn()->format('Y-m-d H:i:s') : null,
'expired_on' => $lp->getExpiredOn() ? $lp->getExpiredOn()->format('Y-m-d H:i:s') : null,
//'category_id' => $lp['category_id'],
'subscribe_users' => $lp->getSubscribeUsers(),

@ -119,7 +119,7 @@ $form->addCheckBox(
['onclick' => 'activate_start_date()']
);
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
$form->addDatePicker('publicated_on', get_lang('Publication date'));
$form->addDatePicker('published_on', get_lang('Publication date'));
$form->addElement('html', '</div>');
//End date
@ -156,18 +156,18 @@ if ('true' === api_get_setting('scorm_cumulative_session_time')) {
$defaults['accumulate_scorm_time'] = 1;
}
$defaults['publicated_on'] = api_get_local_time();
$defaults['published_on'] = api_get_local_time();
$defaults['expired_on'] = api_get_local_time(time() + 86400);
$form->setDefaults($defaults);
$form->addButtonCreate(get_lang('Continue'));
if ($form->validate()) {
$publicated_on = null;
$published_on = null;
if (isset($_REQUEST['activate_start_date_check']) &&
1 == $_REQUEST['activate_start_date_check']
) {
$publicated_on = $_REQUEST['publicated_on'];
$published_on = $_REQUEST['published_on'];
}
$expired_on = null;
@ -184,7 +184,7 @@ if ($form->validate()) {
'chamilo',
'manual',
'',
$publicated_on,
$published_on,
$expired_on,
$_REQUEST['category_id']
);

@ -168,7 +168,7 @@ $defaults['category_id'] = $learnPath->getCategoryId();
$defaults['accumulate_scorm_time'] = $learnPath->getAccumulateScormTime();
$expired_on = $learnPath->expired_on;
$publicated_on = $learnPath->publicated_on;
$published_on = $learnPath->published_on;
// Prerequisites
$learnPath->display_lp_prerequisites_list($form);
@ -200,13 +200,13 @@ $form->addElement(
);
$display_date = 'none';
if (!empty($publicated_on) && '0000-00-00 00:00:00' !== $publicated_on) {
if (!empty($published_on) && '0000-00-00 00:00:00' !== $published_on) {
$display_date = 'block';
$defaults['activate_start_date_check'] = 1;
}
$form->addElement('html', '<div id="start_date_div" style="display:'.$display_date.';">');
$form->addDateTimePicker('publicated_on', get_lang('Publication date'));
$form->addDateTimePicker('published_on', get_lang('Publication date'));
$form->addElement('html', '</div>');
//End date
@ -305,8 +305,8 @@ $(function() {
$htmlHeadXtra[] = '<script>'.$learnPath->get_js_dropdown_array().'</script>';
$defaults['publicated_on'] = !empty($publicated_on) && '0000-00-00 00:00:00' !== $publicated_on
? api_get_local_time($publicated_on)
$defaults['published_on'] = !empty($published_on) && '0000-00-00 00:00:00' !== $published_on
? api_get_local_time($published_on)
: null;
$defaults['expired_on'] = (!empty($expired_on))
? api_get_local_time($expired_on)
@ -322,9 +322,9 @@ if ($form->validate()) {
$hide_toc_frame = 1;
}
$publicated_on = null;
$published_on = null;
if (isset($_REQUEST['activate_start_date_check']) && 1 == $_REQUEST['activate_start_date_check']) {
$publicated_on = $_REQUEST['publicated_on'];
$published_on = $_REQUEST['published_on'];
}
$expired_on = null;
@ -356,7 +356,7 @@ if ($form->validate()) {
->setUseMaxScore(isset($_POST['use_max_score']) ? 1 : 0)
->setDefaultEncoding($_REQUEST['lp_encoding'])
->setAccumulateScormTime(isset($_REQUEST['accumulate_scorm_time']) ? 1 : 0)
->setPublicatedOn(api_get_utc_datetime($publicated_on, true, true))
->setPublishedOn(api_get_utc_datetime($published_on, true, true))
->setExpiredOn(api_get_utc_datetime($expired_on, true, true))
->setCategory($category)
->setSubscribeUsers(isset($_REQUEST['subscribe_users']) ? 1 : 0)

@ -255,8 +255,8 @@ foreach ($categories as $category) {
$start_time = $end_time = '';
if ($is_allowed_to_edit) {
if (!empty($details['publicated_on'])) {
$start_time = api_convert_and_format_date($details['publicated_on'], DATE_TIME_FORMAT_SHORT);
if (!empty($details['published_on'])) {
$start_time = api_convert_and_format_date($details['published_on'], DATE_TIME_FORMAT_SHORT);
}
if (!empty($details['expired_on'])) {
$end_time = api_convert_and_format_date($details['expired_on'], DATE_TIME_FORMAT_SHORT);
@ -275,8 +275,8 @@ foreach ($categories as $category) {
if ($time_limits) {
// Check if start time
if (!empty($details['publicated_on']) && !empty($details['expired_on'])) {
$start_time = api_strtotime($details['publicated_on'], 'UTC');
if (!empty($details['published_on']) && !empty($details['expired_on'])) {
$start_time = api_strtotime($details['published_on'], 'UTC');
$end_time = api_strtotime($details['expired_on'], 'UTC');
$is_actived_time = false;
if ($now > $start_time && $end_time > $now) {

@ -34,10 +34,10 @@ if (!empty($courses)) {
$order = ' ORDER BY lp.createdOn ASC, lp.name ASC';
$now = api_get_utc_datetime();
$conditions = " (
(lp.publicatedOn IS NOT NULL AND lp.publicatedOn < '$now' AND lp.expiredOn IS NOT NULL AND lp.expiredOn > '$now') OR
(lp.publicatedOn IS NOT NULL AND lp.publicatedOn < '$now' AND lp.expiredOn IS NULL) OR
(lp.publicatedOn IS NULL AND lp.expiredOn IS NOT NULL AND lp.expiredOn > '$now') OR
(lp.publicatedOn IS NULL AND lp.expiredOn IS NULL )
(lp.publishedOn IS NOT NULL AND lp.publishedOn < '$now' AND lp.expiredOn IS NOT NULL AND lp.expiredOn > '$now') OR
(lp.publishedOn IS NOT NULL AND lp.publishedOn < '$now' AND lp.expiredOn IS NULL) OR
(lp.publishedOn IS NULL AND lp.expiredOn IS NOT NULL AND lp.expiredOn > '$now') OR
(lp.publishedOn IS NULL AND lp.expiredOn IS NULL )
)
";

@ -113,7 +113,7 @@ if (!empty($courseList)) {
api_get_user_id(),
api_get_course_info($course_data['code']),
$session_id,
'lp.publicatedOn ASC',
'lp.publishedOn ASC',
true,
null,
true
@ -152,7 +152,7 @@ if (!empty($courseList)) {
$label = get_lang('Learning path updated');
}
$mutation_date = api_strtotime($item['publicated_on']) > api_strtotime($lp_date_original) ? $item['publicated_on'] : $lp_date_original;
$mutation_date = api_strtotime($item['published_on']) > api_strtotime($lp_date_original) ? $item['published_on'] : $lp_date_original;
if (api_strtotime($mutation_date) > api_strtotime($max_mutation_date)) {
$max_mutation_date = $mutation_date;

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
final class Version20230124123419 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Rename c_lp.publicated_on to c_lp.published_on';
}
public function up(Schema $schema): void
{
if ($schema->hasTable('c_lp')) {
$this->addSql(
'ALTER TABLE c_lp CHANGE publicated_on published_on datetime NULL;'
);
}
}
public function down(Schema $schema): void
{
if ($schema->hasTable('c_lp')) {
$this->addSql(
'ALTER TABLE c_lp CHANGE published_on publicated_on datetime NULL;'
);
}
}
}

@ -1519,7 +1519,7 @@ class CourseBuilder
$obj->autolaunch,
$obj->created_on,
$obj->modified_on,
$obj->publicated_on,
$obj->published_on,
$obj->expired_on,
$obj->session_id,
$obj->category_id,

@ -2770,12 +2770,12 @@ class CourseRestorer
) {
$lp->created_on = api_get_utc_datetime();
$lp->modified_on = api_get_utc_datetime();
$lp->publicated_on = null;
$lp->published_on = null;
}
}
$lp->expired_on = isset($lp->expired_on) && '0000-00-00 00:00:00' === $lp->expired_on ? null : $lp->expired_on;
$lp->publicated_on = isset($lp->publicated_on) && '0000-00-00 00:00:00' === $lp->publicated_on ? null : $lp->publicated_on;
$lp->published_on = isset($lp->published_on) && '0000-00-00 00:00:00' === $lp->published_on ? null : $lp->published_on;
if (isset($lp->categoryId)) {
$lp->categoryId = (int) $lp->categoryId;
@ -2809,7 +2809,7 @@ class CourseRestorer
'autolaunch' => self::DBUTF8(isset($lp->autolaunch) ? $lp->autolaunch : ''),
'created_on' => empty($lp->created_on) ? api_get_utc_datetime() : self::DBUTF8($lp->created_on),
'modified_on' => empty($lp->modified_on) ? api_get_utc_datetime() : self::DBUTF8($lp->modified_on),
'publicated_on' => empty($lp->publicated_on) ? api_get_utc_datetime() : self::DBUTF8($lp->publicated_on),
'published_on' => empty($lp->published_on) ? api_get_utc_datetime() : self::DBUTF8($lp->published_on),
'expired_on' => self::DBUTF8($lp->expired_on),
'debug' => self::DBUTF8($lp->debug),
'theme' => '',

@ -132,7 +132,7 @@ class CourseCopyLearnpath extends Resource
$autolaunch,
$created_on,
$modified_on,
$publicated_on,
$published_on,
$expired_on,
$session_id,
$categoryId,
@ -159,7 +159,7 @@ class CourseCopyLearnpath extends Resource
$this->autolaunch = $autolaunch;
$this->created_on = $created_on;
$this->modified_on = $modified_on;
$this->publicated_on = $publicated_on;
$this->published_on = $published_on;
$this->expired_on = $expired_on;
$this->session_id = $session_id;
$this->author = $author;

@ -183,9 +183,9 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou
protected DateTime $modifiedOn;
/**
* @ORM\Column(name="publicated_on", type="datetime", nullable=true)
* @ORM\Column(name="published_on", type="datetime", nullable=true)
*/
protected ?DateTime $publicatedOn;
protected ?DateTime $publishedOn;
/**
* @ORM\Column(name="expired_on", type="datetime", nullable=true)
@ -225,7 +225,7 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou
$now = new DateTime();
$this->createdOn = $now;
$this->modifiedOn = $now;
$this->publicatedOn = $now;
$this->publishedOn = $now;
$this->accumulateScormTime = 1;
$this->accumulateWorkTime = 0;
$this->author = '';
@ -641,16 +641,16 @@ class CLp extends AbstractResource implements ResourceInterface, ResourceShowCou
return $this->modifiedOn;
}
public function setPublicatedOn(DateTime $publicatedOn): self
public function setPublishedOn(DateTime $publishedOn): self
{
$this->publicatedOn = $publicatedOn;
$this->publishedOn = $publishedOn;
return $this;
}
public function getPublicatedOn(): ?DateTime
public function getPublishedOn(): ?DateTime
{
return $this->publicatedOn;
return $this->publishedOn;
}
public function setExpiredOn(?DateTime $expiredOn): self

Loading…
Cancel
Save