From 56d372d93e92131a27cfd69af715ff1b4c10216c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 27 Jan 2012 17:32:42 +0100 Subject: [PATCH] Some fixes when adding end and expired date see BT#3601 #4263 --- main/work/work.lib.php | 20 +++++++++++--------- main/work/work.php | 14 +++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 5b6788e336..467121b1bf 100644 --- a/main/work/work.lib.php +++ b/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 = ' - '; } else { $qualification_string = ''.$work->qualification.''; } - - $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 = ' '.get_lang('Expired').''; - } - } + } + + $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 = ' '.get_lang('Expired').''; + } + +// } + $row[] = ''.build_document_icon_tag('file', substr(basename($work->url), 13)).''; if ($work->contains_file) { $row[] = ''.Display::return_icon('save.png', get_lang('Save'),array('style' => 'float:right;'), 22).' '.$work->title.'
'.$work->description; diff --git a/main/work/work.php b/main/work/work.php index 32ee610253..82ee491e64 100644 --- a/main/work/work.php +++ b/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;