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

skala
Julio Montoya 14 years ago
parent 43b0fc3813
commit 56d372d93e
  1. 16
      main/work/work.lib.php
  2. 10
      main/work/work.php

@ -863,20 +863,22 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
}
$qualification_string = '';
$add_string = '';
if ($qualification_exists) {
if ($work->qualification == '') {
$qualification_string = '<b style="color:orange"> - </b>';
} else {
$qualification_string = '<b style="color:blue">'.$work->qualification.'</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>';
}
// }
$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>';
}
}
$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;

@ -268,7 +268,6 @@ 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']);
@ -276,7 +275,7 @@ if ($is_special) {
$time_now = time();
if (!empty($homework['expires_on']) && $homework['expires_on'] != '0000-00-00 00:00:00') {
$time_expires = api_strtotime($homework['expires_on']);
$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;
@ -299,9 +298,10 @@ if ($is_special) {
$expires_on = api_convert_and_format_date($homework['expires_on']);
if ($has_ended) {
if (!api_is_allowed_to_edit()) {
//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;

Loading…
Cancel
Save