소스 검색

Some fixes when adding end and expired date see BT#3601 #4263

Julio Montoya 13 년 전
부모
커밋
56d372d93e
2개의 변경된 파일18개의 추가작업 그리고 16개의 파일을 삭제
  1. 11 9
      main/work/work.lib.php
  2. 7 7
      main/work/work.php

+ 11 - 9
main/work/work.lib.php

@@ -862,21 +862,23 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
 					$class = '';
 				}
 
-				$qualification_string = '';
-				$add_string = '';
-
+				$qualification_string = '';                
 				if ($qualification_exists) {
 					if ($work->qualification == '') {
 						$qualification_string = '<b style="color:orange"> - </b>';
 					} else {
 						$qualification_string = '<b style="color:blue">'.$work->qualification.'</b>';
 					}
-						
-					$time_expires 	= api_strtotime($my_assignment['expires_on']);
-					if (!empty($my_assignment['expires_on']) && $my_assignment['expires_on'] != '0000-00-00 00:00:00' && $time_expires < api_strtotime($work->sent_date)) {
-						$add_string = ' <b style="color:red">'.get_lang('Expired').'</b>';
-					}
-				}
+                }
+                
+                $add_string = '';		
+                $time_expires = api_strtotime($my_assignment['expires_on'], 'UTC');
+                if (!empty($my_assignment['expires_on']) && $my_assignment['expires_on'] != '0000-00-00 00:00:00' && $time_expires < api_strtotime($work->sent_date, 'UTC')) {
+                    $add_string = ' <b style="color:red">'.get_lang('Expired').'</b>';
+                }
+                
+//				}
+                
 				$row[] = '<a href="download.php?id='.$work->id.'">'.build_document_icon_tag('file', substr(basename($work->url), 13)).'</a>';
 				if ($work->contains_file) {
 					$row[] = '<a href="download.php?id='.$work->id.'"'.$class.'>'.Display::return_icon('save.png', get_lang('Save'),array('style' => 'float:right;'), 22).' '.$work->title.'</a><br />'.$work->description;

+ 7 - 7
main/work/work.php

@@ -268,15 +268,14 @@ if (!in_array($action, array('send_mail','add', 'upload'))) {
 $show_tool_options = $action == 'list' ? true : false;
 
 $display_upload_link = $action == 'upload_form' ? false : true;
-
 if ($is_special) {    
 	$homework = get_work_assignment_by_id($my_folder_data['id']);    
 	
 	if ($homework['expires_on'] != '0000-00-00 00:00:00' || $homework['ends_on'] != '0000-00-00 00:00:00') {
 		$time_now		= time();
 
-		if (!empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00') {
-			$time_expires 	= api_strtotime($homework['expires_on']);
+		if (!empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00') {            
+			$time_expires 	= api_strtotime($homework['expires_on'], 'UTC');
 			$difference 	= $time_expires - $time_now;
 			if ($difference < 0) {
 				$has_expired = true;				
@@ -288,7 +287,7 @@ if ($is_special) {
 		}
         
 		if (!empty($homework['ends_on']) && $homework['ends_on'] != '0000-00-00 00:00:00') {
-			$time_ends 		= api_strtotime($homework['ends_on']);
+			$time_ends 		= api_strtotime($homework['ends_on'], 'UTC');
 			$difference2 	= $time_ends - $time_now;
 			if ($difference2 < 0) {
 				$has_ended = true;
@@ -298,10 +297,11 @@ if ($is_special) {
 		$ends_on 	= api_convert_and_format_date($homework['ends_on']);
 		$expires_on = api_convert_and_format_date($homework['expires_on']);
 
-		if ($has_ended) {                                  
-            if (!api_is_allowed_to_edit()) {                
+		if ($has_ended) {
+            
+            //if (!api_is_allowed_to_edit()) {                
                 $display_upload_link = false;
-            }
+            //}
 			$message = Display::return_message(get_lang('EndDateAlreadyPassed').' '.$ends_on, 'error');
 		} elseif ($has_expired) {            
             $display_upload_link = true;