From 2d81d29b4ab3bd98692eb3590576b26af87936bb Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Wed, 10 Mar 2010 14:21:56 +0200 Subject: [PATCH] Feature #272 - "Assignments" and "Dropbox" tools: Showing dates correctly on PHP 5.2 and PHP 5.3. --- main/dropbox/index.php | 6 ++++-- main/work/work.lib.php | 21 ++++----------------- main/work/work.php | 16 ++++------------ 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/main/dropbox/index.php b/main/dropbox/index.php index 686102e7b0..cbc6b5acb6 100755 --- a/main/dropbox/index.php +++ b/main/dropbox/index.php @@ -432,7 +432,8 @@ if ($_GET['action'] != 'add') { $dropbox_file_data[] = $dropbox_file->author; //$dropbox_file_data[] = $dropbox_file->description; - $dropbox_file_data[] = date_to_str_ago(api_get_local_time($dropbox_file->last_upload_date, null, null, date_default_timezone_get())).'
'.api_get_local_time($dropbox_file->last_upload_date, null, null, date_default_timezone_get()).''; + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date, 'Y-m-d H:i:s', null, date_default_timezone_get()); + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'
'.api_format_date_time_long($last_upload_date).''; $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' '.Display::return_icon('comment_bubble.gif', get_lang('Comment')).' @@ -578,7 +579,8 @@ if ($_GET['action'] != 'add') { } $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. $dropbox_file_data[] = $receivers_celldata; - $dropbox_file_data[] = date_to_str_ago(api_get_local_time($dropbox_file->last_upload_date, null, null, date_default_timezone_get())).'
'.api_get_local_time($dropbox_file->last_upload_date, null, null, date_default_timezone_get()).''; + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date, 'Y-m-d H:i:s', null, date_default_timezone_get()); + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'
'.api_get_local_time($last_upload_date).''; //$dropbox_file_data[] = $dropbox_file->author; $receivers_celldata = ''; diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 029ececf30..1b37346571 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -693,15 +693,8 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC } if ($direc_date != '' && $direc_date != '0000-00-00 00:00:00') { - - $direc_date = api_get_local_time($direc_date, null, null, date_default_timezone_get()); - /* - $my_direc_date = api_ucfirst(format_locale_date($dateFormatShort, strtotime($direc_date))).'    '; - $my_direc_date .= api_ucfirst(strftime($timeNoSecFormat, strtotime($direc_date))); - */ - $my_direc_date = $direc_date; - - $row[] = date_to_str_ago($direc_date).'
'.$my_direc_date.''.''; + $direc_date = api_get_local_time($direc_date, 'Y-m-d H:i:s', null, date_default_timezone_get()); + $row[] = date_to_str_ago($direc_date).'
'.api_format_date_time_long($direc_date).''.''; } else { $row[] = ''; } @@ -761,14 +754,8 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC $row[] = ''.get_lang('Save').''.$work->title.'
'.$work->description; $row[] = display_user_link_work($row2['insert_user_id'], $work->author).$qualification_string; // $work->author; - $work_sent_date = api_get_local_time($work->sent_date, null, null, date_default_timezone_get()); - /* - $sent_date = api_ucfirst(format_locale_date($dateFormatShort, strtotime($work_sent_date))).'    '; - $sent_date .= api_ucfirst(strftime($timeNoSecFormat, strtotime($work_sent_date))); - */ - $sent_date = $work_sent_date; - - $row[] = date_to_str_ago($work->sent_date).$add_string.'
'.$sent_date.''.''; + $work_sent_date = api_get_local_time($work->sent_date, 'Y-m-d H:i:s', null, date_default_timezone_get()); + $row[] = date_to_str_ago($work_sent_date).$add_string.'
'.api_format_date_time_long($work_sent_date).''.''; if ($is_allowed_to_edit) { diff --git a/main/work/work.php b/main/work/work.php index 5119bf03e4..936db903ff 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -1117,19 +1117,11 @@ if ($is_special > 0) { define('ASSIGNMENT_EXPIRES', $time_expires); } - $ends_on_datetime = api_get_local_time($homework['ends_on'], null, null, date_default_timezone_get()); - /* - $ends_on = api_ucfirst(format_locale_date($dateFormatLong, strtotime($ends_on_datetime))).' '; - $ends_on .= api_ucfirst(strftime($timeNoSecFormat, strtotime($ends_on_datetime))); - */ - $ends_on = $ends_on_datetime; + $ends_on_datetime = api_get_local_time($homework['ends_on'], 'Y-m-d H:i:s', null, date_default_timezone_get()); + $ends_on = api_format_date_time_long($ends_on_datetime); - $expires_on_datetime = api_get_local_time($homework['expires_on'], null, null, date_default_timezone_get()); - /* - $expires_on = api_ucfirst(format_locale_date($dateFormatLong, strtotime($expires_on_datetime))).' '; - $expires_on .= api_ucfirst(strftime($timeNoSecFormat, strtotime($expires_on_datetime))); - */ - $expires_on = $expires_on_datetime; + $expires_on_datetime = api_get_local_time($homework['expires_on'], 'Y-m-d H:i:s', null, date_default_timezone_get()); + $expires_on = api_format_date_time_long($expires_on_datetime); if ($has_ended) { display_action_links($cur_dir_path, $always_show_tool_options, true);