From 0fa2cc5e0530ed5be51cbf2e605b55b9aebd29a1 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Aug 2011 11:03:42 +0200 Subject: [PATCH] Adding "lps_hidden_when_no_start_date" and "exercises_hidden_when_no_start_date" $_custom variables --- main/exercice/exercice.php | 12 +++++++----- main/exercice/exercise_submit.php | 16 +++++++++------- main/newscorm/learnpath.class.php | 19 +++++++++++++------ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 8566f73c67..681d9777e8 100755 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -777,11 +777,13 @@ if ($show == 'test') { //Blocking empty start times see BT#2800 - /* - if (empty($row['start_time']) || $row['start_time'] == '0000-00-00 00:00:00') { - $time_limits = true; - $is_actived_time = false; - }*/ + global $_custom; + if (isset($_custom['exercises_hidden_when_no_start_date']) && $_custom['exercises_hidden_when_no_start_date']) { + if (empty($row['start_time']) || $row['start_time'] == '0000-00-00 00:00:00') { + $time_limits = true; + $is_actived_time = false; + } + } // Teacher only if ($is_allowedToEdit) { diff --git a/main/exercice/exercise_submit.php b/main/exercice/exercise_submit.php index d0e835b642..ffb1be6498 100644 --- a/main/exercice/exercise_submit.php +++ b/main/exercice/exercise_submit.php @@ -569,14 +569,16 @@ if ($limit_time_exists) { } } -/* - * Blocking empty start times see BT#2800 -if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { - Display :: display_warning_message(sprintf(get_lang('ExerciseNoStartedYet'), $exerciseTitle, $objExercise->selectAttempts())); - if ($origin != 'learnpath') { - Display :: display_footer(); +// Blocking empty start times see BT#2800 +global $_custom; +if (isset($_custom['exercises_hidden_when_no_start_date']) && $_custom['exercises_hidden_when_no_start_date']) { + if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { + Display :: display_warning_message(sprintf(get_lang('ExerciseNoStartedYet'), $exerciseTitle, $objExercise->selectAttempts())); + if ($origin != 'learnpath') { + Display :: display_footer(); + } } -}*/ +} //Timer control if ($time_control) { diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 69d8ba6d55..db699e2b5f 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -604,7 +604,12 @@ class learnpath { if ($publicated_on == '0000-00-00 00:00:00' || empty($publicated_on)) { //by default the publication date is the same that the creation date //The behaviour above was changed due BT#2800 - $publicated_on = ''; + global $_custom; + if (isset($_custom['lps_hidden_when_no_start_date']) && $_custom['lps_hidden_when_no_start_date']) { + $publicated_on = ''; + } else { + $publicated_on = api_get_utc_datetime(); + } } else { $publicated_on = Database::escape_string(api_get_utc_datetime($publicated_on)); } @@ -2013,11 +2018,13 @@ class learnpath { } //Blocking empty start times see BT#2800 - /* - if (empty($row['publicated_on']) || $row['publicated_on'] == '0000-00-00 00:00:00') { - //api_not_allowed(); - $is_visible = false; - }*/ + global $_custom; + if (isset($_custom['lps_hidden_when_no_start_date']) && $_custom['lps_hidden_when_no_start_date']) { + if (empty($row['publicated_on']) || $row['publicated_on'] == '0000-00-00 00:00:00') { + //api_not_allowed(); + $is_visible = false; + } + } if (!empty($row['expired_on']) && $row['expired_on'] != '0000-00-00 00:00:00') { if ($now > api_strtotime($row['expired_on'], 'UTC')) {