瀏覽代碼

Adding "lps_hidden_when_no_start_date" and "exercises_hidden_when_no_start_date" $_custom variables

Julio Montoya 13 年之前
父節點
當前提交
0fa2cc5e05
共有 3 個文件被更改,包括 29 次插入18 次删除
  1. 7 5
      main/exercice/exercice.php
  2. 9 7
      main/exercice/exercise_submit.php
  3. 13 6
      main/newscorm/learnpath.class.php

+ 7 - 5
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) {                   

+ 9 - 7
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) {

+ 13 - 6
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')) {