diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index ad67f5975b..6c175333a9 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -144,13 +144,12 @@ class learnpath { $this->modified_on = $row['modified_on']; if ($row['publicated_on'] != '0000-00-00 00:00:00') { - $this->publicated_on = api_get_local_time($row['publicated_on']); + $this->publicated_on = $row['publicated_on']; } if ($row['expired_on'] != '0000-00-00 00:00:00') { - $this->expired_on = api_get_local_time($row['expired_on']); - } - + $this->expired_on = $row['expired_on']; + } if ($this->type == 2) { if ($row['force_commit'] == 1) { $this->force_commit = true; diff --git a/main/newscorm/lp_edit.php b/main/newscorm/lp_edit.php index 6e3b0f7fec..0b59a1f503 100755 --- a/main/newscorm/lp_edit.php +++ b/main/newscorm/lp_edit.php @@ -219,8 +219,8 @@ $form->addElement('hidden', 'action', 'update_lp'); $form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id()); -$defaults['publicated_on'] = ($publicated_on!='0000-00-00 00:00:00' && !empty($publicated_on))? $publicated_on : date('Y-m-d 12:00:00'); -$defaults['expired_on'] = ($expired_on !='0000-00-00 00:00:00' && !empty($expired_on) )? $expired_on : date('Y-m-d 12:00:00',time()+84600); +$defaults['publicated_on'] = ($publicated_on!='0000-00-00 00:00:00' && !empty($publicated_on))? api_get_local_time($publicated_on) : date('Y-m-d 12:00:00'); +$defaults['expired_on'] = ($expired_on !='0000-00-00 00:00:00' && !empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00',time()+84600); $form->setDefaults($defaults); echo '
| '; diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 89dcb992a9..1ee2632ec3 100755 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -68,9 +68,25 @@ $htmlHeadXtra[] = ''; $_SESSION['oLP']->error = ''; -$lp_type = $_SESSION['oLP']->get_type(); -$lp_item_id = $_SESSION['oLP']->get_current_item_id(); +$now = time(); + +//Adding visibility reestrinctions +if (!empty($_SESSION['oLP']->publicated_on) && $_SESSION['oLP']->publicated_on != '0000-00-00 00:00:00') { + if ($now < api_strtotime($_SESSION['oLP']->publicated_on)) { + api_not_allowed(); + } +} + +if (!empty($_SESSION['oLP']->expired_on) && $_SESSION['oLP']->expired_on != '0000-00-00 00:00:00') { + if ($now > api_strtotime($_SESSION['oLP']->expired_on)) { + api_not_allowed(); + } +} + + +$lp_item_id = $_SESSION['oLP']->get_current_item_id(); +$lp_type = $_SESSION['oLP']->get_type(); //$lp_item_id = learnpath::escape_string($_GET['item_id']); //$_SESSION['oLP']->set_current_item($lp_item_id); // Already done by lp_controller.php. |