Fixing \"expired\" messages in works see BT#1661

skala
Julio Montoya 14 years ago
parent b1b18e7a13
commit 24d7be2101
  1. 2
      main/work/work.lib.php
  2. 22
      main/work/work.php

@ -800,7 +800,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
//$qualification_string = '<b style="color:blue">'.get_lang('Qualification').': '.$work->qualification.'</b>';
$qualification_string = '<b style="color:blue">'.$work->qualification.'</b>';
}
if (defined('ASSIGNMENT_EXPIRES') && (ASSIGNMENT_EXPIRES < convert_date_to_number($work->sent_date))) {
if (defined('ASSIGNMENT_EXPIRES') && (ASSIGNMENT_EXPIRES < api_strtotime($work->sent_date))) {
$add_string = ' <b style="color:red">'.get_lang('Expired').'</b>';
}
}

@ -1132,30 +1132,32 @@ if ($is_special > 0) {
$is_special = true; //we are in a folder
define('IS_ASSIGNMENT', 1);
$sql = Database::query('SELECT * FROM '.$TSTDPUBASG.' WHERE publication_id = '.intval($publication['id']).' LIMIT 1');
$homework = Database::fetch_array($sql);
$homework = Database::fetch_array($sql,'ASSOC');
$has_expired = $has_ended = false;
$has_expiry_date = true;
$has_expiry_date = false;
if ($homework['expires_on'] != '0000-00-00 00:00:00' || $homework['ends_on'] != '0000-00-00 00:00:00') {
$time_now = convert_date_to_number(api_get_local_time());
$time_now = time();
if ($homework['expires_on'] != '0000-00-00 00:00:00') {
$time_expires = convert_date_to_number(api_get_local_time($homework['expires_on']));
$difference = $time_expires - $time_now;
if ($difference < 0)
$time_expires = api_strtotime($homework['expires_on']);
$difference = $time_expires - $time_now;
if ($difference < 0) {
$has_expired = true;
$has_expiry_date = true;
}
}
if ($homework['ends_on'] != '0000-00-00 00:00:00') {
$time_ends = convert_date_to_number(api_get_local_time($homework['ends_on']));
$difference2 = $time_ends - $time_now;
if ($difference2 < 0) {
$time_ends = api_strtotime($homework['ends_on']);
$difference2 = $time_ends - $time_now;
if ($difference2 < 0) {
$has_ended = true;
}
}
if ($homework['expires_on'] == '0000-00-00 00:00:00') {
$has_expiry_date = false;
}
if (!$has_expiry_date) {
if ($has_expiry_date) {
//@todo fix me
define('ASSIGNMENT_EXPIRES', $time_expires);
}

Loading…
Cancel
Save